BALL::PersistentObject Class Reference
[Object Persistence.]

#include <BALL/CONCEPT/persistentObject.h>

Inheritance diagram for BALL::PersistentObject:
BALL::Object BALL::AutoDeletable BALL::Composite BALL::NamedProperty BALL::TVector2< T > BALL::TVector2< float > BALL::Atom BALL::AtomContainer BALL::Bond BALL::PDBAtom BALL::SmilesParser::SPAtom BALL::Chain BALL::Fragment BALL::Molecule BALL::SecondaryStructure BALL::System BALL::SmilesParser::SPBond

List of all members.


Public Member Functions

Constructors and Destructors
 PersistentObject ()
virtual ~PersistentObject ()
Persistent Writing and Reading
PersistenceManageroperator>> (PersistenceManager &pm) const throw (Exception::GeneralException)
virtual void persistentWrite (PersistenceManager &pm, const char *name="") const throw (Exception::GeneralException)
virtual void persistentRead (PersistenceManager &pm) throw (Exception::GeneralException)
virtual void finalize () throw (Exception::GeneralException)

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 >>.

Constructor & Destructor Documentation

BALL::PersistentObject::PersistentObject (  )  [inline]

Default constructor. The default constructor has no functionality.

virtual BALL::PersistentObject::~PersistentObject (  )  [inline, virtual]

Destructor. The destructor has no functionality.


Member Function Documentation

virtual void BALL::PersistentObject::finalize (  )  throw (Exception::GeneralException) [inline, virtual]

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.

Reimplemented in BALL::Bond.

PersistenceManager& BALL::PersistentObject::operator>> ( PersistenceManager pm  )  const throw (Exception::GeneralException)

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:
pm the persistence manager
Returns:
the persistence manager (for chaining multiple output operations)
virtual void BALL::PersistentObject::persistentRead ( PersistenceManager pm  )  throw (Exception::GeneralException) [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:
pm the PersistenceManager

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

virtual void BALL::PersistentObject::persistentWrite ( PersistenceManager pm,
const char *  name = "" 
) const throw (Exception::GeneralException) [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:
pm the persistence manager
name the name of the object (0 for writing base classes)

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