Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

CdbObjectTranslator Class Reference

The very base class for persistent-to-transient translators of payload objects. More...

#include <CdbObjectTranslator.hh>

Inheritance diagram for CdbObjectTranslator:

CdbObjectTranslatorT< T > CdbObjectTranslatorT< CdbRooTestClass > CdbBdbObjectTranslatorPT< P, T > CdbRooObjectTranslatorRT< R, T > CdbRooObjectTranslatorRT< CdbRooNTupleSimpleImplR< unsigned int >, CdbRooTestClass > CdbBdbObjectTranslatorP2T< P, T > CdbRooSimpleTranslator< R, T > List of all members.

Public Member Functions

virtual ~CdbObjectTranslator ()
 Destructor.

unsigned int transientTypeId () const
 Returns a transient type number.

std::string persistentTypeName () const
 Returns a transient type number.

template<class T> CdbStatus transient (T *&theTransientPtr, const CdbObjectPtr &theObjectPtr) const
 Translate into a transient object (type-safe wrapper).


Protected Member Functions

 CdbObjectTranslator (unsigned int theTransientTypeId, const std::string &thePersistentTypeName)
 Normal constructor.

virtual CdbStatus toTransient (void *&theTransientPtr, const CdbObjectPtr &theObjectPtr) const=0
 Translate into a transient object.


Detailed Description

The very base class for persistent-to-transient translators of payload objects.

This class is an element of the "persistent-to-transient" translation facility extending the core CDB API and allowing a better (and more confined) controll over persistency in client applications.

Roles of this class are:

1. to represent translators in a dictionary of ones 2. to handle the type-independednt context of translators 3. to force its subclasses to implement an actual translation procedure 4. to provide a type-safe wrapper to the translation procedure

Definition at line 25 of file CdbObjectTranslator.hh.


Constructor & Destructor Documentation

CdbObjectTranslator::CdbObjectTranslator unsigned int    theTransientTypeId,
const std::string &    thePersistentTypeName
[inline, protected]
 

Normal constructor.

Definition at line 45 of file CdbObjectTranslator.hh.

virtual CdbObjectTranslator::~CdbObjectTranslator   [inline, virtual]
 

Destructor.

Definition at line 78 of file CdbObjectTranslator.hh.


Member Function Documentation

std::string CdbObjectTranslator::persistentTypeName   const [inline]
 

Returns a transient type number.

Definition at line 86 of file CdbObjectTranslator.hh.

virtual CdbStatus CdbObjectTranslator::toTransient void *&    theTransientPtr,
const CdbObjectPtr   theObjectPtr
const [protected, pure virtual]
 

Translate into a transient object.

This method is supposed to be implemented by subclasses. In case of its successful completion (CdbStatus::Success) it's supposed to set up the supplied reference to point onto a new transinet object. The ownership of this object is also returned with the object.

DESIGN NOTE:

It's up to the caller of this method to interprete the actual type of the returned object. That type is the one corresponding to a value of the "transient type identifier" passed to the class's constructor. Normally, this method shouldn't be used by users directly. It has to be wrrapped into a type-safe ionterface.

See also:
CdbObjectTranslator::transient()
If the operation, for some, reason should fail then the corresponding error status (other than CdbStatus::Success) has to be returned.
Parameters:
theTransientPtr  the pointer to be initialized with the result
theObjectPtr  the input metadata object

Referenced by transient().

template<class T>
CdbStatus CdbObjectTranslator::transient T *&    theTransientPtr,
const CdbObjectPtr   theObjectPtr
const [inline]
 

Translate into a transient object (type-safe wrapper).

The only role of this wrapper is to make sure that

Parameters:
theTransientPtr  the pointer to be initialized with the result
theObjectPtr  the input metadata object

Definition at line 93 of file CdbObjectTranslator.hh.

References CdbType2Id< T, GENERATOR >::id(), CdbStatus::IllegalParameters, toTransient(), and transientTypeId().

unsigned int CdbObjectTranslator::transientTypeId   const [inline]
 

Returns a transient type number.

Definition at line 82 of file CdbObjectTranslator.hh.

Referenced by transient().


The documentation for this class was generated from the following file:
Generated on Mon Dec 5 18:22:23 2005 for CDB by doxygen1.3-rc3