SegmentedColorFilterBankEvent.hGo to the documentation of this file.00001
00002 #ifndef INCLUDED_SegmentedColorFilterBankEvent_h_
00003 #define INCLUDED_SegmentedColorFilterBankEvent_h_
00004
00005 #include "Events/FilterBankEvent.h"
00006 #include "Vision/cmvision.h"
00007 #include <ext/hash_map>
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 class SegmentedColorFilterBankEvent : public FilterBankEvent {
00019 public:
00020 typedef CMVision::color_class_state color_class_state;
00021 typedef __gnu_cxx::hash_map<const char*, unsigned int, __gnu_cxx::hash<const char*>, hashcmp_eqstr> hashmap;
00022
00023
00024 SegmentedColorFilterBankEvent(FilterBankGenerator* creator,EventBase::EventGeneratorID_t gid,unsigned int sid, FilterBankGenerator* segColorSrc, unsigned int nColors, color_class_state * colorInfos, const hashmap * clrNames)
00025 : FilterBankEvent(creator,gid,sid), segsrc(segColorSrc), numColors(nColors), colors(colorInfos), colorNames(clrNames)
00026 {}
00027
00028
00029 SegmentedColorFilterBankEvent(FilterBankGenerator* creator,EventBase::EventGeneratorID_t gid,unsigned int sid, const SegmentedColorFilterBankEvent& segevt )
00030 : FilterBankEvent(creator,gid,sid), segsrc(segevt.segsrc), numColors(segevt.numColors), colors(segevt.colors), colorNames(segevt.colorNames)
00031 {}
00032
00033
00034 inline FilterBankGenerator* getSegmentedColorSource() const { return segsrc; }
00035
00036
00037 inline unsigned int getNumColors() const { return numColors; }
00038
00039
00040 inline color_class_state * getColors() const { return colors; }
00041
00042
00043 inline color_class_state& getColor(unsigned int i) const { return colors[i]; }
00044
00045
00046 inline unsigned int getColorIndex(const char * name) const {
00047 hashmap::const_iterator i;
00048 i=colorNames->find(name);
00049 return (i==colorNames->end())?-1U:i->second;
00050 }
00051
00052
00053 inline unsigned int getColorIndex(const std::string& name) const { return getColorIndex(name.c_str()); }
00054
00055 protected:
00056
00057 FilterBankGenerator* segsrc;
00058 const unsigned int numColors;
00059 color_class_state * const colors;
00060 const hashmap * const colorNames;
00061
00062 private:
00063 SegmentedColorFilterBankEvent(const SegmentedColorFilterBankEvent& fbk);
00064 const SegmentedColorFilterBankEvent& operator=(const SegmentedColorFilterBankEvent& fbk);
00065 };
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 #endif
|