00001
00002 #ifndef XSIL_METATABLE_HH
00003 #define XSIL_METATABLE_HH
00004
00005 #include "xsil/table.hh"
00006 #include "xsil/stream.hh"
00007 #include <string>
00008 #include <list>
00009
00010 namespace xsil {
00011
00024 class MetaTable : public table {
00025
00026
00032 class eventcolumn {
00033 public:
00036 enum d_type {
00037 t_none,
00038 t_chars,
00039 t_charu,
00040 t_string,
00041 t_int4s,
00042 t_longs,
00043 t_real4,
00044 t_real8,
00045 t_cite
00046 };
00047
00051 eventcolumn(void);
00052
00060 eventcolumn(d_type t, const void* a, const char* p=0);
00061
00065 ~eventcolumn(void);
00066
00068 d_type data_Type;
00070 const void* data_Addr;
00072 std::string data_Param;
00073 };
00074
00075
00076 typedef std::list<eventcolumn> ColumnList;
00077 typedef ColumnList::const_iterator col_iter;
00078
00079 public:
00080
00084 MetaTable(void);
00085
00089 MetaTable(const char* Name, const char* Type=0);
00090
00094 MetaTable(const MetaTable& x);
00095
00100
00101
00105 virtual ~MetaTable(void);
00106
00110 void check(const char* title, int csize=0) const;
00111
00115 void clear(void);
00116
00124 void defineColumn(const char* Name, const int* Addr);
00125
00133 void defineColumn(const char* Name, const long* Addr);
00134
00142 void defineColumn(const char* Name, const float* Addr);
00143
00151 void defineColumn(const char* Name, const double* Addr);
00152
00161 void defineColumn(const char* Name, const char* Addr,
00162 bool ilwc=false);
00163
00172 void defineColumn(const char* Name, const std::string* Addr,
00173 bool ilwc=false);
00174
00182 void defineColumn(const char* Name, const UCVec* Addr);
00183
00190 void defineColumn(const char* Name, const MetaTable* Addr,
00191 const char* Col=0);
00192
00197 int getNColumn(void) const;
00198
00202 int getNRow(void) const;
00203
00208 void putRow(void);
00209
00213 void resetStream(void);
00214
00219 std::string citeTable(const std::string& col) const;
00220
00226 std::string citeTable(const std::string& col, int row) const;
00227
00228 private:
00229 std::string getTableName(void) const;
00230 std::string getItemName(const std::string& x) const;
00231
00232 private:
00233 std::string mGroup;
00234 ColumnList mCList;
00235 int mRow;
00236 };
00237
00238
00239 inline int
00240 MetaTable::getNRow(void) const {
00241 return mRow;
00242 }
00243
00244 inline int
00245 MetaTable::getNColumn(void) const {
00246 return mCList.size();
00247 }
00248
00249 }
00250
00251 #endif // XSIL_METATABLE_HH