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

CdbNTuple< T, NCOL > Class Template Reference

An abstract base class for n-tuples. More...

#include <CdbNTuple.hh>

Inheritance diagram for CdbNTuple< T, NCOL >:

CdbNTupleBase CdbNTupleSimpleImpl< T, NCOL > List of all members.

Public Types

typedef T element_type
enum  { ncol = NCOL }

Public Member Functions

virtual ~CdbNTuple ()
 The destructor.

virtual CdbNTuple< T, NCOL > * clone () const=0
 Make a ("deep") clone of a tuple.

virtual unsigned int rows () const=0
 Get the current size (the number of rows) of n-tuple.

virtual CdbStatus set_rows (unsigned int theNewSize)=0
 Resize the current size (the number of rows) of n-tuple.

virtual CdbStatus set_rows (unsigned int theNewSize, const T &thePrototype)=0
 Resize the current size (the number of rows) of n-tuple using a prototype.

virtual CdbStatus append_row (const std::vector< T > &theRow)=0
 Append a new row.

virtual CdbStatus insert_row (const std::vector< T > &theRow, unsigned int theRowNumber)=0
 Insert a whole row of elements after the specified one.

virtual CdbStatus replace_row (const std::vector< T > &theRow, unsigned int theRowNumber)=0
 Replace a whole row of elements at specified position.

virtual CdbStatus get_row (std::vector< T > &theRow, unsigned int theRowNumber) const=0
 Get a whole row of elements.

virtual CdbStatus get_column (std::vector< T > &theColumn, unsigned int theColumnNumber) const=0
 Get a whole column by its number.

virtual CdbStatus get_column (std::vector< T > &theColumn, const std::string &theColumnName) const=0
 Get a whole column by its name.

virtual CdbStatus get_element (T &theValue, unsigned int theRowNumber, unsigned int theColumnNumber) const=0
 Read an element (specify column by its number).

virtual CdbStatus get_element (T &theValue, unsigned int theRowNumber, const std::string &theColumnName) const=0
 Read an element (specify column by its name).

virtual CdbStatus set_element (const T &theValue, unsigned int theRowNumber, unsigned int theColumnNumber)=0
 Update a single an element (specify column by its number).

virtual CdbStatus set_element (const T &theValue, unsigned int theRowNumber, const std::string &theColumnName)=0
 Update a single an element (specify column by its name).

virtual CdbStatus sort (const CdbNTupleIsLessComparator< T, NCOL > *theComparatorPtr)=0
 Sort rows using specified comparator.


Protected Member Functions

 CdbNTuple ()
 The default constructor.

 CdbNTuple (const std::string &theName, const std::string &theDescription)
 The constructor.

 CdbNTuple (const std::vector< std::string > &theCollumnNames, const std::string &theName, const std::string &theDescription)
 The constructor.

 CdbNTuple (const CdbNTuple< T, NCOL > &theOther)
 The copy constructor.

CdbNTuple< T, NCOL > & operator= (const CdbNTuple< T, NCOL > &theOther)
 The assignment operator.


Friends

class CdbCPtrBase< CdbNTuple< T, NCOL > >

Detailed Description

template<class T, unsigned int NCOL>
class CdbNTuple< T, NCOL >

An abstract base class for n-tuples.

This class provides a base interface of and common infrustructure for data stored in this n-tuple facility.

Specifically the roles of this class are:

Notes:

See also:
class CdbNTupleBase

Definition at line 43 of file CdbNTuple.hh.


Member Typedef Documentation

template<class T, unsigned int NCOL>
typedef T CdbNTuple< T, NCOL >::element_type
 

Definition at line 49 of file CdbNTuple.hh.


Member Enumeration Documentation

template<class T, unsigned int NCOL>
anonymous enum
 

Enumeration values:
ncol 

Definition at line 51 of file CdbNTuple.hh.


Constructor & Destructor Documentation

template<class T, unsigned int NCOL>
CdbNTuple< T, NCOL >::CdbNTuple   [protected]
 

The default constructor.

See also:
CdbNTuple

Definition at line 14 of file CdbNTuple.cc.

template<class T, unsigned int NCOL>
CdbNTuple< T, NCOL >::CdbNTuple const std::string &    theName,
const std::string &    theDescription
[protected]
 

The constructor.

The constructor will also assign default names to the columns. These names will be derived from relative locations of the corresponding columns in a row. For example, for an n-tuple of the width of 4 we would have:

"#0" "#1" "#2" "#3"

Definition at line 21 of file CdbNTuple.cc.

template<class T, unsigned int NCOL>
CdbNTuple< T, NCOL >::CdbNTuple const std::vector< std::string > &    theCollumnNames,
const std::string &    theName,
const std::string &    theDescription
[protected]
 

The constructor.

This constructor can be used to specify the names of columns. The vector of names passed as the first parameter can be of any length, where it would be shorter or longer than the width of n-tuple.

Notes:

  • Names passed in the vector must be unique. The default names assigned by the default descructor (see above) should not be used. A run-time assertion will happen in case of violation of this rule.

  • If the vector is shorter then elements of the vector will be used to name the first the rest of names will be filled with names derived from relative position of the corresponding column in a row. See the default constructor's description for details.

  • If the vector is longer - then the rest of the vector will be simply ignored.

Definition at line 29 of file CdbNTuple.cc.

template<class T, unsigned int NCOL>
CdbNTuple< T, NCOL >::CdbNTuple const CdbNTuple< T, NCOL > &    theOther [protected]
 

The copy constructor.

Copy the local context.

Definition at line 39 of file CdbNTuple.cc.

template<class T, unsigned int NCOL>
CdbNTuple< T, NCOL >::~CdbNTuple   [virtual]
 

The destructor.

Just to enforce the virtual destructor.

Definition at line 44 of file CdbNTuple.cc.


Member Function Documentation

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::append_row const std::vector< T > &    theRow [pure virtual]
 

Append a new row.

A vector passed as the parameter would extend n-tuple's size by one.

Notes:

  • the vector is allowed to be less or greater than the width of n-tuple.

  • if the vector is shorter then the remaining elements will be padded using the new ones created using the default constructor of the current elements type.

  • if the vector is longer - the rest of the vector will be simply ignored.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

Referenced by CdbRooNTupleConversionImpl_Helper< PERSISTENT, T, NCOL, ELEMENT_CONVERSION_RULES >::to_transient(), and CdbBdbNTupleConversionImpl_Helper< PERSISTENT, T, NCOL, ELEMENT_CONVERSION_RULES >::to_transient().

template<class T, unsigned int NCOL>
virtual CdbNTuple<T,NCOL>* CdbNTuple< T, NCOL >::clone   const [pure virtual]
 

Make a ("deep") clone of a tuple.

The method is defined here to cope with a hierarchy of possible implementations of the current n-tuple interface.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::get_column std::vector< T > &    theColumn,
const std::string &    theColumnName
const [pure virtual]
 

Get a whole column by its name.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::get_column std::vector< T > &    theColumn,
unsigned int    theColumnNumber
const [pure virtual]
 

Get a whole column by its number.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::get_element T &    theValue,
unsigned int    theRowNumber,
const std::string &    theColumnName
const [pure virtual]
 

Read an element (specify column by its name).

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::get_element T &    theValue,
unsigned int    theRowNumber,
unsigned int    theColumnNumber
const [pure virtual]
 

Read an element (specify column by its number).

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::get_row std::vector< T > &    theRow,
unsigned int    theRowNumber
const [pure virtual]
 

Get a whole row of elements.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::insert_row const std::vector< T > &    theRow,
unsigned int    theRowNumber
[pure virtual]
 

Insert a whole row of elements after the specified one.

Returns:
the method will CdbStatus::NotFound if the row does not exist.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
CdbNTuple< T, NCOL > & CdbNTuple< T, NCOL >::operator= const CdbNTuple< T, NCOL > &    theOther [protected]
 

The assignment operator.

Copy the local context.

Definition at line 49 of file CdbNTuple.cc.

References CdbNTupleBase::operator=().

Referenced by CdbNTupleSimpleImpl< T, NCOL >::operator=().

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::replace_row const std::vector< T > &    theRow,
unsigned int    theRowNumber
[pure virtual]
 

Replace a whole row of elements at specified position.

Returns:
the method will CdbStatus::NotFound if the row does not exist.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual unsigned int CdbNTuple< T, NCOL >::rows   const [pure virtual]
 

Get the current size (the number of rows) of n-tuple.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::set_element const T &    theValue,
unsigned int    theRowNumber,
const std::string &    theColumnName
[pure virtual]
 

Update a single an element (specify column by its name).

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::set_element const T &    theValue,
unsigned int    theRowNumber,
unsigned int    theColumnNumber
[pure virtual]
 

Update a single an element (specify column by its number).

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::set_rows unsigned int    theNewSize,
const T &    thePrototype
[pure virtual]
 

Resize the current size (the number of rows) of n-tuple using a prototype.

Unlike a previously defined method, this one would use a user defined value of a prototype object to fill the new elements if new rows are to be created.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::set_rows unsigned int    theNewSize [pure virtual]
 

Resize the current size (the number of rows) of n-tuple.

Notes:

  • if the new size is less than its current size then the rest of the n-tuple will be truncated and destructors for the removed elements will be called.

  • if the new size is more - then n-tuple will be extended and default constructors for new elements will be called.

Returns:
the completion status of the operation

Implemented in CdbNTupleSimpleImpl< T, NCOL >.

template<class T, unsigned int NCOL>
virtual CdbStatus CdbNTuple< T, NCOL >::sort const CdbNTupleIsLessComparator< T, NCOL > *    theComparatorPtr [pure virtual]
 

Sort rows using specified comparator.

Returns:
the method will CdbStatus::Success in case of successfull completion.

Implemented in CdbNTupleSimpleImpl< T, NCOL >.


Friends And Related Function Documentation

template<class T, unsigned int NCOL>
friend class CdbCPtrBase< CdbNTuple< T, NCOL > > [friend]
 

Definition at line 45 of file CdbNTuple.hh.


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