Fawkes API  Fawkes Development Version
firevision::SharedMemoryLookupTableHeader Class Reference

#include <>>

Inheritance diagram for firevision::SharedMemoryLookupTableHeader:

Public Member Functions

 SharedMemoryLookupTableHeader ()
 Constructor. More...
 
 SharedMemoryLookupTableHeader (const char *lut_id, unsigned int width, unsigned int height, unsigned int bytes_per_cell)
 Constructor. More...
 
 SharedMemoryLookupTableHeader (const char *lut_id, unsigned int width, unsigned int height, unsigned int depth, unsigned int bytes_per_cell)
 Constructor. More...
 
 SharedMemoryLookupTableHeader (const SharedMemoryLookupTableHeader *h)
 Copy constructor. More...
 
virtual ~SharedMemoryLookupTableHeader ()
 Destructor. More...
 
virtual fawkes::SharedMemoryHeaderclone () const
 
virtual bool matches (void *memptr)
 
virtual size_t size ()
 
virtual bool create ()
 Check if buffer should be created. More...
 
virtual void initialize (void *memptr)
 
virtual void set (void *memptr)
 
virtual void reset ()
 
virtual size_t data_size ()
 
virtual bool operator== (const fawkes::SharedMemoryHeader &s) const
 Check for equality of headers. More...
 
virtual void print_info ()
 Print Info. More...
 
const char * lut_id () const
 Get LUT ID. More...
 
void set_lut_id (const char *lut_id)
 Set LUT ID. More...
 
unsigned int width () const
 Get LUT width. More...
 
unsigned int height () const
 Get LUT height. More...
 
unsigned int depth () const
 Get LUT depth. More...
 
unsigned int bytes_per_cell () const
 Get bytes per cell. More...
 
SharedMemoryLookupTable_header_traw_header ()
 Get raw header. More...
 
- Public Member Functions inherited from fawkes::SharedMemoryHeader
virtual ~SharedMemoryHeader ()
 

Detailed Description

Shared memory lookup table header.

Definition at line 47 of file shm_lut.h.

Constructor & Destructor Documentation

◆ SharedMemoryLookupTableHeader() [1/4]

firevision::SharedMemoryLookupTableHeader::SharedMemoryLookupTableHeader ( )

Constructor.

Definition at line 243 of file shm_lut.cpp.

Referenced by clone().

◆ SharedMemoryLookupTableHeader() [2/4]

firevision::SharedMemoryLookupTableHeader::SharedMemoryLookupTableHeader ( const char *  lut_id,
unsigned int  width,
unsigned int  height,
unsigned int  bytes_per_cell 
)

Constructor.

Parameters
lut_idLUT ID
widthLUT width
heightLUT height
bytes_per_cellbytes per cell

Definition at line 259 of file shm_lut.cpp.

References bytes_per_cell(), height(), lut_id(), and width().

◆ SharedMemoryLookupTableHeader() [3/4]

firevision::SharedMemoryLookupTableHeader::SharedMemoryLookupTableHeader ( const char *  lut_id,
unsigned int  width,
unsigned int  height,
unsigned int  depth,
unsigned int  bytes_per_cell 
)

Constructor.

Parameters
lut_idLUT ID
widthLUT width
heightLUT height
depthLUT depth
bytes_per_cellbytes per cell

Definition at line 279 of file shm_lut.cpp.

References bytes_per_cell(), depth(), height(), lut_id(), and width().

◆ SharedMemoryLookupTableHeader() [4/4]

firevision::SharedMemoryLookupTableHeader::SharedMemoryLookupTableHeader ( const SharedMemoryLookupTableHeader h)

Copy constructor.

Parameters
hheader to copy data from

Definition at line 297 of file shm_lut.cpp.

◆ ~SharedMemoryLookupTableHeader()

firevision::SharedMemoryLookupTableHeader::~SharedMemoryLookupTableHeader ( )
virtual

Destructor.

Definition at line 313 of file shm_lut.cpp.

Member Function Documentation

◆ bytes_per_cell()

unsigned int firevision::SharedMemoryLookupTableHeader::bytes_per_cell ( ) const

◆ clone()

SharedMemoryHeader * firevision::SharedMemoryLookupTableHeader::clone ( ) const
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.

Returns
Clone instance. Remember to delete the instance.

Implements fawkes::SharedMemoryHeader.

Definition at line 323 of file shm_lut.cpp.

References SharedMemoryLookupTableHeader().

◆ create()

bool firevision::SharedMemoryLookupTableHeader::create ( )
virtual

Check if buffer should be created.

Returns
true, if width, height and bytes per cell are all greater than zero.

Definition at line 385 of file shm_lut.cpp.

◆ data_size()

size_t firevision::SharedMemoryLookupTableHeader::data_size ( )
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.

Returns
the size of the data segment

Implements fawkes::SharedMemoryHeader.

Definition at line 335 of file shm_lut.cpp.

References firevision::SharedMemoryLookupTable_header_t::bytes_per_cell, firevision::SharedMemoryLookupTable_header_t::depth, firevision::SharedMemoryLookupTable_header_t::height, and firevision::SharedMemoryLookupTable_header_t::width.

◆ depth()

unsigned int firevision::SharedMemoryLookupTableHeader::depth ( ) const

◆ height()

unsigned int firevision::SharedMemoryLookupTableHeader::height ( ) const

◆ initialize()

void firevision::SharedMemoryLookupTableHeader::initialize ( void *  memptr)
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.

Parameters
memptrthe memptr where the header data shall be written to.

Implements fawkes::SharedMemoryHeader.

Definition at line 391 of file shm_lut.cpp.

References firevision::SharedMemoryLookupTable_header_t::bytes_per_cell, firevision::SharedMemoryLookupTable_header_t::depth, firevision::SharedMemoryLookupTable_header_t::height, firevision::SharedMemoryLookupTable_header_t::lut_id, and firevision::SharedMemoryLookupTable_header_t::width.

◆ lut_id()

const char * firevision::SharedMemoryLookupTableHeader::lut_id ( ) const

◆ matches()

bool firevision::SharedMemoryLookupTableHeader::matches ( void *  memptr)
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.

Parameters
memptrThe memory chunk in the shared memory segment where to start checking.
Returns
true, if the given data in the memory chunk matches this header, false otherwise.

Implements fawkes::SharedMemoryHeader.

Definition at line 345 of file shm_lut.cpp.

References firevision::SharedMemoryLookupTable_header_t::bytes_per_cell, firevision::SharedMemoryLookupTable_header_t::depth, firevision::SharedMemoryLookupTable_header_t::height, firevision::SharedMemoryLookupTable_header_t::lut_id, and firevision::SharedMemoryLookupTable_header_t::width.

◆ operator==()

bool firevision::SharedMemoryLookupTableHeader::operator== ( const fawkes::SharedMemoryHeader s) const
virtual

Check for equality of headers.

First checks if passed SharedMemoryHeader is an instance of SharedMemoryLookupTableHeader. If not returns false, otherwise it compares LUT ID, width, height, depth and bytes per cell. If all match returns true, false if any of them differs.

Parameters
sshared memory header to compare to
Returns
true if the two instances identify the very same shared memory segments, false otherwise

Implements fawkes::SharedMemoryHeader.

Definition at line 425 of file shm_lut.cpp.

◆ print_info()

◆ raw_header()

SharedMemoryLookupTable_header_t * firevision::SharedMemoryLookupTableHeader::raw_header ( )

Get raw header.

Returns
raw header.

Definition at line 507 of file shm_lut.cpp.

◆ reset()

void firevision::SharedMemoryLookupTableHeader::reset ( void  )
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.

Implements fawkes::SharedMemoryHeader.

Definition at line 410 of file shm_lut.cpp.

◆ set()

void firevision::SharedMemoryLookupTableHeader::set ( void *  memptr)
virtual

Set information from memptr. Set the information stored in this SharedMemoryHeader derivate instance from the data stored in the given memptr.

Parameters
memptrThe memptr where to copy data from.

Implements fawkes::SharedMemoryHeader.

Definition at line 404 of file shm_lut.cpp.

◆ set_lut_id()

void firevision::SharedMemoryLookupTableHeader::set_lut_id ( const char *  lut_id)

Set LUT ID.

Parameters
lut_idLUT ID

Definition at line 496 of file shm_lut.cpp.

References lut_id().

Referenced by firevision::SharedMemoryLookupTable::set_lut_id().

◆ size()

size_t firevision::SharedMemoryLookupTableHeader::size ( )
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.

Returns
size of header

Implements fawkes::SharedMemoryHeader.

Definition at line 329 of file shm_lut.cpp.

◆ width()

unsigned int firevision::SharedMemoryLookupTableHeader::width ( ) const

The documentation for this class was generated from the following files: