![]() |
Flair
Framework Libre Air
|
Class defining a shared memory. More...
#include <SharedMem.h>
Inheritance diagram for flair::core::SharedMem:Public Types | |
| enum | Type { mutex, producerConsumer } |
Public Types inherited from flair::core::Object | |
| enum | color_t { Auto = 0, Red = 31, Green = 32, Orange = 33 } |
Public Member Functions | |
| SharedMem (const Object *parent, std::string name, size_t size, Type type=Type::mutex) | |
| Constructor. More... | |
| ~SharedMem () | |
| Destructor. More... | |
| void | Write (const char *buf, size_t size) |
| Write. More... | |
| bool | Read (char *buf, size_t size, Time nsTimeout=TIME_INFINITE) const |
| Read. More... | |
| void | ReaderReady () |
| This function should be called when reader is ready (in case of a SharedMem of type producerConsumer) More... | |
Public Member Functions inherited from flair::core::Object | |
| Object (const Object *parent=NULL, std::string name="", std::string type="") | |
| Constructor. More... | |
| virtual | ~Object () |
| Destructor. More... | |
| std::string | ObjectName (void) const |
| Name. More... | |
| std::string | ObjectType (void) const |
| Type. More... | |
| const Object * | Parent (void) const |
| Parent. More... | |
| std::vector< const Object * > * | TypeChilds (void) const |
| Childs of the same type. More... | |
| std::vector< const Object * > * | Childs (void) const |
| Childs. More... | |
| void | Information (const char *function, int line, const char *format,...) const |
| Formatted information. More... | |
| void | Warning (const char *function, const char *format,...) const |
| Formatted warning. More... | |
| void | Error (const char *function, const char *format,...) const |
| Formatted error. More... | |
| bool | ErrorOccured (bool recursive=true) const |
| Has an errror occured? More... | |
Class defining a shared memory.
Shared memory is identified by its name so it can be accessed by another process using its name.
| flair::core::SharedMem::SharedMem | ( | const Object * | parent, |
| std::string | name, | ||
| size_t | size, | ||
| Type | type = Type::mutex |
||
| ) |
Constructor.
Construct a shared memory object
| parent | parent |
| name | name |
| size | size of the shared memory:w |
| type | mutex or producerConsumer. Mutex type is for symmetrical use (default) |
| flair::core::SharedMem::~SharedMem | ( | ) |
Destructor.
| void flair::core::SharedMem::Write | ( | const char * | buf, |
| size_t | size | ||
| ) |
Write.
| buf | input buffer to write to memory |
| size | buffer size |
| bool flair::core::SharedMem::Read | ( | char * | buf, |
| size_t | size, | ||
| Time | nsTimeout = TIME_INFINITE |
||
| ) | const |
Read.
| buf | output buffer to write from memory |
| size | buffer size |
| void flair::core::SharedMem::ReaderReady | ( | ) |
This function should be called when reader is ready (in case of a SharedMem of type producerConsumer)