Fawkes API  Fawkes Development Version
firevision::SharedMemoryLookupTableHeader Class Reference

Shared memory lookup table header. More...

#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
 Clone this shared memory header. More...
 
virtual bool matches (void *memptr)
 Method to check if the given memptr matches this header. More...
 
virtual size_t size ()
 Size of the header. More...
 
virtual bool create ()
 Check if buffer should be created. More...
 
virtual void initialize (void *memptr)
 Initialize the header. More...
 
virtual void set (void *memptr)
 Set information from memptr. More...
 
virtual void reset ()
 Reset information previously set with set(). More...
 
virtual size_t data_size ()
 Return the size of the data. More...
 
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 ()
 Virtual destructor. More...
 

Detailed Description

Shared memory lookup table header.

Definition at line 50 of file shm_lut.h.

Constructor & Destructor Documentation

◆ SharedMemoryLookupTableHeader() [1/4]

firevision::SharedMemoryLookupTableHeader::SharedMemoryLookupTableHeader ( )

Constructor.

Definition at line 261 of file shm_lut.cpp.

◆ 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 278 of file shm_lut.cpp.

References firevision::SharedMemoryLookupTable::bytes_per_cell(), firevision::SharedMemoryLookupTable::height(), and firevision::SharedMemoryLookupTable::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 299 of file shm_lut.cpp.

References firevision::SharedMemoryLookupTable::bytes_per_cell(), firevision::SharedMemoryLookupTable::depth(), firevision::SharedMemoryLookupTable::height(), and firevision::SharedMemoryLookupTable::width().

◆ SharedMemoryLookupTableHeader() [4/4]

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

Copy constructor.

Parameters
hheader to copy data from

Definition at line 318 of file shm_lut.cpp.

◆ ~SharedMemoryLookupTableHeader()

firevision::SharedMemoryLookupTableHeader::~SharedMemoryLookupTableHeader ( )
virtual

Destructor.

Definition at line 335 of file shm_lut.cpp.

References fawkes::SharedMemory::free().

Member Function Documentation

◆ bytes_per_cell()

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

Get bytes per cell.

Returns
bytes per cell.

Definition at line 520 of file shm_lut.cpp.

Referenced by firevision::FuseServerClientThread::process_getlutlist_message().

◆ 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 346 of file shm_lut.cpp.

◆ 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 421 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 360 of file shm_lut.cpp.

◆ depth()

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

Get LUT depth.

Returns
LUT depth.

Definition at line 509 of file shm_lut.cpp.

Referenced by firevision::FuseServerClientThread::process_getlutlist_message().

◆ 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 431 of file shm_lut.cpp.

◆ 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 371 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 468 of file shm_lut.cpp.

◆ print_info()

void firevision::SharedMemoryLookupTableHeader::print_info ( )
virtual

Print Info.

Definition at line 402 of file shm_lut.cpp.

◆ raw_header()

SharedMemoryLookupTable_header_t * firevision::SharedMemoryLookupTableHeader::raw_header ( )

Get raw header.

Returns
raw header.

Definition at line 553 of file shm_lut.cpp.

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

◆ 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 452 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 445 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 542 of file shm_lut.cpp.

References fawkes::SharedMemory::free().

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 353 of file shm_lut.cpp.

◆ width()

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

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