MLIB
|
Shared memory area with support for single-writer multiple-readers. More...
#include <shmem.h>
Public Member Functions | |
shmem () | |
Default constructor. | |
shmem (const char *name) | |
Creates and opens a shared memory area with the given name. | |
bool | open (const char *name, size_t sz=sizeof(S)) |
Opens a shared memory area. | |
void | operator>> (S &data) |
Read the content of shared memory area. | |
void | operator<< (const S &data) |
Update (write) the content of a shared memory area. | |
Public Member Functions inherited from mlib::shmem_base | |
shmem_base () | |
Default constructor. | |
shmem_base (const std::string &name, size_t size) | |
Create and open a SMA. | |
virtual | ~shmem_base () |
Destructor. | |
virtual bool | open (const std::string &name, size_t size) |
Open a SMA. | |
virtual bool | close () |
Close a SMA. | |
bool | created () const |
bool | is_opened () const |
size_t | size () const |
const std::string & | name () const |
void | wtmo (DWORD msec) |
DWORD | wtmo () const |
void | rtmo (DWORD msec) |
DWORD | rtmo () const |
virtual bool | write (const void *data) |
Obtain writer lock and update SMA. | |
virtual bool | read (void *data) |
Obtain a reader lock and retrieve SMA content. | |
Protected Member Functions | |
S * | dataptr () const |
Protected Member Functions inherited from mlib::shmem_base | |
bool | rdlock () |
Obtain a reader lock on SMA. | |
void | rdunlock () |
Release a previously obtained reader lock. | |
bool | wrlock () |
Obtain a writer lock on SMA. | |
void | wrunlock () |
Release a previously obtained writer lock. | |
virtual void | get (void *data) |
Retrieve current content of SMA. | |
virtual void | put (const void *data) |
Write new data into the SMA. | |
void * | dataptr () const |
Friends | |
template<class S, class B> | |
class | lockr |
template<class S, class B> | |
class | lockw |
Shared memory area with support for single-writer multiple-readers.