textPersistenceManager.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: textPersistenceManager.h,v 1.21 2005/10/23 12:02:17 oliver Exp $
00005 //
00006 
00007 #ifndef BALL_CONCEPT_TEXTPERSISTENCEMANAGER_H
00008 #define BALL_CONCEPT_TEXTPERSISTENCEMANAGER_H
00009 
00010 #ifndef BALL_CONCEPT_PERSISTENCEMANAGER_H
00011 # include <BALL/CONCEPT/persistenceManager.h>
00012 #endif
00013 
00014 namespace BALL 
00015 {
00016 
00027   class BALL_EXPORT TextPersistenceManager
00028     : public PersistenceManager
00029   {
00030     public:
00031 
00035     
00039     TextPersistenceManager();
00040       
00043     TextPersistenceManager(std::istream& is);
00044 
00047     TextPersistenceManager(std::ostream& os);
00048 
00051     TextPersistenceManager(std::istream& is, std::ostream& os);
00053     
00057 
00074     virtual void writeHeader(const char* type_name, const char* name, LongSize ptr);
00075 
00078     virtual bool checkHeader(const char* type_name, const char* name, LongSize& ptr);
00079 
00082     virtual void writeTrailer(const char* name = 0);
00083 
00086     virtual bool checkTrailer(const char* name = 0);
00087 
00090     virtual void writeStreamHeader();
00091 
00094     virtual void writeStreamTrailer();
00095 
00098     virtual bool checkStreamHeader();
00099 
00102     virtual bool checkStreamTrailer();
00103 
00106     virtual bool getObjectHeader(String& type_name, LongSize& ptr);
00107 
00110     virtual void writeName(const char* name);
00111 
00114     virtual bool checkName(const char* name);
00115 
00118     virtual void writeStorableHeader(const char* type_name, const char* name);
00119       
00122     virtual bool checkStorableHeader(const char* type_name, const char* name);
00123 
00126     virtual void writePrimitiveHeader(const char* type_name, const char* name);
00127 
00130     virtual bool checkPrimitiveHeader(const char* type_name, const char* name);
00131 
00134     virtual void writeStorableTrailer();
00135       
00138     virtual bool checkStorableTrailer();
00139 
00142     virtual void writePrimitiveTrailer();
00143 
00146     virtual bool checkPrimitiveTrailer();
00147 
00150     virtual void writeObjectPointerHeader(const char* type_name, const char* name);
00151 
00154     virtual bool checkObjectPointerHeader(const char* type_name, const char* name);
00155 
00158     virtual void writeObjectReferenceHeader(const char* type_name, const char* name);
00159 
00162     virtual bool checkObjectReferenceHeader(const char* type_name, const char* name);
00163 
00166     virtual void writeObjectPointerArrayHeader(const char* type_name, const char* name, Size size);
00167 
00170     virtual bool checkObjectPointerArrayHeader(const char* type_name, const char* name, Size& size);
00171 
00174     virtual void writeObjectPointerArrayTrailer();
00175 
00178     virtual bool checkObjectPointerArrayTrailer();
00180 
00184     
00187     virtual void put(const char c);
00188 
00191     virtual void put(const Byte c);
00192 
00195     virtual void put(const Index s);
00196 
00199     virtual void put(const Size s);
00200 
00203     virtual void put(const bool b);
00204 
00207     virtual void put(const Real f);
00208 
00211     virtual void put(const DoubleReal d);
00212 
00215     virtual void put(const string& s);
00216 
00219     virtual void put(const LongSize p);
00221 
00225 
00228     virtual void get(char& c);
00229 
00232     virtual void get(Byte& b);
00233 
00236     virtual void get(Index& i);
00237 
00240     virtual void get(Size& s);
00241 
00244     virtual void get(bool& b);
00245 
00248     virtual void get(Real& f);
00249 
00252     virtual void get(DoubleReal& d);
00253 
00256     virtual void get(string& s);
00257 
00260     virtual void get(LongSize& p);
00262 
00263 
00264     protected:
00265     
00273     virtual bool expect(const String& value);
00274 
00277     virtual const char* indent();
00278     
00279     private:
00280 
00281     static const char*  INDENT_STRING;
00282     static const Size   MAX_INDENT;
00283 
00284     Size indent_depth_;
00285 
00286   };
00287 } // namespace BALL
00288 
00289 #endif // BALL_CONCEPT_TEXTPERSISTENCEMANAGER_H