/usr/include/BALL/CONCEPT/XDRPersistenceManager.h is in libball1.4-dev 1.4.1+20111206-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | // -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_CONCEPT_XDRPERSISTENCEMANAGER_H
#define BALL_CONCEPT_XDRPERSISTENCEMANAGER_H
#ifndef BALL_CONCEPT_PERSISTENCEMANAGER_H
# include <BALL/CONCEPT/persistenceManager.h>
#endif
#include <rpc/types.h>
#include <rpc/xdr.h>
namespace BALL
{
/** XDR-format-based persistence manager.
This class implements a persistence manager that reads and writes
its objects in a portable binary format.
@see TextPersistenceManager
\ingroup Persistence
*/
class BALL_EXPORT XDRPersistenceManager
: public PersistenceManager
{
public:
/** @name Constants
*/
//@{
/** A constant value used to mark the beginning of a persistent stream
*/
static const Size STREAM_HEADER;
/** A constant value used to mark the end of a persistent stream
*/
static const Size STREAM_TRAILER;
/** A constant value used to mark the beginning of an object
*/
static const Size OBJECT_HEADER;
/** A constant value used to mark the end of an object
*/
static const Size OBJECT_TRAILER;
//@}
/** @name Constructors and Destructors
*/
//@{
/** Default constructor.
*/
XDRPersistenceManager()
;
/** Detailed constructor with an input stream
*/
XDRPersistenceManager(std::istream& is)
;
/** Detailed constructor with an output stream
*/
XDRPersistenceManager(std::ostream& os)
;
/** Detailed constructor with an input stream and an output stream.
*/
XDRPersistenceManager(std::istream& is, std::ostream& os)
;
//@}
/** @name Layer 0 methods
*/
//@{
/** Write an object header.
This method stores \link OBJECT_HEADER OBJECT_HEADER \endlink as an int value to mark the
start of an object (using <tt>xdr_int</tt>).
*/
virtual void writeHeader(const char* type_name, const char* name, LongSize ptr)
;
/** Check for an object header.
This method reads an int form the input stream (using <tt>xdr_int</tt>) and
returns <b>true</b> if the value read equals \link OBJECT_HEADER OBJECT_HEADER \endlink .
*/
virtual bool checkHeader(const char* type_name, const char* name, LongSize& ptr)
;
/** Write an object trailer.
This method stores \link OBJECT_TRAILER OBJECT_TRAILER \endlink as an int value to mark the
start of an object (using <tt>xdr_int</tt>).
*/
virtual void writeTrailer(const char* name = 0)
;
/** Check for an object trailer.
This method reads an int form the input stream (using <tt>xdr_int</tt>) and
returns <b>true</b> if the value read equals \link OBJECT_TRAILER OBJECT_TRAILER \endlink .
*/
virtual bool checkTrailer(const char* name = 0)
;
/** Write a start marker to the output stream.
*/
virtual void writeStreamHeader()
;
/** Write an end marker to the output stream.
*/
virtual void writeStreamTrailer()
;
/** Check for the start marker in the input stream.
*/
virtual bool checkStreamHeader()
;
/** Check for the end marker in the output stream.
*/
virtual bool checkStreamTrailer()
;
/** Get an (unknown) object header.
*/
virtual bool getObjectHeader(String& type_name, LongSize& ptr)
;
/** Write a variable/member name.
*/
virtual void writeName(const char* name)
;
/** Check for variable/member name.
*/
virtual bool checkName(const char* name)
;
/** Write storable object header.
*/
virtual void writeStorableHeader(const char* type_name, const char* name)
;
/** Check for storable object header.
*/
virtual bool checkStorableHeader(const char* type_name, const char* name)
;
/** Write type header and name for a primitive type.
*/
virtual void writePrimitiveHeader(const char* type_name, const char* name)
;
/** Check for a type header and name for a primitive type.
*/
virtual bool checkPrimitiveHeader(const char* type_name, const char* name)
;
/** Write storable object trailer.
*/
virtual void writeStorableTrailer()
;
/** Check for storable object trailer.
*/
virtual bool checkStorableTrailer()
;
/** Write the trailer for a primitive type.
*/
virtual void writePrimitiveTrailer()
;
/** Check the trailer of a primitive type.
*/
virtual bool checkPrimitiveTrailer()
;
/** Write header for a pointer to a PersistentObject.
*/
virtual void writeObjectPointerHeader(const char* type_name, const char* name)
;
/** Check for header for a pointer to a PersistentObject.
*/
virtual bool checkObjectPointerHeader(const char* type_name, const char* name)
;
/** Write header for a reference to a PersistentObject.
*/
virtual void writeObjectReferenceHeader(const char* type_name, const char* name)
;
/** Check for header for a reference to a PersistentObject.
*/
virtual bool checkObjectReferenceHeader(const char* type_name, const char* name)
;
/** Write header for an array of pointers to PersistentObjects.
*/
virtual void writeObjectPointerArrayHeader(const char* type_name, const char* name, Size size)
;
/** Check for header for an array of pointers to PersistentObjects.
*/
virtual bool checkObjectPointerArrayHeader(const char* type_name, const char* name, Size& size)
;
/** Write trailer for an array of pointers to PersistentObjects.
*/
virtual void writeObjectPointerArrayTrailer()
;
/** Check for trailer for an array of pointers to PersistentObjects.
*/
virtual bool checkObjectPointerArrayTrailer()
;
/** Prepare the stream for output.
This method creates an XDR output stream (using xdrrec_create) and
prepares it for output.
*/
virtual void initializeOutputStream()
;
/** Prepare the stream for closing.
This method destroys the XDR output stream (using xdr_destroy).
*/
virtual void finalizeOutputStream()
;
/** Prepare the stream for output.
This method creates an XDR output stream (using xdrrec_create) and
prepares it for output.
*/
virtual void initializeInputStream()
;
/** Prepare the stream for closing.
This method destroys the XDR output stream (using xdr_destroy).
*/
virtual void finalizeInputStream()
;
//@}
/** @name Put methods for primitive data types.
*/
//@{
/** Write a signed char to the output stream.
*/
virtual void put(const char c)
;
/** Write a single byte the output stream.
*/
virtual void put(const Byte b)
;
/** Write an Index to the output stream.
*/
virtual void put(const Index i)
;
/** Write a Size or a Position to the output stream.
*/
virtual void put(const Size s)
;
/** Write a boolean value to the output stream.
*/
virtual void put(const bool b)
;
/** Write a single precision floating point number to the output stream.
*/
virtual void put(const Real f)
;
/** Write a double precision floating point number to the output stream.
*/
virtual void put(const DoubleReal d)
;
/** Write a string to the output.
*/
virtual void put(const string& s)
;
/** Write a pointer to the output.
*/
virtual void put(const LongSize p)
;
//@}
/** @name Get methods for primitive data types.
*/
//@{
/** Read a signed char from the input stream.
*/
virtual void get(char& c)
;
/** Read a single byte from the input stream.
*/
virtual void get(Byte& c)
;
/** Read an Index from the input stream.
*/
virtual void get(Index& s)
;
/** Read a Size or a Position from the input stream.
*/
virtual void get(Size& s)
;
/** Read a boolean value from the input stream.
*/
virtual void get(bool& b)
;
/** Read a single precision floating point number from the input stream.
*/
virtual void get(Real& f)
;
/** Read a double precision floating point number from the input stream.
*/
virtual void get(DoubleReal& d)
;
/** Read a string from the output stream.
*/
virtual void get(string& s)
;
/** Read a pointer from the input stream.
*/
virtual void get(LongSize& p)
;
//@}
/** Accesssors
*/
//@{
/** With this method, our caller can take responsibility for
* initializing and destroying the XDR streams.
*/
void setHandleStreamsExternally(bool handle_externally);
//@}
private:
/** The XDR struct used to read from
*/
XDR xdr_in_;
/** The XDR struct used to write to
*/
XDR xdr_out_;
/** If this flag is set to true, we will not destroy
* or initialize the XDR variables automatically.
*/
bool streams_handled_externally_;
};
} // namespace BALL
#endif // BALL_CONCEPT_XDRPERSISTENCEMANAGER_H
|