FireVisionDataFile Class Reference
FireVision File Format for data files. More...
#include <fvutils/fileformat/fvff.h>

Public Types | |
| typedef std::list < FireVisionDataFileBlock * > | BlockList |
| List of FireVision data file blocks. | |
Public Member Functions | |
| FireVisionDataFile (unsigned short int magic_token, unsigned short int version) | |
| Constructor. | |
| virtual | ~FireVisionDataFile () |
| Destructor. | |
| unsigned int | magic_token () |
| Get the magic token of the file. | |
| unsigned int | version () |
| Get the version of the file. | |
| bool | is_big_endian () |
| Check if data is encoded as big endian. | |
| bool | is_little_endian () |
| Check if data is encoded as little endian. | |
| size_t | num_blocks () |
| Get the number of available info blocks. | |
| const char * | get_comment () const |
| Get comment. | |
| void | set_comment (const char *comment) |
| Set comment. | |
| void | set_owns_blocks (bool owns_blocks) |
| Lets the file take over the ownership and give up the ownership of the blocks, respectively. | |
| virtual void | add_block (FireVisionDataFileBlock *block) |
| Add a block. | |
| virtual void | clear () |
| Clear internal storage. | |
| virtual void | write (const char *file_name) |
| Write file. | |
| virtual void | read (const char *file_name) |
| Read file. | |
| BlockList & | blocks () |
| Get blocks. | |
Static Public Member Functions | |
| static unsigned short int | read_magic_token (const char *filename) |
| Get magic token from file. | |
| static bool | has_magic_token (const char *filename, unsigned short int magic_token) |
| Check if file has a certain magic token. | |
Protected Attributes | |
| void * | _spec_header |
| Content specific header. | |
| size_t | _spec_header_size |
| Size in bytes of _spec_header. | |
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
1. General block header (type, size) 2. Content type specific block header (optional) 3. Data chunk (raw byte stream, content-specific)
Definition at line 32 of file fvfile.h.
Member Typedef Documentation
| typedef std::list<FireVisionDataFileBlock *> FireVisionDataFile::BlockList |
Constructor & Destructor Documentation
| FireVisionDataFile::FireVisionDataFile | ( | unsigned short int | magic_token, | |
| unsigned short int | version | |||
| ) |
Constructor.
- Parameters:
-
magic_token magic token for the concrete file type version file format version
Definition at line 92 of file fvfile.cpp.
References _spec_header, _spec_header_size, and clear().
| FireVisionDataFile::~FireVisionDataFile | ( | ) | [virtual] |
Member Function Documentation
| void FireVisionDataFile::add_block | ( | FireVisionDataFileBlock * | block | ) | [virtual] |
Add a block.
- Parameters:
-
block block to add
Definition at line 239 of file fvfile.cpp.
Referenced by ColormapFile::add_colormap(), HistogramFile::add_histogram_block(), and RectificationInfoFile::add_rectinfo_block().
| FireVisionDataFile::BlockList & FireVisionDataFile::blocks | ( | ) |
Get blocks.
- Returns:
- block list
Definition at line 249 of file fvfile.cpp.
Referenced by ColormapFile::add_colormap(), ColormapFile::colormap_blocks(), ColormapFile::get_colormap(), HistogramFile::histogram_blocks(), Histogram::load(), and RectificationInfoFile::rectinfo_blocks().
| void FireVisionDataFile::clear | ( | ) | [virtual] |
Clear internal storage.
All internal data is deleted.
Reimplemented in ColormapFile.
Definition at line 127 of file fvfile.cpp.
References _fvff_header_t::endianess, _fvff_header_t::magic_token, _fvff_header_t::num_blocks, and _fvff_header_t::version.
Referenced by FireVisionDataFile(), read(), and ~FireVisionDataFile().
| const char * FireVisionDataFile::get_comment | ( | ) | const |
| bool FireVisionDataFile::has_magic_token | ( | const char * | filename, | |
| unsigned short int | magic_token | |||
| ) | [static] |
Check if file has a certain magic token.
- Parameters:
-
filename name of file to read the magic token from magic_token magic token to look for
- Returns:
- true if magic token was found, false otherwise
Definition at line 440 of file fvfile.cpp.
References read_magic_token().
Referenced by ColormapFile::is_colormap_file().
| bool 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 175 of file fvfile.cpp.
References _fvff_header_t::endianess.
| bool 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 185 of file fvfile.cpp.
References _fvff_header_t::endianess.
| unsigned int FireVisionDataFile::magic_token | ( | ) |
Get the magic token of the file.
- Returns:
- Magic token
Definition at line 155 of file fvfile.cpp.
References _fvff_header_t::magic_token.
Referenced by read_magic_token().
| size_t FireVisionDataFile::num_blocks | ( | ) |
Get the number of available info blocks.
- Returns:
- number of available info blocks
Definition at line 229 of file fvfile.cpp.
Referenced by Histogram::load(), and TriclopsStereoProcessor::verify_rectification_lut().
| void FireVisionDataFile::read | ( | const char * | file_name | ) | [virtual] |
Read file.
- Parameters:
-
file_name file to read from
Reimplemented in RectificationInfoFile.
Definition at line 305 of file fvfile.cpp.
References _spec_header, clear(), _fvff_header_t::comment, FireVisionDataFileBlock::data_ptr(), _fvff_header_t::endianess, _fvff_header_t::magic_token, _fvff_header_t::num_blocks, _fvff_block_header_t::size, _fvff_block_header_t::spec_head_size, _fvff_header_t::spec_head_size, _fvff_block_header_t::type, and _fvff_header_t::version.
Referenced by ColorModelLookupTable::ColorModelLookupTable(), ColorModelLookupTable::load(), Histogram::load(), ColorTrainWidget::load_colormap(), BayesColormapGenerator::load_histograms(), YuvColormap::operator+=(), and FireVisionNetworkTool::set_colormap().
| unsigned short int FireVisionDataFile::read_magic_token | ( | const char * | filename | ) | [static] |
Get magic token from file.
- Parameters:
-
filename name of file to read the magic token from
- Returns:
- magic token
Definition at line 416 of file fvfile.cpp.
References magic_token().
Referenced by has_magic_token().
| void FireVisionDataFile::set_comment | ( | const char * | comment | ) |
Set comment.
- Parameters:
-
comment new comment to set
Definition at line 205 of file fvfile.cpp.
References _fvff_header_t::comment.
| void 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_blocks if true file owns the blocks
Definition at line 219 of file fvfile.cpp.
Referenced by BayesColormapGenerator::load_histograms(), Histogram::save(), and BayesColormapGenerator::save_histograms().
| unsigned int 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 165 of file fvfile.cpp.
References _fvff_header_t::version.
| void FireVisionDataFile::write | ( | const char * | file_name | ) | [virtual] |
Write file.
- Parameters:
-
file_name file to write to
Definition at line 259 of file fvfile.cpp.
References _spec_header, _spec_header_size, _fvff_header_t::created_sec, _fvff_header_t::created_usec, _fvff_header_t::num_blocks, and _fvff_header_t::spec_head_size.
Referenced by FireVisionNetworkTool::fuse_inbound_received(), TriclopsStereoProcessor::generate_rectification_lut(), Histogram::save(), BayesHistosToLut::save(), BayesColormapGenerator::save_histograms(), and BayesHistosToLut::saveLut().
Member Data Documentation
void * 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 63 of file fvfile.h.
Referenced by ColormapFile::add_colormap(), ColormapFile::ColormapFile(), FireVisionDataFile(), RectificationInfoFile::read(), read(), RectificationInfoFile::RectificationInfoFile(), write(), and ~FireVisionDataFile().
size_t FireVisionDataFile::_spec_header_size [protected] |
Size in bytes of _spec_header.
Definition at line 64 of file fvfile.h.
Referenced by ColormapFile::add_colormap(), ColormapFile::ColormapFile(), FireVisionDataFile(), RectificationInfoFile::RectificationInfoFile(), and write().
The documentation for this class was generated from the following files:
- src/firevision/fvutils/fileformat/fvfile.h
- src/firevision/fvutils/fileformat/fvfile.cpp

