BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members
BALL::PersistentObject Class Reference

#include <BALL/CONCEPT/persistentObject.h>

Inheritance diagram for BALL::PersistentObject:
BALL::Object BALL::AutoDeletable BALL::Composite BALL::CrystalInfo BALL::NamedProperty BALL::PDBInfo BALL::PDBRecords BALL::TVector2< T > BALL::VIEW::Stage::Material BALL::TVector2< float >

Public Member Functions

Constructors and Destructors
 PersistentObject ()
 
virtual ~PersistentObject ()
 
Persistent Writing and Reading
PersistenceManageroperator>> (PersistenceManager &pm) const
 
virtual void persistentWrite (PersistenceManager &pm, const char *name="") const
 
virtual void persistentRead (PersistenceManager &pm)
 
virtual void finalize ()
 
- Public Member Functions inherited from BALL::Object
 Object ()
 Default constructor. More...
 
 Object (const Object &object)
 Copy constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
virtual void clear ()
 Clear function of the OCI, doing nothing here. More...
 
const Objectoperator= (const Object &)
 
bool operator== (const Object &object) const
 
bool operator!= (const Object &object) const
 
bool operator< (const Object &object) const
 
bool operator<= (const Object &object) const
 
bool operator>= (const Object &object) const
 
bool operator> (const Object &object) const
 
int compare (const Object &object) const
 
virtual bool isValid () const
 
virtual void dump (::std::ostream &s=std::cout, Size depth=0) const
 
Handle getHandle () const
 
- Public Member Functions inherited from BALL::AutoDeletable
virtual ~AutoDeletable ()
 
void * operator new (size_t size)
 
void operator delete (void *ptr)
 
void * operator new (size_t size, void *ptr)
 
void operator delete (void *ptr, void *)
 
bool isAutoDeletable () const
 
void setAutoDeletable (bool enable)
 

Additional Inherited Members

- Static Public Member Functions inherited from BALL::Object
static Handle getNextHandle ()
 
static Handle getNewHandle ()
 
- Static Public Member Functions inherited from BALL::AutoDeletable
static void clearLastPtr ()
 
- Protected Member Functions inherited from BALL::AutoDeletable
 AutoDeletable ()
 
 AutoDeletable (const AutoDeletable &auto_deletable, bool deep=false)
 

Detailed Description

The persistent object. Each object that needs persistence, has to be derived from PersistentObject to define an interface to the PersistenceManager .

The class itself has no functionality except for the operator >>.

Definition at line 27 of file persistentObject.h.

Constructor & Destructor Documentation

BALL::PersistentObject::PersistentObject ( )
inline

Default constructor. The default constructor has no functionality.

Definition at line 39 of file persistentObject.h.

virtual BALL::PersistentObject::~PersistentObject ( )
inlinevirtual

Destructor. The destructor has no functionality.

Definition at line 47 of file persistentObject.h.

Member Function Documentation

virtual void BALL::PersistentObject::finalize ( )
inlinevirtual

Finalize the deserialization. This method is called for all objects after their pointers have been demangled. It is intended for the adaptation of internal data structures. For example, the bond class has to swap first_ and second_ depending on the order of the atoms. It is usually left unimplemented.

Exceptions
Exception::GeneralException

Reimplemented in BALL::Bond.

Definition at line 103 of file persistentObject.h.

PersistenceManager& BALL::PersistentObject::operator>> ( PersistenceManager pm) const

Stream operator. This operator is used to serialize an instance of PersistentObject. The method first calls pm.startOutput() to write the necessary headers. Then, persistentWrite(pm) is called to serialize the object. Finally, a call to pm.stopOutput() writes all dependend objects and the end marker to the persistent stream.

Parameters
pmthe persistence manager
Exceptions
Exception::GeneralException
Returns
the persistence manager (for chaining multiple output operations)
virtual void BALL::PersistentObject::persistentRead ( PersistenceManager pm)
virtual

Deserialize the object. This method reads the contents of an persistent object into an (already existing!) object. It is implemented using Layer 1 commands of PersistenceManager. To each write command used in persistentWrite, there should be exactly the same call to a read command in persistentRead. Only the header and trailer (writeObjectHeader/writeObjectTrailer calls) have to be omitted, as the header is read before this method is called (the object type has to be known in advance to dynamically create the object).

Parameters
pmthe PersistenceManager
Exceptions
Exception::GeneralException

Reimplemented in BALL::VIEW::Stage::Material, BALL::Atom, BALL::Bond, BALL::NamedProperty, BALL::Composite, BALL::CrystalInfo, BALL::PDBRecords, BALL::PDBAtom, BALL::PDBInfo, BALL::TVector2< T >, BALL::TVector2< float >, BALL::Residue, BALL::SecondaryStructure, BALL::Nucleotide, BALL::AtomContainer, BALL::NucleicAcid, BALL::Molecule, BALL::Protein, BALL::Chain, BALL::System, and BALL::Fragment.

virtual void BALL::PersistentObject::persistentWrite ( PersistenceManager pm,
const char *  name = "" 
) const
virtual

Serialize the object. This method serializes the object by calls to Layer 1 methods of PersistenceManager . The first method in the implementation of persistentRead should be a call to pm.writeObjectHeader(*this, name). Likewise the last method in this method should be pm.writeObjectTrailer(name).

Parameters
pmthe persistence manager
namethe name of the object (0 for writing base classes)
Exceptions
Exception::GeneralException

Reimplemented in BALL::VIEW::Stage::Material, BALL::Atom, BALL::Bond, BALL::NamedProperty, BALL::Composite, BALL::CrystalInfo, BALL::PDBRecords, BALL::PDBAtom, BALL::PDBInfo, BALL::TVector2< T >, BALL::TVector2< float >, BALL::Residue, BALL::SecondaryStructure, BALL::Nucleotide, BALL::AtomContainer, BALL::NucleicAcid, BALL::Molecule, BALL::Protein, BALL::Chain, BALL::System, and BALL::Fragment.