Shared memory.
More...
#include <base/mem/SharedMemory.h>
Inherits Object.
Shared memory.
Shared memory support.
- Version
- 1.0
◆ Access
Access to shared memory.
Enumerator |
---|
READ | Read access.
|
WRITE | Write access.
|
READWRITE | Read and write access.
|
EXECUTE | Execute access.
|
ANY | Read, write, and execute access.
|
◆ Option
Options.
Enumerator |
---|
PREPARE | Specifies that the file should be extended to the specified file region.
|
CLEAR | Specifies that the region should be initialized with zeros.
|
◆ SharedMemory() [1/2]
SharedMemory::SharedMemory |
( |
const String & |
path, |
|
|
const FileRegion & |
region, |
|
|
unsigned int |
access, |
|
|
unsigned int |
options |
|
) |
| |
Initializes shared memory object.
- Parameters
-
path | The path of the file. |
region | The file region to map into memory. |
access | The required access. |
options | The options. |
◆ SharedMemory() [2/2]
Initializes object by object.
◆ clear()
void SharedMemory::clear |
( |
| ) |
|
|
noexcept |
Fills the memory with zeros.
◆ getBytes() [1/2]
const uint8* SharedMemory::getBytes |
( |
| ) |
const |
|
inlinenoexcept |
Returns the shared bytes for non-modifying access.
◆ getBytes() [2/2]
uint8* SharedMemory::getBytes |
( |
| ) |
|
|
inlinenoexcept |
Returns the shared bytes for modifying access.
◆ getGranularity()
static MemorySize SharedMemory::getGranularity |
( |
| ) |
|
|
staticnoexcept |
Returns the granularity of addresses/offsets within the shared memory block and file object.
◆ getOffset()
long long SharedMemory::getOffset |
( |
| ) |
const |
|
inlinenoexcept |
Returns the offset within the file of the mapped region.
◆ getRegion()
const FileRegion& SharedMemory::getRegion |
( |
| ) |
const |
|
inlinenoexcept |
Returns the region of the mapped.
◆ getSize()
unsigned int SharedMemory::getSize |
( |
| ) |
const |
|
inlinenoexcept |
Returns the size of the map.
◆ lock()
void SharedMemory::lock |
( |
| ) |
|
◆ operator=()
Assignment of object by object.
◆ setProtection()
void SharedMemory::setProtection |
( |
unsigned int |
access | ) |
|
Sets the desired protection of the shared memory.
◆ synchronize()
void SharedMemory::synchronize |
( |
bool |
asynchronous = false | ) |
|
Synchronize memory with file.
- Parameters
-
asynchronous | Allows the method to return before all data has been written. The default is false. |
◆ unlock()
void SharedMemory::unlock |
( |
| ) |
|
◆ sharedMemory
The internal shared memory representation.