winapi_common
Public Types | Public Member Functions | Static Public Member Functions | List of all members
winapi::SharedObject< T > Class Template Reference

Easy way to represent a C++ object as a shared memory region. More...

Public Types

typedef std::aligned_storage< sizeof(T), __alignof(T)>::type AlignedType
 

Public Member Functions

 SharedObject (SharedObject &&other) noexcept=default
 
SharedObjectoperator= (const SharedObject &other) noexcept=default
 
 SharedObject (const SharedObject &)=delete
 
T * ptr () const
 
T & get () const
 
T * operator-> () const
 
T & operator* () const
 

Static Public Member Functions

template<typename... Args>
static SharedObject create (const std::string &name, Args &&... args)
 
static SharedObject open (const std::string &name)
 

Detailed Description

template<typename T>
class winapi::SharedObject< T >

Easy way to represent a C++ object as a shared memory region.

Definition at line 53 of file shmem.hpp.

Member Function Documentation

◆ create()

template<typename T >
template<typename... Args>
static SharedObject winapi::SharedObject< T >::create ( const std::string &  name,
Args &&...  args 
)
inlinestatic

Create the object & construct a shared memory region to store it.

Parameters
nameUTF-8 string, name of the shared memory region.
argsArguments to construct the object.

Definition at line 63 of file shmem.hpp.

◆ open()

template<typename T >
static SharedObject winapi::SharedObject< T >::open ( const std::string &  name)
inlinestatic

Open a shared memory region that stores the object.

Parameters
nameUTF-8 string, name of the shared memory region.

Definition at line 74 of file shmem.hpp.

◆ ptr()

template<typename T >
T* winapi::SharedObject< T >::ptr ( ) const
inline

Get pointer to the object.

Definition at line 90 of file shmem.hpp.

◆ get()

template<typename T >
T& winapi::SharedObject< T >::get ( ) const
inline

Get reference to the object.

Definition at line 92 of file shmem.hpp.


The documentation for this class was generated from the following file: