24 #include <fvutils/statistical/histogram_file.h> 25 #include <fvutils/statistical/histogram_block.h> 26 #include <core/exception.h> 42 HistogramFile::HistogramFile()
45 attached_histograms.clear();
52 attached_histograms.clear();
62 if ( attached_histograms.find( block->
object_type() ) != attached_histograms.end() )
63 {
throw Exception(
"Cannot add another histogram of type %d to the file", block->
object_type()); }
65 attached_histograms[ block->
object_type() ] = block;
77 FireVisionDataFile::BlockList::iterator blit;
81 for (blit = bl.begin(); blit != bl.end(); ++blit)
83 if ((*blit)->type() == FIREVISION_HISTOGRAM_TYPE_16 ||
84 (*blit)->type() == FIREVISION_HISTOGRAM_TYPE_32 )
105 uint16_t x, uint16_t y, uint16_t z)
107 if ( attached_histograms.find(object_type) == attached_histograms.end() )
108 {
throw Exception(
"File contains no histogram for type %d", object_type); }
110 return attached_histograms[object_type]->get_value(x, y, z);
123 uint16_t x, uint16_t y, uint16_t z,
126 if ( attached_histograms.find(object_type) == attached_histograms.end() )
127 {
throw Exception(
"File contains no histogram for type %d", object_type); }
129 attached_histograms[object_type]->set_value(x, y, z, val);
HistogramBlockList histogram_blocks()
Generates a list of histogram blocks attached to the file.
~HistogramFile()
Destructor.
uint32_t get_value(hint_t object_type, uint16_t x, uint16_t y, uint16_t z)
Get a value from a certain histogram.
virtual void add_block(FireVisionDataFileBlock *block)
Add a block.
Fawkes library namespace.
hint_t object_type() const
Returns the type of the object the histogram is associated with.
std::list< FireVisionDataFileBlock * > BlockList
List of FireVision data file blocks.
void set_value(hint_t object_type, uint16_t x, uint16_t y, uint16_t z, uint32_t val)
Set a value in a certain histogram.
Base class for exceptions in Fawkes.
void add_histogram_block(HistogramBlock *block)
Adds a new histogram block to the file.
std::list< HistogramBlock * > HistogramBlockList
Convenience typdef for a STL list of pointers to histogram blocks.
FireVision File Format for data files.
This class defines a file block for histograms.
BlockList & blocks()
Get blocks.