00001
00002
00003
00004
00005
00006
00007 #ifndef BALL_CONCEPT_XDRPERSISTENCEMANAGER_H
00008 #define BALL_CONCEPT_XDRPERSISTENCEMANAGER_H
00009
00010 #ifndef BALL_CONCEPT_PERSISTENCEMANAGER_H
00011 # include <BALL/CONCEPT/persistenceManager.h>
00012 #endif
00013
00014 #include <rpc/types.h>
00015 #include <rpc/xdr.h>
00016
00017 namespace BALL
00018 {
00026 class BALL_EXPORT XDRPersistenceManager
00027 : public PersistenceManager
00028 {
00029 public:
00030
00036 static const Size STREAM_HEADER;
00037
00040 static const Size STREAM_TRAILER;
00041
00044 static const Size OBJECT_HEADER;
00045
00048 static const Size OBJECT_TRAILER;
00050
00054
00057 XDRPersistenceManager()
00058 ;
00059
00062 XDRPersistenceManager(std::istream& is)
00063 ;
00064
00067 XDRPersistenceManager(std::ostream& os)
00068 ;
00069
00072 XDRPersistenceManager(std::istream& is, std::ostream& os)
00073 ;
00075
00079
00084 virtual void writeHeader(const char* type_name, const char* name, LongSize ptr)
00085 ;
00086
00091 virtual bool checkHeader(const char* type_name, const char* name, LongSize& ptr)
00092 ;
00093
00098 virtual void writeTrailer(const char* name = 0)
00099 ;
00100
00105 virtual bool checkTrailer(const char* name = 0)
00106 ;
00107
00110 virtual void writeStreamHeader()
00111 ;
00112
00115 virtual void writeStreamTrailer()
00116 ;
00117
00120 virtual bool checkStreamHeader()
00121 ;
00122
00125 virtual bool checkStreamTrailer()
00126 ;
00127
00130 virtual bool getObjectHeader(String& type_name, LongSize& ptr)
00131 ;
00132
00135 virtual void writeName(const char* name)
00136 ;
00137
00140 virtual bool checkName(const char* name)
00141 ;
00142
00145 virtual void writeStorableHeader(const char* type_name, const char* name)
00146 ;
00147
00150 virtual bool checkStorableHeader(const char* type_name, const char* name)
00151 ;
00152
00155 virtual void writePrimitiveHeader(const char* type_name, const char* name)
00156 ;
00157
00160 virtual bool checkPrimitiveHeader(const char* type_name, const char* name)
00161 ;
00162
00165 virtual void writeStorableTrailer()
00166 ;
00167
00170 virtual bool checkStorableTrailer()
00171 ;
00172
00175 virtual void writePrimitiveTrailer()
00176 ;
00177
00180 virtual bool checkPrimitiveTrailer()
00181 ;
00182
00185 virtual void writeObjectPointerHeader(const char* type_name, const char* name)
00186 ;
00187
00190 virtual bool checkObjectPointerHeader(const char* type_name, const char* name)
00191 ;
00192
00195 virtual void writeObjectReferenceHeader(const char* type_name, const char* name)
00196 ;
00197
00200 virtual bool checkObjectReferenceHeader(const char* type_name, const char* name)
00201 ;
00202
00205 virtual void writeObjectPointerArrayHeader(const char* type_name, const char* name, Size size)
00206 ;
00207
00210 virtual bool checkObjectPointerArrayHeader(const char* type_name, const char* name, Size& size)
00211 ;
00212
00215 virtual void writeObjectPointerArrayTrailer()
00216 ;
00217
00220 virtual bool checkObjectPointerArrayTrailer()
00221 ;
00222
00227 virtual void initializeOutputStream()
00228 ;
00229
00233 virtual void finalizeOutputStream()
00234 ;
00235
00240 virtual void initializeInputStream()
00241 ;
00242
00246 virtual void finalizeInputStream()
00247 ;
00248
00250
00254
00257 virtual void put(const char c)
00258 ;
00259
00262 virtual void put(const Byte b)
00263 ;
00264
00267 virtual void put(const Index i)
00268 ;
00269
00272 virtual void put(const Size s)
00273 ;
00274
00277 virtual void put(const bool b)
00278 ;
00279
00282 virtual void put(const Real f)
00283 ;
00284
00287 virtual void put(const DoubleReal d)
00288 ;
00289
00292 virtual void put(const string& s)
00293 ;
00294
00297 virtual void put(const LongSize p)
00298 ;
00300
00304
00307 virtual void get(char& c)
00308 ;
00309
00312 virtual void get(Byte& c)
00313 ;
00314
00317 virtual void get(Index& s)
00318 ;
00319
00322 virtual void get(Size& s)
00323 ;
00324
00327 virtual void get(bool& b)
00328 ;
00329
00332 virtual void get(Real& f)
00333 ;
00334
00337 virtual void get(DoubleReal& d)
00338 ;
00339
00342 virtual void get(string& s)
00343 ;
00344
00347 virtual void get(LongSize& p)
00348 ;
00350
00354
00358 void setHandleStreamsExternally(bool handle_externally);
00359
00361 private:
00362
00365 XDR xdr_in_;
00366
00369 XDR xdr_out_;
00370
00374 bool streams_handled_externally_;
00375
00376 };
00377
00378 }
00379
00380 #endif // BALL_CONCEPT_XDRPERSISTENCEMANAGER_H