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

CdbRooRoVectorCollectionR< T, STORAGE_POLICY > Class Template Reference

A persistent vector-like collection of objects. More...

Inheritance diagram for CdbRooRoVectorCollectionR< T, STORAGE_POLICY >:

CdbRooRoPersistentCollectionR List of all members.

Public Member Functions

 CdbRooRoVectorCollectionR ()
 The default constructor.

 CdbRooRoVectorCollectionR (unsigned int theInitialSize)
 The normal constructor.

 CdbRooRoVectorCollectionR (const CdbRooRoVectorCollectionR< T, STORAGE_POLICY > &theOther)
 The copy constructor.

virtual ~CdbRooRoVectorCollectionR ()
 Destructor.

CdbRooRoVectorCollectionR<
T, STORAGE_POLICY > & 
operator= (const CdbRooRoVectorCollectionR< T, STORAGE_POLICY > &theOther)
 The assignment operator.

UInt_t size () const
virtual CdbStatus resize (UInt_t theNewSize)
 Resize the collection.

virtual CdbStatus addElement (const T &theObject)
virtual CdbStatus addElement (const CdbCPtr< T > &theObjectPtr)
virtual CdbStatus elementAt (UInt_t theIndex, T &theObject) const
virtual CdbStatus elementAt (UInt_t theIndex, CdbCPtr< T > &theObjectPtr) const
virtual void dump (std::ostream &o, const std::string &indent="") const

Protected Member Functions

virtual CdbStatus storeSubCollectionsAt (const CdbRooRoCollectionAddressR &theCollectionAddress, const CdbCPtr< TFile > &theFilePtr, Int_t &theNumBytesStored)
 Store sub-collections.


Detailed Description

template<class T, class STORAGE_POLICY = CdbRooRoVectorCollection_PlainPointerPolicy<T>>
class CdbRooRoVectorCollectionR< T, STORAGE_POLICY >

A persistent vector-like collection of objects.

Classes eligible for this template must support the "value semantics" providing the following minimal interface:

class T { public: T(); T( const T&); T& operator=(const T&); ~T(); };

The total number of elements stored in a collection of this type is limited by 2**32 (unsigned 32-bit integer used as an index). Therefore valid indexes of the elements lay in the following range:

[0..0xFFFFFFFF]

inclusive at both sides of the range.

THE STORAGE MODEL:

1. Objects of the vector are stored using the mechanism of the TTree/TBranch.

2. The key name of that TTree is formed by concatenating the vector collection's name and ".Elements".

3. The branch name is always "0".

See also:
class CdbRooRoPersistentCollectionR

Definition at line 97 of file CdbRooRoVectorCollectionR.rdl.


Constructor & Destructor Documentation

template<class T, class STORAGE_POLICY>
CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::CdbRooRoVectorCollectionR  
 

The default constructor.

It's also needed for ROOT I/O.

Definition at line 26 of file CdbRooRoVectorCollectionR.cc.

template<class T, class STORAGE_POLICY>
CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::CdbRooRoVectorCollectionR unsigned int    theInitialSize
 

The normal constructor.

Initialize the collection with the specified number of elements constructed using the default constructor of the elements class.

Definition at line 36 of file CdbRooRoVectorCollectionR.cc.

template<class T, class STORAGE_POLICY>
CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::CdbRooRoVectorCollectionR const CdbRooRoVectorCollectionR< T, STORAGE_POLICY > &    theOther
 

The copy constructor.

IMPORTANT NOTE:

Watch out for the implementation of this constructor because objects of the class can be in two states: "stored" and "transient". The same object can't be stored more than one time due to a unique naming scheme for persistent collections (and their sub-collections (and their elements)) in ROOT files. The same rule applies to copies of an object - after the master copy got stored then its copies can't be stored anymore.

However, for the transient cache of objects the rules are slightly different. We must duplicate the cache of objects only if the input objects ia not stored. And we don't bother about duplicating it if it's not because it can easily be populated from the persistent store.

And we don't care about supplementary transient context (other than the transient list of objects). That context is only used to populate the transient list from the persistent store. Copying this context accross objects can be dangerous too.

Definition at line 53 of file CdbRooRoVectorCollectionR.cc.

References CdbRooRoPersistentCollectionR::isStored().

template<class T, class STORAGE_POLICY>
CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::~CdbRooRoVectorCollectionR   [virtual]
 

Destructor.

Definition at line 81 of file CdbRooRoVectorCollectionR.cc.


Member Function Documentation

template<class T, class STORAGE_POLICY>
CdbStatus CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::addElement const CdbCPtr< T > &    theObjectPtr [virtual]
 

Definition at line 191 of file CdbRooRoVectorCollectionR.cc.

References CdbStatus::Error, CdbStatus::IllegalParameters, CdbCPtr< P, CLOSE_POLICY >::isNull(), CdbRooRoPersistentCollectionR::isStored(), and CdbStatus::Success.

template<class T, class STORAGE_POLICY>
CdbStatus CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::addElement const T &    theObject [virtual]
 

Definition at line 172 of file CdbRooRoVectorCollectionR.cc.

References CdbStatus::Error, CdbRooRoPersistentCollectionR::isStored(), and CdbStatus::Success.

template<class T, class STORAGE_POLICY>
void CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::dump std::ostream &    o,
const std::string &    indent = ""
const [virtual]
 

Definition at line 250 of file CdbRooRoVectorCollectionR.cc.

References CdbCPtr< TTree >::isNull(), CdbCPtr< TFile >::isNull(), CdbRooRoPersistentCollectionR::isStored(), and CdbRooRoPersistentCollectionR::storedCollectionAddress().

template<class T, class STORAGE_POLICY>
CdbStatus CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::elementAt UInt_t    theIndex,
CdbCPtr< T > &    theObjectPtr
const [virtual]
 

Definition at line 231 of file CdbRooRoVectorCollectionR.cc.

References CdbStatus::Success.

template<class T, class STORAGE_POLICY>
CdbStatus CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::elementAt UInt_t    theIndex,
T &    theObject
const [virtual]
 

Definition at line 214 of file CdbRooRoVectorCollectionR.cc.

References CdbStatus::Success.

template<class T, class STORAGE_POLICY>
CdbRooRoVectorCollectionR< T, STORAGE_POLICY > & CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::operator= const CdbRooRoVectorCollectionR< T, STORAGE_POLICY > &    theOther
 

The assignment operator.

IMPORTANT NOTE:

See notes for the copy constructor. The same rules apply.

Definition at line 97 of file CdbRooRoVectorCollectionR.cc.

References CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::_size, CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::_tCachedObjects, CdbRooRoPersistentCollectionR::isStored(), and CdbRooRoPersistentCollectionR::operator=().

template<class T, class STORAGE_POLICY>
CdbStatus CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::resize UInt_t    theNewSize [virtual]
 

Resize the collection.

If the collection gets extended then added elements will be initialized using the default constructor of the element's class.

Definition at line 140 of file CdbRooRoVectorCollectionR.cc.

References CdbStatus::Error, CdbRooRoPersistentCollectionR::isStored(), CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::size(), and CdbStatus::Success.

template<class T, class STORAGE_POLICY = CdbRooRoVectorCollection_PlainPointerPolicy<T>>
UInt_t CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::size   const [inline]
 

Definition at line 149 of file CdbRooRoVectorCollectionR.rdl.

Referenced by CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::resize().

template<class T, class STORAGE_POLICY>
CdbStatus CdbRooRoVectorCollectionR< T, STORAGE_POLICY >::storeSubCollectionsAt const CdbRooRoCollectionAddressR   theCollectionAddress,
const CdbCPtr< TFile > &    theFilePtr,
Int_t &    theNumBytesStored
[protected, virtual]
 

Store sub-collections.

Implement the corresponding method defined in a base class.

See also:
CdbRooRoPersistentCollectionR::storeSubCollectionsAt()

Reimplemented from CdbRooRoPersistentCollectionR.

Definition at line 269 of file CdbRooRoVectorCollectionR.cc.

References CdbStatus::Error, CdbRooRoCollectionAddressR::name(), and CdbStatus::Success.


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