This class implements a shared memory object allowing access to a shared buffer.
More...
This class implements a shared memory object allowing access to a shared buffer.
- See also
- SharedLock.
◆ SharedMemory() [1/4]
Ocean::SharedMemory::SharedMemory |
( |
| ) |
|
|
default |
Creates a new shared memory object.
◆ SharedMemory() [2/4]
Ocean::SharedMemory::SharedMemory |
( |
const std::wstring & |
name, |
|
|
const size_t |
size |
|
) |
| |
Creates a new shared memory object with specified buffer size.
- Parameters
-
name | System wide unique name of the shared memory |
size | Size of the buffer in bytes |
◆ SharedMemory() [3/4]
Ocean::SharedMemory::SharedMemory |
( |
const SharedMemory & |
sharedMemory | ) |
|
|
delete |
Disabled copy constructor for a shared memory object.
- Parameters
-
sharedMemory | Shared memory object to be copied |
◆ SharedMemory() [4/4]
Ocean::SharedMemory::SharedMemory |
( |
SharedMemory && |
sharedMemory | ) |
|
|
noexcept |
Move constructor for a shared memory object.
- Parameters
-
sharedMemory | Shared memory object to be copied |
◆ ~SharedMemory()
Ocean::SharedMemory::~SharedMemory |
( |
| ) |
|
Destructs a shared memory object.
◆ constdata()
const void * Ocean::SharedMemory::constdata |
( |
| ) |
const |
|
inline |
Returns a pointer to the shared memory buffer.
- Returns
- Memory buffer
◆ data()
void * Ocean::SharedMemory::data |
( |
| ) |
|
|
inline |
Returns a pointer to the shared memory buffer.
- Returns
- Memory buffer
◆ flush()
void Ocean::SharedMemory::flush |
( |
| ) |
|
Flushes the shared memory.
◆ name()
const std::wstring & Ocean::SharedMemory::name |
( |
| ) |
const |
|
inline |
Returns the system wide unique name of this shared memory.
- Returns
- Shared memory name
◆ operator bool()
Ocean::SharedMemory::operator bool |
( |
| ) |
const |
|
inlineexplicit |
Returns whether this shared memory object holds a valid shared buffer.
- Returns
- True, if so
◆ operator=() [1/2]
Disabled assign operator for shared memory objects.
- Parameters
-
sharedMemory | Shared memory object to be assigned |
- Returns
- Reference to this object
◆ operator=() [2/2]
Move operator for shared memory objects.
- Parameters
-
sharedMemory | Shared memory object to be moved |
- Returns
- Reference to this object
◆ release()
void Ocean::SharedMemory::release |
( |
| ) |
|
Releases the shared memory buffer.
◆ requestSharedMemory()
static bool Ocean::SharedMemory::requestSharedMemory |
( |
const std::wstring & |
name, |
|
|
size_t & |
size, |
|
|
void *& |
handle, |
|
|
void *& |
data, |
|
|
bool * |
existedAlready = nullptr |
|
) |
| |
|
staticprivate |
Requests a shared memory buffer.
- Parameters
-
name | Unique system wide memory name |
size | Size of the requested memory and finally the resulting size of the created memory (or already existing memory) |
handle | Resulting memory handle |
data | Resulting buffer pointer |
existedAlready | Optional resulting whether the buffer existed already |
- Returns
- True, if succeeded
◆ resize()
bool Ocean::SharedMemory::resize |
( |
const size_t |
newSize | ) |
|
Resizes the shared memory buffer.
- Parameters
-
newSize | New size of the shared buffer in bytes |
- Returns
- True, if succeeded
◆ size()
size_t Ocean::SharedMemory::size |
( |
| ) |
const |
|
inline |
Returns the size of the shared memory buffer in bytes.
- Returns
- Buffer size
◆ data_
void* Ocean::SharedMemory::data_ = nullptr |
|
private |
Pointer to the shared memory.
◆ handle_
void* Ocean::SharedMemory::handle_ = nullptr |
|
private |
◆ name_
std::wstring Ocean::SharedMemory::name_ |
|
private |
System wide unique memory name.
◆ size_
size_t Ocean::SharedMemory::size_ = 0 |
|
private |
Sized of the shared memory buffer in bytes.
The documentation for this class was generated from the following file: