firevision::SharedMemoryImageBufferHeader Class Reference

Shared memory image buffer header. More...

#include <fvutils/ipc/shm_image.h>

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

List of all members.

Public Member Functions

 SharedMemoryImageBufferHeader ()
 Constructor.
 SharedMemoryImageBufferHeader (const char *image_id, colorspace_t colorspace, unsigned int width, unsigned int height)
 Constructor.
 SharedMemoryImageBufferHeader (const SharedMemoryImageBufferHeader *h)
 Copy constructor.
virtual ~SharedMemoryImageBufferHeader ()
 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 void print_info ()
 Print some info.
virtual bool create ()
 Create if colorspace, width and height have been supplied.
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.
void set_image_id (const char *image_id)
 Set image id.
colorspace_t colorspace () const
 Get colorspace.
unsigned int width () const
 Get width.
unsigned int height () const
 Get height.
const char * image_id () const
 Get image number.
SharedMemoryImageBuffer_header_traw_header ()
 Get raw header.

Detailed Description

Shared memory image buffer header.

Definition at line 67 of file shm_image.h.


Constructor & Destructor Documentation

firevision::SharedMemoryImageBufferHeader::SharedMemoryImageBufferHeader (  ) 

Constructor.

Definition at line 536 of file shm_image.cpp.

Referenced by clone().

firevision::SharedMemoryImageBufferHeader::SharedMemoryImageBufferHeader ( const char *  image_id,
colorspace_t  colorspace,
unsigned int  width,
unsigned int  height 
)

Constructor.

Parameters:
image_id image id
colorspace colorspace
width width
height height

Definition at line 553 of file shm_image.cpp.

firevision::SharedMemoryImageBufferHeader::SharedMemoryImageBufferHeader ( const SharedMemoryImageBufferHeader h  ) 

Copy constructor.

Parameters:
h shared memory image header to copy

Definition at line 574 of file shm_image.cpp.

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

Destructor.

Definition at line 594 of file shm_image.cpp.


Member Function Documentation

SharedMemoryHeader * firevision::SharedMemoryImageBufferHeader::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 609 of file shm_image.cpp.

References SharedMemoryImageBufferHeader().

colorspace_t firevision::SharedMemoryImageBufferHeader::colorspace (  )  const
bool firevision::SharedMemoryImageBufferHeader::create (  )  [virtual]

Create if colorspace, width and height have been supplied.

Returns:
true if colorspace has been set, width and height are greater than zero.

Definition at line 702 of file shm_image.cpp.

size_t firevision::SharedMemoryImageBufferHeader::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 616 of file shm_image.cpp.

References firevision::SharedMemoryImageBuffer_header_t::colorspace, firevision::SharedMemoryImageBuffer_header_t::height, and firevision::SharedMemoryImageBuffer_header_t::width.

unsigned int firevision::SharedMemoryImageBufferHeader::height (  )  const
const char * firevision::SharedMemoryImageBufferHeader::image_id (  )  const

Get image number.

Returns:
image number

Definition at line 802 of file shm_image.cpp.

Referenced by firevision::SharedMemoryImageBufferLister::print_info(), and firevision::FuseServerClientThread::process_getimagelist_message().

void firevision::SharedMemoryImageBufferHeader::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 711 of file shm_image.cpp.

References firevision::SharedMemoryImageBuffer_header_t::colorspace, firevision::SharedMemoryImageBuffer_header_t::height, firevision::SharedMemoryImageBuffer_header_t::image_id, and firevision::SharedMemoryImageBuffer_header_t::width.

bool firevision::SharedMemoryImageBufferHeader::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 627 of file shm_image.cpp.

References firevision::SharedMemoryImageBuffer_header_t::colorspace, firevision::SharedMemoryImageBuffer_header_t::height, firevision::SharedMemoryImageBuffer_header_t::image_id, and firevision::SharedMemoryImageBuffer_header_t::width.

bool firevision::SharedMemoryImageBufferHeader::operator== ( const fawkes::SharedMemoryHeader s  )  const [virtual]

Check for equality of headers.

First checks if passed SharedMemoryHeader is an instance of SharedMemoryImageBufferHeader. If not returns false, otherwise it compares image ID, colorspace, width, and height. 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 661 of file shm_image.cpp.

void firevision::SharedMemoryImageBufferHeader::print_info (  )  [virtual]

Print some info.

Definition at line 676 of file shm_image.cpp.

SharedMemoryImageBuffer_header_t * firevision::SharedMemoryImageBufferHeader::raw_header (  ) 

Get raw header.

Returns:
raw header.

Definition at line 823 of file shm_image.cpp.

Referenced by firevision::SharedMemoryImageBuffer::set_image_id().

void firevision::SharedMemoryImageBufferHeader::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 749 of file shm_image.cpp.

void firevision::SharedMemoryImageBufferHeader::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 726 of file shm_image.cpp.

References firevision::SharedMemoryImageBuffer_header_t::colorspace, firevision::SharedMemoryImageBuffer_header_t::height, firevision::SharedMemoryImageBuffer_header_t::image_id, and firevision::SharedMemoryImageBuffer_header_t::width.

void firevision::SharedMemoryImageBufferHeader::set_image_id ( const char *  image_id  ) 

Set image id.

Parameters:
image_id image ID

Definition at line 812 of file shm_image.cpp.

Referenced by firevision::SharedMemoryImageBuffer::set_image_id().

size_t firevision::SharedMemoryImageBufferHeader::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 602 of file shm_image.cpp.

unsigned int firevision::SharedMemoryImageBufferHeader::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