Fawkes API
Fawkes Development Version
|
Interface for shared memory header. More...
#include <>>
Public Member Functions | |
virtual | ~SharedMemoryHeader () |
Virtual destructor. More... | |
virtual bool | matches (void *memptr)=0 |
Method to check if the given memptr matches this header. More... | |
virtual size_t | size ()=0 |
Size of the header. More... | |
virtual void | initialize (void *memptr)=0 |
Initialize the header. More... | |
virtual void | set (void *memptr)=0 |
Set information from memptr. More... | |
virtual void | reset ()=0 |
Reset information previously set with set(). More... | |
virtual size_t | data_size ()=0 |
Return the size of the data. More... | |
virtual SharedMemoryHeader * | clone () const =0 |
Clone this shared memory header. More... | |
virtual bool | operator== (const SharedMemoryHeader &s) const =0 |
Check for equality of headers. More... | |
Interface for shared memory header.
This class has to be implemented to be able to use shared memory segments. It defines a set of properties for the shared memory segment that can be searched for and printed out by an appropriate lister.
|
inlinevirtual |
Virtual destructor.
Definition at line 35 of file shm.h.
References clone(), data_size(), initialize(), matches(), operator==(), reset(), and size().
|
pure virtual |
Clone this shared memory header.
This method shall return a copied instance of this SharedMemoryHeader derivate. It should act the same way as the current instance.
Implemented in firevision::SharedMemoryImageBufferHeader, firevision::SharedMemoryLookupTableHeader, and fawkes::BlackBoardSharedMemoryHeader.
Referenced by fawkes::SharedMemory::SharedMemoryIterator::operator=(), fawkes::SharedMemory::SharedMemory(), fawkes::SharedMemory::SharedMemoryIterator::SharedMemoryIterator(), and ~SharedMemoryHeader().
|
pure virtual |
Return the size of the data.
The size of the data that will be stored in the shared memory segment. This method has to return the same value everytime and may only depend on the other data set in the header and written to the shared memory segment.
Implemented in firevision::SharedMemoryImageBufferHeader, firevision::SharedMemoryLookupTableHeader, and fawkes::BlackBoardSharedMemoryHeader.
Referenced by fawkes::SharedMemory::attach(), and ~SharedMemoryHeader().
|
pure virtual |
Initialize the header.
This should initialize the header data in the given memptr from the data of this SharedMemoryHeader derivate instance. It has to write out all state information that is needed to identify the shared memory segment later on.
memptr | the memptr where the header data shall be written to. |
Implemented in firevision::SharedMemoryImageBufferHeader, firevision::SharedMemoryLookupTableHeader, and fawkes::BlackBoardSharedMemoryHeader.
Referenced by fawkes::SharedMemory::attach(), and ~SharedMemoryHeader().
|
pure virtual |
Method to check if the given memptr matches this header.
This method is called when searching for a shared memory segment to open, list or erase it. Implement this to distuinguish several shared memory segments that share the same magic token.
memptr | The memory chunk in the shared memory segment where to start checking. |
Implemented in firevision::SharedMemoryImageBufferHeader, firevision::SharedMemoryLookupTableHeader, and fawkes::BlackBoardSharedMemoryHeader.
Referenced by fawkes::SharedMemory::attach(), and ~SharedMemoryHeader().
|
pure virtual |
Check for equality of headers.
This shall be implemented that it compares the current and the given instances for equality. You probably want to use dynamic_cast to cast the given instance to a compatible type.
s | shared memory header to compare to |
Implemented in firevision::SharedMemoryImageBufferHeader, firevision::SharedMemoryLookupTableHeader, and fawkes::BlackBoardSharedMemoryHeader.
Referenced by ~SharedMemoryHeader().
|
pure virtual |
Reset information previously set with set().
This shall restore the state the header had before set() was called. This is used for instance in the SharedMemoryLister after info about one segment has been printed.
Implemented in firevision::SharedMemoryImageBufferHeader, firevision::SharedMemoryLookupTableHeader, and fawkes::BlackBoardSharedMemoryHeader.
Referenced by ~SharedMemoryHeader().
|
pure virtual |
Set information from memptr.
Set the information stored in this SharedMemoryHeader derivate instance from the data stored in the given memptr.
memptr | The memptr where to copy data from. |
Implemented in firevision::SharedMemoryImageBufferHeader, firevision::SharedMemoryLookupTableHeader, and fawkes::BlackBoardSharedMemoryHeader.
Referenced by fawkes::SharedMemory::attach().
|
pure virtual |
Size of the header.
The size that is needed in the shared memory memptr to accomodate the header data. This size has to fit all the data that will be stored in the header. It must return the same size every time.
Implemented in firevision::SharedMemoryImageBufferHeader, firevision::SharedMemoryLookupTableHeader, and fawkes::BlackBoardSharedMemoryHeader.
Referenced by fawkes::SharedMemory::attach(), and ~SharedMemoryHeader().