00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef HxIndxHisto_H
00011 #define HxIndxHisto_H
00012
00013 #include "HxIndxArray.h"
00014 #include "HxHistoList.h"
00015
00016
00017 template<class HeaderT>
00018 class IndxHistHeaderT {
00019 public:
00020 friend STD_OSTREAM& operator<<(STD_OSTREAM& os,
00021 const IndxHistHeaderT& l)
00022 {return os << l.bins << " bins, " << l.chans <<
00023 ((l.chans == 1) ? HxString(" channel") :
00024 HxString(" channels"));}
00025 int bins;
00026 int chans;
00027 HeaderT header;
00028 };
00029
00030 template<class HeaderT>
00031 class indexedHisto : public indexedArray<float, IndxHistHeaderT<HeaderT> > {
00032 public:
00033 void create(HxString indexFile, HeaderT header);
00034 void add(HxString& key, HxHistoList& l);
00035 void search(HxHistoList& target, int n = 10, int refine = 0);
00036
00037 int bins() const;
00038 int chans() const;
00039 HeaderT header() const;
00040
00041 friend STD_OSTREAM& operator<<(STD_OSTREAM& os,
00042 const indexedHisto& l)
00043 {return l.put(os);}
00044
00045 int arraySize(const IndxHistHeaderT<HeaderT>& header) const
00046 {return header.bins*header.chans;}
00047
00048 virtual double compare(float *e1, float *e2,
00049 const IndxHistHeaderT<HeaderT>& header) const;
00050
00051 private:
00052 int _create;
00053 HeaderT _header;
00054 };
00055
00056
00057 #ifdef INC_TEMPLATE_SRC
00058 #include "HxIndxHisto.c"
00059 #endif
00060
00061 #endif