#include <SharedMemory.hpp>
◆ SharedMemory()
cluon::SharedMemory::SharedMemory |
( |
const std::string & |
name, |
|
|
uint32_t |
size = 0 |
|
) |
| |
|
noexcept |
Constructor.
- Parameters
-
name | Name of the shared memory area; must start with / and must not be longer than NAME_MAX (255) on POSIX or PATH_MAX on WIN32. If the name is missing a leading '/' or is longer than 255, it will be adjusted accordingly. |
size | of the shared memory area to create; if size is 0, the class tries to attach to an existing area. |
◆ ~SharedMemory()
cluon::SharedMemory::~SharedMemory |
( |
| ) |
|
|
noexcept |
◆ data()
char * cluon::SharedMemory::data |
( |
| ) |
|
|
noexcept |
- Returns
- Pointer to the raw shared memory or nullptr in case of invalid shared memory.
◆ getTimeStamp()
std::pair< bool, cluon::data::TimeStamp > cluon::SharedMemory::getTimeStamp |
( |
| ) |
|
|
noexcept |
This method returns the sample time stamp.
This method is only allowed when the shared memory is locked.
- Returns
- (true, sample time stamp) or (false, 0) in case if the shared memory was not locked.
References retVal.
◆ isLocked()
bool cluon::SharedMemory::isLocked |
( |
| ) |
const |
|
noexcept |
- Returns
- true when this shared memory area is locked.
◆ lock()
void cluon::SharedMemory::lock |
( |
| ) |
|
|
noexcept |
This method locks the shared memory area.
◆ name()
const std::string cluon::SharedMemory::name |
( |
| ) |
const |
|
noexcept |
◆ notifyAll()
void cluon::SharedMemory::notifyAll |
( |
| ) |
|
|
noexcept |
This method notifies all threads waiting on the shared condition.
◆ setTimeStamp()
bool cluon::SharedMemory::setTimeStamp |
( |
const cluon::data::TimeStamp & |
ts | ) |
|
|
noexcept |
This method sets the time stamp that can be used to express the sample time stamp of the data in residing in the shared memory.
This method is only allowed when the shared memory is locked.
- Parameters
-
- Returns
- true if the timestamp could set; false if the shared memory was not locked.
References retVal.
◆ size()
uint32_t cluon::SharedMemory::size |
( |
| ) |
const |
|
noexcept |
- Returns
- The size of the shared memory area.
◆ unlock()
void cluon::SharedMemory::unlock |
( |
| ) |
|
|
noexcept |
This method unlocks the shared memory area.
◆ valid()
bool cluon::SharedMemory::valid |
( |
| ) |
|
|
noexcept |
- Returns
- True if the shared memory area is existing and usable.
◆ wait()
void cluon::SharedMemory::wait |
( |
| ) |
|
|
noexcept |
This method waits for being notified from the shared condition.