00001
00002
00003
00005 #ifndef DATADESCRIP_H
00006 #define DATADESCRIP_H
00007
00008 #include "FeatVec.h"
00009 #if __GNUC__<= 2
00010 #include <hash_map>
00011 #else
00012 #include <ext/hash_map>
00013 #endif
00014 #include <iostream>
00015
00016
00025 class DataDescrip {
00026 public:
00027 DataDescrip() : _size(0) { }
00028
00032 int getNumDim() const;
00033
00037 void add(EvidenceType*);
00038
00045 int getIdx(const Prediction*) const;
00046
00051 unsigned getDiscSize() const;
00052
00060 void initVec(FeatVec&) const;
00061
00062 FeatVec* read(std::istream&) const;
00063 FeatVec* read_wght(std::istream&) const;
00064
00068 int size() const { return _size; }
00069
00070 private:
00071 struct myeqstr {
00072 bool operator()(const char* s1, const char* s2) const {
00073 return strcmp(s1,s2)==0;
00074 }
00075 };
00076 #if __GNUC__<=2
00077 typedef hash_map<const char*, EvidenceType*, hash<const char*>, myeqstr> evHashMap;
00078 #elif defined(__INTEL_COMPILER) && __INTEL_COMPILER <= 810
00079 typedef std::hash_map<const char*, EvidenceType*, std::hash<const char*>, myeqstr> evHashMap;
00080 #else
00081 typedef __gnu_cxx::hash_map<const char*, EvidenceType*, __gnu_cxx::hash<const char*>, myeqstr> evHashMap;
00082 #endif
00083 evHashMap _evMap;
00084 int _size;
00085 };
00086
00087 #endif // DATADESCRIP_H