firevision::SharedMemoryLookupTableHeader Class Reference

Shared memory lookup table header. More...

#include <fvutils/ipc/shm_lut.h>

Inheritance diagram for firevision::SharedMemoryLookupTableHeader:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 SharedMemoryLookupTableHeader ()
 Constructor.
 SharedMemoryLookupTableHeader (const char *lut_id, unsigned int width, unsigned int height, unsigned int bytes_per_cell)
 Constructor.
 SharedMemoryLookupTableHeader (const char *lut_id, unsigned int width, unsigned int height, unsigned int depth, unsigned int bytes_per_cell)
 Constructor.
 SharedMemoryLookupTableHeader (const SharedMemoryLookupTableHeader *h)
 Copy constructor.
virtual ~SharedMemoryLookupTableHeader ()
 Destructor.
virtual
fawkes::SharedMemoryHeader
clone () const
 Clone this shared memory header.
virtual bool matches (void *memptr)
 Method to check if the given memptr matches this header.
virtual size_t size ()
 Size of the header.
virtual bool create ()
 Check if buffer should be created.
virtual void initialize (void *memptr)
 Initialize the header.
virtual void set (void *memptr)
 Set information from memptr.
virtual void reset ()
 Reset information previously set with set().
virtual size_t data_size ()
 Return the size of the data.
virtual bool operator== (const fawkes::SharedMemoryHeader &s) const
 Check for equality of headers.
virtual void print_info ()
 Print Info.
const char * lut_id () const
 Get LUT ID.
void set_lut_id (const char *lut_id)
 Set LUT ID.
unsigned int width () const
 Get LUT width.
unsigned int height () const
 Get LUT height.
unsigned int depth () const
 Get LUT depth.
unsigned int bytes_per_cell () const
 Get bytes per cell.
SharedMemoryLookupTable_header_traw_header ()
 Get raw header.

Detailed Description

Shared memory lookup table header.

Definition at line 50 of file shm_lut.h.


Constructor & Destructor Documentation

firevision::SharedMemoryLookupTableHeader::SharedMemoryLookupTableHeader (  ) 

Constructor.

Definition at line 261 of file shm_lut.cpp.

Referenced by clone().

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

Constructor.

Parameters:
lut_id LUT ID
width LUT width
height LUT height
bytes_per_cell bytes per cell

Definition at line 278 of file shm_lut.cpp.

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

Constructor.

Parameters:
lut_id LUT ID
width LUT width
height LUT height
depth LUT depth
bytes_per_cell bytes per cell

Definition at line 299 of file shm_lut.cpp.

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

Copy constructor.

Parameters:
h header to copy data from

Definition at line 318 of file shm_lut.cpp.

firevision::SharedMemoryLookupTableHeader::~SharedMemoryLookupTableHeader (  )  [virtual]

Destructor.

Definition at line 335 of file shm_lut.cpp.


Member Function Documentation

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.

References firevision::SharedMemoryLookupTable_header_t::bytes_per_cell.

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

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.

References SharedMemoryLookupTableHeader().

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.

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.

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

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

Get LUT depth.

Returns:
LUT depth.

Definition at line 509 of file shm_lut.cpp.

References firevision::SharedMemoryLookupTable_header_t::depth.

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

unsigned int firevision::SharedMemoryLookupTableHeader::height (  )  const
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:
memptr the memptr where the header data shall be written to.

Implements fawkes::SharedMemoryHeader.

Definition at line 431 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.

const char * firevision::SharedMemoryLookupTableHeader::lut_id (  )  const
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:
memptr The 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.

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:
s shared memory header to compare to
Returns:
true if the two instances identify the very same shared memory segments, false otherwise

Definition at line 468 of file shm_lut.cpp.

void firevision::SharedMemoryLookupTableHeader::print_info (  )  [virtual]
SharedMemoryLookupTable_header_t * firevision::SharedMemoryLookupTableHeader::raw_header (  ) 

Get raw header.

Returns:
raw header.

Definition at line 553 of file shm_lut.cpp.

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

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:
memptr The memptr where to copy data from.

Implements fawkes::SharedMemoryHeader.

Definition at line 445 of file shm_lut.cpp.

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

Set LUT ID.

Parameters:
lut_id LUT ID

Definition at line 542 of file shm_lut.cpp.

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

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.

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

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

Generated on 1 Mar 2011 for Fawkes API by  doxygen 1.6.1