Fawkes API  Fawkes Development Version
firevision::FireVisionDataFile Class Reference

FireVision File Format for data files. More...

#include <>>

Inheritance diagram for firevision::FireVisionDataFile:

Public Types

typedef std::list< FireVisionDataFileBlock * > BlockList
 List of FireVision data file blocks. More...
 

Public Member Functions

 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 clear ()
 Clear internal storage. 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 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...
 

Protected Attributes

void * _spec_header
 Content specific header. More...
 
size_t _spec_header_size
 Size in bytes of _spec_header. More...
 

Detailed Description

FireVision File Format for data files.

The FireVision File Format (FVFF) defines a generic file layout that is used to store large chunks of data on the the disk drive in a byte efficient way.

It is meant to serve as a skeleton which is used by subclasses to implement support for a concrete file format like colormaps or rectification information. It allows for arbitrary meta data to be added that is relevant to the format and it provides all the generic meta data that is needed to make the file format work and that is common to all formats.

Each format has a two byte magic token. In general it is of the form FFNN, where FF stays literally (FireVision File) and NN is replaced with a number of the format. Currently assigned format numbers include:

  • FF01: colormaps
  • FF02: generic lookup tables
  • FF03: rectification information
  • FF04: histograms

We assume large chunks of data that is saved most efficiently in a proprietary binary format that can be read and written quickly and mimics the layout of the file in the memory.

The general layout is:

1. General header (file type, version, endianess, number of blocks, etc.)
2. Content type specific header (optional)
3. Data blocks

Each of the data blocks itself is of the following form:

1. General block header (type, size)
2. Content type specific block header (optional)
3. Data chunk (raw byte stream, content-specific)
Author
Tim Niemueller

Definition at line 37 of file fvfile.h.

Member Typedef Documentation

◆ BlockList

List of FireVision data file blocks.

Definition at line 64 of file fvfile.h.

Constructor & Destructor Documentation

◆ FireVisionDataFile()

firevision::FireVisionDataFile::FireVisionDataFile ( unsigned short int  magic_token,
unsigned short int  version 
)

Constructor.

Parameters
magic_tokenmagic token for the concrete file type
versionfile format version

Definition at line 95 of file fvfile.cpp.

◆ ~FireVisionDataFile()

firevision::FireVisionDataFile::~FireVisionDataFile ( )
virtual

Destructor.

Definition at line 114 of file fvfile.cpp.

Member Function Documentation

◆ add_block()

void firevision::FireVisionDataFile::add_block ( FireVisionDataFileBlock block)
virtual

◆ blocks()

◆ clear()

void firevision::FireVisionDataFile::clear ( void  )
virtual

Clear internal storage.

All internal data is deleted.

Reimplemented in firevision::ColormapFile.

Definition at line 130 of file fvfile.cpp.

Referenced by firevision::ColormapFile::clear().

◆ get_comment()

const char * firevision::FireVisionDataFile::get_comment ( ) const

Get comment.

Returns
comment of the file

Definition at line 198 of file fvfile.cpp.

◆ has_magic_token()

bool firevision::FireVisionDataFile::has_magic_token ( const char *  filename,
unsigned short int  magic_token 
)
static

Check if file has a certain magic token.

Parameters
filenamename of file to read the magic token from
magic_tokenmagic token to look for
Returns
true if magic token was found, false otherwise

Definition at line 446 of file fvfile.cpp.

Referenced by firevision::ColormapFile::is_colormap_file().

◆ is_big_endian()

bool firevision::FireVisionDataFile::is_big_endian ( )

Check if data is encoded as big endian.

Returns
true if data is encoded as big endian, false otherwise

Definition at line 178 of file fvfile.cpp.

◆ is_little_endian()

bool firevision::FireVisionDataFile::is_little_endian ( )

Check if data is encoded as little endian.

Returns
true if data is encoded as little endian, false otherwise

Definition at line 188 of file fvfile.cpp.

◆ magic_token()

unsigned int firevision::FireVisionDataFile::magic_token ( )

Get the magic token of the file.

Returns
Magic token

Definition at line 158 of file fvfile.cpp.

◆ num_blocks()

size_t firevision::FireVisionDataFile::num_blocks ( )

Get the number of available info blocks.

Returns
number of available info blocks

Definition at line 232 of file fvfile.cpp.

Referenced by firevision::Histogram::load(), and firevision::TriclopsStereoProcessor::verify_rectification_lut().

◆ read()

◆ read_magic_token()

unsigned short int firevision::FireVisionDataFile::read_magic_token ( const char *  filename)
static

Get magic token from file.

Parameters
filenamename of file to read the magic token from
Returns
magic token

Definition at line 419 of file fvfile.cpp.

◆ set_comment()

void firevision::FireVisionDataFile::set_comment ( const char *  comment)

Set comment.

Parameters
commentnew comment to set

Definition at line 208 of file fvfile.cpp.

◆ set_owns_blocks()

void firevision::FireVisionDataFile::set_owns_blocks ( bool  owns_blocks)

Lets the file take over the ownership and give up the ownership of the blocks, respectively.

By default, the file is the owner of the blocks. If a file owns the blocks they will be deleted in the files destructor.

Parameters
owns_blocksif true file owns the blocks

Definition at line 222 of file fvfile.cpp.

Referenced by firevision::BayesColormapGenerator::load_histograms(), firevision::Histogram::save(), and firevision::BayesColormapGenerator::save_histograms().

◆ version()

unsigned int firevision::FireVisionDataFile::version ( )

Get the version of the file.

Returns
version of the file (or the current supported version if no file was loaded)

Definition at line 168 of file fvfile.cpp.

◆ write()

void firevision::FireVisionDataFile::write ( const char *  file_name)
virtual

Member Data Documentation

◆ _spec_header

void * firevision::FireVisionDataFile::_spec_header
protected

Content specific header.

Create this buffer and set the size in _spec_header_size to get it written to the file.

Definition at line 68 of file fvfile.h.

Referenced by firevision::ColormapFile::add_colormap(), firevision::ColormapFile::colormap_blocks(), firevision::ColormapFile::ColormapFile(), firevision::RectificationInfoFile::read(), and firevision::RectificationInfoFile::RectificationInfoFile().

◆ _spec_header_size

size_t firevision::FireVisionDataFile::_spec_header_size
protected

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