00001
00002
00003
00004
00005 #ifndef BALL_CONCEPT_XDRPERSISTENCEMANAGER_H
00006 #define BALL_CONCEPT_XDRPERSISTENCEMANAGER_H
00007
00008 #ifndef BALL_CONCEPT_PERSISTENCEMANAGER_H
00009 # include <BALL/CONCEPT/persistenceManager.h>
00010 #endif
00011
00012 #include <rpc/types.h>
00013 #include <rpc/xdr.h>
00014
00015 namespace BALL
00016 {
00024 class BALL_EXPORT XDRPersistenceManager
00025 : public PersistenceManager
00026 {
00027 public:
00028
00034 static const Size STREAM_HEADER;
00035
00038 static const Size STREAM_TRAILER;
00039
00042 static const Size OBJECT_HEADER;
00043
00046 static const Size OBJECT_TRAILER;
00048
00052
00055 XDRPersistenceManager()
00056 ;
00057
00060 XDRPersistenceManager(std::istream& is)
00061 ;
00062
00065 XDRPersistenceManager(std::ostream& os)
00066 ;
00067
00070 XDRPersistenceManager(std::istream& is, std::ostream& os)
00071 ;
00073
00077
00082 virtual void writeHeader(const char* type_name, const char* name, LongSize ptr)
00083 ;
00084
00089 virtual bool checkHeader(const char* type_name, const char* name, LongSize& ptr)
00090 ;
00091
00096 virtual void writeTrailer(const char* name = 0)
00097 ;
00098
00103 virtual bool checkTrailer(const char* name = 0)
00104 ;
00105
00108 virtual void writeStreamHeader()
00109 ;
00110
00113 virtual void writeStreamTrailer()
00114 ;
00115
00118 virtual bool checkStreamHeader()
00119 ;
00120
00123 virtual bool checkStreamTrailer()
00124 ;
00125
00128 virtual bool getObjectHeader(String& type_name, LongSize& ptr)
00129 ;
00130
00133 virtual void writeName(const char* name)
00134 ;
00135
00138 virtual bool checkName(const char* name)
00139 ;
00140
00143 virtual void writeStorableHeader(const char* type_name, const char* name)
00144 ;
00145
00148 virtual bool checkStorableHeader(const char* type_name, const char* name)
00149 ;
00150
00153 virtual void writePrimitiveHeader(const char* type_name, const char* name)
00154 ;
00155
00158 virtual bool checkPrimitiveHeader(const char* type_name, const char* name)
00159 ;
00160
00163 virtual void writeStorableTrailer()
00164 ;
00165
00168 virtual bool checkStorableTrailer()
00169 ;
00170
00173 virtual void writePrimitiveTrailer()
00174 ;
00175
00178 virtual bool checkPrimitiveTrailer()
00179 ;
00180
00183 virtual void writeObjectPointerHeader(const char* type_name, const char* name)
00184 ;
00185
00188 virtual bool checkObjectPointerHeader(const char* type_name, const char* name)
00189 ;
00190
00193 virtual void writeObjectReferenceHeader(const char* type_name, const char* name)
00194 ;
00195
00198 virtual bool checkObjectReferenceHeader(const char* type_name, const char* name)
00199 ;
00200
00203 virtual void writeObjectPointerArrayHeader(const char* type_name, const char* name, Size size)
00204 ;
00205
00208 virtual bool checkObjectPointerArrayHeader(const char* type_name, const char* name, Size& size)
00209 ;
00210
00213 virtual void writeObjectPointerArrayTrailer()
00214 ;
00215
00218 virtual bool checkObjectPointerArrayTrailer()
00219 ;
00220
00225 virtual void initializeOutputStream()
00226 ;
00227
00231 virtual void finalizeOutputStream()
00232 ;
00233
00238 virtual void initializeInputStream()
00239 ;
00240
00244 virtual void finalizeInputStream()
00245 ;
00246
00248
00252
00255 virtual void put(const char c)
00256 ;
00257
00260 virtual void put(const Byte b)
00261 ;
00262
00265 virtual void put(const Index i)
00266 ;
00267
00270 virtual void put(const Size s)
00271 ;
00272
00275 virtual void put(const bool b)
00276 ;
00277
00280 virtual void put(const Real f)
00281 ;
00282
00285 virtual void put(const DoubleReal d)
00286 ;
00287
00290 virtual void put(const string& s)
00291 ;
00292
00295 virtual void put(const LongSize p)
00296 ;
00298
00302
00305 virtual void get(char& c)
00306 ;
00307
00310 virtual void get(Byte& c)
00311 ;
00312
00315 virtual void get(Index& s)
00316 ;
00317
00320 virtual void get(Size& s)
00321 ;
00322
00325 virtual void get(bool& b)
00326 ;
00327
00330 virtual void get(Real& f)
00331 ;
00332
00335 virtual void get(DoubleReal& d)
00336 ;
00337
00340 virtual void get(string& s)
00341 ;
00342
00345 virtual void get(LongSize& p)
00346 ;
00348
00352
00356 void setHandleStreamsExternally(bool handle_externally);
00357
00359 private:
00360
00363 XDR xdr_in_;
00364
00367 XDR xdr_out_;
00368
00372 bool streams_handled_externally_;
00373
00374 };
00375
00376 }
00377
00378 #endif // BALL_CONCEPT_XDRPERSISTENCEMANAGER_H