00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef _OT_OBJ_H
00024 #define _OT_OBJ_H
00025
00026
00028
00029
00030
00031 class ot_obj
00032 {
00033
00034 private:
00035
00036 OT_OBJECT_TYPE m_type;
00037
00038
00039 protected:
00040
00043 ot_obj(OT_OBJECT_TYPE type);
00044
00045
00046 public:
00047
00049 virtual ~ot_obj();
00050
00053 OT_OBJECT_TYPE getType(void) const;
00054
00057 virtual ot_obj *dup(void) const = 0;
00058
00060 virtual bool operator == (const ot_obj *o) const = 0;
00061
00063 bool operator == (const ot_obj &o) const;
00064
00068 virtual void asXml(ostream &s=cout,int i=0) const = 0;
00069
00072 virtual bool asData(ostream &s) const = 0;
00073
00078 static bool readStringFromData(istream &s,string &ret);
00079
00084 static bool readIntegerFromData(istream &s,int &ret);
00085
00090 static bool readUnsignedIntegerFromData(istream &s,unsigned int &ret);
00091
00096 static bool readFloatFromData(istream &s,float &ret);
00097
00102 static bool readBoolFromData(istream &s,bool &ret);
00103
00109 static bool readRawFromData(istream &s,char * &data,int &size);
00110
00115 static bool writeStringAsData(ostream &s,const string &val);
00116
00121 static bool writeIntegerAsData(ostream &s,int val);
00122
00127 static bool writeBoolAsData(ostream &s,bool val);
00128
00134 static bool writeRawAsData(ostream &s,const char *data,int size);
00135
00136 };
00137
00138 ot_obj * buildOTObjFromData(istream &s);
00139
00141 #define OT_DYNAMIC_CAST(T,O) ((O && O->getType() == T) ? O : 0)
00142
00143 #endif
00144