Fawkes API  Fawkes Development Version
firevision::ColormapFile Class Reference

Colormap file. More...

#include <>>

Inheritance diagram for firevision::ColormapFile:

Classes

class  ColormapBlockVector
 Vector of colormap blocks. More...
 

Public Member Functions

 ColormapFile ()
 Constructor. More...
 
 ColormapFile (uint16_t depth, uint16_t width, uint16_t height)
 Constructor. More...
 
void add_colormap (Colormap *colormap)
 Add colormap. More...
 
ColormapBlockVectorcolormap_blocks ()
 Get colormap blocks. More...
 
Colormapget_colormap ()
 Get a freshly generated colormap based on current file content. More...
 
uint16_t get_depth ()
 Get depth of colormap. More...
 
uint16_t get_width ()
 Get width of colormap. More...
 
uint16_t get_height ()
 Get height of colormap. More...
 
virtual void clear ()
 Clear internal storage. More...
 
- Public Member Functions inherited from firevision::FireVisionDataFile
 FireVisionDataFile (unsigned short int magic_token, unsigned short int version)
 Constructor. More...
 
virtual ~FireVisionDataFile ()
 Destructor. More...
 
unsigned int magic_token ()
 Get the magic token of the file. More...
 
unsigned int version ()
 Get the version of the file. More...
 
bool is_big_endian ()
 Check if data is encoded as big endian. More...
 
bool is_little_endian ()
 Check if data is encoded as little endian. More...
 
size_t num_blocks ()
 Get the number of available info blocks. More...
 
const char * get_comment () const
 Get comment. More...
 
void set_comment (const char *comment)
 Set comment. More...
 
void set_owns_blocks (bool owns_blocks)
 Lets the file take over the ownership and give up the ownership of the blocks, respectively. More...
 
virtual void add_block (FireVisionDataFileBlock *block)
 Add a block. More...
 
virtual void write (const char *file_name)
 Write file. More...
 
virtual void read (const char *file_name)
 Read file. More...
 
BlockListblocks ()
 Get blocks. More...
 

Static Public Member Functions

static bool is_colormap_file (const char *filename)
 Check if given file is a colormap file. More...
 
static std::string compose_filename (const std::string format)
 Compose filename. More...
 
- Static Public Member Functions inherited from firevision::FireVisionDataFile
static unsigned short int read_magic_token (const char *filename)
 Get magic token from file. More...
 
static bool has_magic_token (const char *filename, unsigned short int magic_token)
 Check if file has a certain magic token. More...
 

Additional Inherited Members

- Public Types inherited from firevision::FireVisionDataFile
typedef std::list< FireVisionDataFileBlock * > BlockList
 List of FireVision data file blocks. More...
 
- Protected Attributes inherited from firevision::FireVisionDataFile
void * _spec_header
 Content specific header. More...
 
size_t _spec_header_size
 Size in bytes of _spec_header. More...
 

Detailed Description

Colormap file.

This class implements a FireVision data file format for colormaps.

Author
Tim Niemueller

Definition at line 55 of file cmfile.h.

Constructor & Destructor Documentation

◆ ColormapFile() [1/2]

firevision::ColormapFile::ColormapFile ( )

Constructor.

Creates a plain empty colormap file.

Definition at line 83 of file cmfile.cpp.

◆ ColormapFile() [2/2]

firevision::ColormapFile::ColormapFile ( uint16_t  depth,
uint16_t  width,
uint16_t  height 
)

Constructor.

Creates a plain empty colormap file with given dimensions.

Parameters
depthdepth of colormap
widthwidth of colormap
heightheight of colormap

Definition at line 69 of file cmfile.cpp.

References firevision::FireVisionDataFile::_spec_header, firevision::FireVisionDataFile::_spec_header_size, firevision::cmfile_header_t::depth, firevision::cmfile_header_t::height, and firevision::cmfile_header_t::width.

Member Function Documentation

◆ add_colormap()

void firevision::ColormapFile::add_colormap ( Colormap colormap)

◆ clear()

void firevision::ColormapFile::clear ( void  )
virtual

Clear internal storage.

All internal data is deleted.

Reimplemented from firevision::FireVisionDataFile.

Definition at line 238 of file cmfile.cpp.

References firevision::FireVisionDataFile::clear().

◆ colormap_blocks()

ColormapFile::ColormapBlockVector * firevision::ColormapFile::colormap_blocks ( )

Get colormap blocks.

Returns
vector of colormap blocks

Definition at line 134 of file cmfile.cpp.

References firevision::FireVisionDataFile::_spec_header, and firevision::FireVisionDataFile::blocks().

◆ compose_filename()

std::string firevision::ColormapFile::compose_filename ( const std::string  format)
static

Compose filename.

In the format g is replaced with the hostname.

Parameters
formatformat for the filename
Returns
filename

Definition at line 220 of file cmfile.cpp.

◆ get_colormap()

Colormap * firevision::ColormapFile::get_colormap ( )

Get a freshly generated colormap based on current file content.

This returns an instance of a colormap that uses all current blocks of this instance. Currently it only supports file which contain a valid YuvColormap. This means that it has d blocks of YUV type. d is the depth and must fulfill d=2^n with n from [1,8]. It can throw any exception that the YuvColormap ctor can throw.

Returns
instance of colormap. You must delete it after you are done with it.

Definition at line 169 of file cmfile.cpp.

References firevision::FireVisionDataFile::blocks(), firevision::YuvColormap::copy_uvplane(), firevision::cmfile_header_t::depth, firevision::cmfile_header_t::height, firevision::YuvColormap::plane_size(), and firevision::cmfile_header_t::width.

Referenced by firevision::ColorModelLookupTable::ColorModelLookupTable(), firevision::ColorModelLookupTable::load(), ColorTrainWidget::load_colormap(), firevision::YuvColormap::operator+=(), FireVisionNetworkTool::set_colormap(), and firevision::FileLoader::set_pixel_height().

◆ get_depth()

uint16_t firevision::ColormapFile::get_depth ( )

Get depth of colormap.

Returns
depth

Definition at line 249 of file cmfile.cpp.

References firevision::cmfile_header_t::depth.

◆ get_height()

uint16_t firevision::ColormapFile::get_height ( )

Get height of colormap.

Returns
height

Definition at line 269 of file cmfile.cpp.

References firevision::cmfile_header_t::height.

◆ get_width()

uint16_t firevision::ColormapFile::get_width ( )

Get width of colormap.

Returns
width

Definition at line 259 of file cmfile.cpp.

References firevision::cmfile_header_t::width.

◆ is_colormap_file()

bool firevision::ColormapFile::is_colormap_file ( const char *  filename)
static

Check if given file is a colormap file.

Parameters
filenamename of file to check
Returns
true if file is a colormap file, false otherwise

Definition at line 208 of file cmfile.cpp.

References firevision::FireVisionDataFile::has_magic_token().


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