8#ifndef META_OCEAN_BASE_SHARED_MEMORY_H
9#define META_OCEAN_BASE_SHARED_MEMORY_H
59 inline const std::wstring&
name()
const;
65 inline size_t size()
const;
100 explicit inline operator bool()
const;
164inline SharedMemory::operator bool()
const
166 return data_ !=
nullptr;
void flush()
Flushes the shared memory.
SharedMemory()=default
Creates a new shared memory object.
size_t size_
Sized of the shared memory buffer in bytes.
Definition SharedMemory.h:135
size_t size() const
Returns the size of the shared memory buffer in bytes.
Definition SharedMemory.h:149
std::wstring name_
System wide unique memory name.
Definition SharedMemory.h:132
SharedMemory(const std::wstring &name, const size_t size)
Creates a new shared memory object with specified buffer size.
void * data_
Pointer to the shared memory.
Definition SharedMemory.h:138
static bool requestSharedMemory(const std::wstring &name, size_t &size, void *&handle, void *&data, bool *existedAlready=nullptr)
Requests a shared memory buffer.
SharedMemory(const SharedMemory &sharedMemory)=delete
Disabled copy constructor for a shared memory object.
~SharedMemory()
Destructs a shared memory object.
SharedMemory & operator=(SharedMemory &&sharedMemory) noexcept
Move operator for shared memory objects.
void * data()
Returns a pointer to the shared memory buffer.
Definition SharedMemory.h:159
void * handle_
Shared memory handle.
Definition SharedMemory.h:141
void release()
Releases the shared memory buffer.
const std::wstring & name() const
Returns the system wide unique name of this shared memory.
Definition SharedMemory.h:144
SharedMemory(SharedMemory &&sharedMemory) noexcept
Move constructor for a shared memory object.
bool resize(const size_t newSize)
Resizes the shared memory buffer.
const void * constdata() const
Returns a pointer to the shared memory buffer.
Definition SharedMemory.h:154
SharedMemory & operator=(const SharedMemory &sharedMemory)=delete
Disabled assign operator for shared memory objects.
The namespace covering the entire Ocean framework.
Definition Accessor.h:15