Fawkes API
Fawkes Development Version
|
FireVision File Format for data files. More...
#include <>>
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... | |
BlockList & | blocks () |
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... | |
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:
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:
Each of the data blocks itself is of the following form:
typedef std::list<FireVisionDataFileBlock *> firevision::FireVisionDataFile::BlockList |
firevision::FireVisionDataFile::FireVisionDataFile | ( | unsigned short int | magic_token, |
unsigned short int | version | ||
) |
Constructor.
magic_token | magic token for the concrete file type |
version | file format version |
Definition at line 95 of file fvfile.cpp.
|
virtual |
Destructor.
Definition at line 114 of file fvfile.cpp.
|
virtual |
Add a block.
block | block to add |
Definition at line 242 of file fvfile.cpp.
Referenced by firevision::ColormapFile::add_colormap(), firevision::HistogramFile::add_histogram_block(), and firevision::RectificationInfoFile::add_rectinfo_block().
FireVisionDataFile::BlockList & firevision::FireVisionDataFile::blocks | ( | ) |
Get blocks.
Definition at line 252 of file fvfile.cpp.
Referenced by firevision::ColormapFile::add_colormap(), firevision::ColormapFile::colormap_blocks(), firevision::ColormapFile::get_colormap(), firevision::HistogramFile::histogram_blocks(), firevision::Histogram::load(), and firevision::RectificationInfoFile::rectinfo_blocks().
|
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().
const char * firevision::FireVisionDataFile::get_comment | ( | ) | const |
|
static |
Check if file has a certain magic token.
filename | name of file to read the magic token from |
magic_token | magic token to look for |
Definition at line 446 of file fvfile.cpp.
Referenced by firevision::ColormapFile::is_colormap_file().
bool firevision::FireVisionDataFile::is_big_endian | ( | ) |
Check if data is encoded as big endian.
Definition at line 178 of file fvfile.cpp.
bool firevision::FireVisionDataFile::is_little_endian | ( | ) |
Check if data is encoded as little endian.
Definition at line 188 of file fvfile.cpp.
unsigned int firevision::FireVisionDataFile::magic_token | ( | ) |
size_t firevision::FireVisionDataFile::num_blocks | ( | ) |
Get the number of available info blocks.
Definition at line 232 of file fvfile.cpp.
Referenced by firevision::Histogram::load(), and firevision::TriclopsStereoProcessor::verify_rectification_lut().
|
virtual |
Read file.
file_name | file to read from |
Reimplemented in firevision::RectificationInfoFile.
Definition at line 308 of file fvfile.cpp.
References firevision::FireVisionDataFileBlock::data_ptr(), firevision::_fvff_block_header_t::size, firevision::_fvff_block_header_t::spec_head_size, and firevision::_fvff_block_header_t::type.
Referenced by firevision::ColorModelLookupTable::ColorModelLookupTable(), firevision::ColorModelLookupTable::load(), firevision::Histogram::load(), ColorTrainWidget::load_colormap(), firevision::BayesColormapGenerator::load_histograms(), firevision::YuvColormap::operator+=(), firevision::RectificationInfoFile::read(), FireVisionNetworkTool::set_colormap(), and firevision::FileLoader::set_pixel_height().
|
static |
Get magic token from file.
filename | name of file to read the magic token from |
Definition at line 419 of file fvfile.cpp.
void firevision::FireVisionDataFile::set_comment | ( | const char * | comment | ) |
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.
owns_blocks | if 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().
unsigned int firevision::FireVisionDataFile::version | ( | ) |
Get the version of the file.
Definition at line 168 of file fvfile.cpp.
|
virtual |
Write file.
file_name | file to write to |
Definition at line 262 of file fvfile.cpp.
Referenced by FireVisionNetworkTool::fuse_inbound_received(), firevision::TriclopsStereoProcessor::generate_rectification_lut(), firevision::Histogram::save(), firevision::BayesHistosToLut::save(), firevision::BayesColormapGenerator::save_histograms(), and firevision::BayesHistosToLut::saveLut().
|
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().
|
protected |
Size in bytes of _spec_header.
Definition at line 69 of file fvfile.h.
Referenced by firevision::ColormapFile::add_colormap(), firevision::ColormapFile::ColormapFile(), and firevision::RectificationInfoFile::RectificationInfoFile().