Gaudi Framework, version v20r2

Generated: 18 Jul 2008

PoolDbTupleCallback Class Reference

#include <PoolDbTupleCallback.h>

Inheritance diagram for PoolDbTupleCallback:

Inheritance graph
[legend]
Collaboration diagram for PoolDbTupleCallback:

Collaboration graph
[legend]
List of all members.

Detailed Description

Description: Specialized callback to handle N-tuple interactions while saving and lodaing POOL data.

Author:
M.Frank
Version:
1.0

Definition at line 40 of file PoolDbTupleCallback.h.

Public Member Functions

 PoolDbTupleCallback (DataObject *pObj)
 
Parameters:
svc [IN] Manager interface of conversion service

virtual ~PoolDbTupleCallback ()
 Standard Destructor.
virtual pool::DataCallBackclone () const
 Virtual copy.
virtual void release ()
 Virtual delete.
std::vector< void * > & addresses ()
 Access to the bound addresses.
const std::vector< int > & mapping ()
 Access re-direction map.
std::vector< PoolDbTokenWrap * > & links ()
 Access to pointers of the links.
pool::DbBlobstream ()
 Access to streambuffer object, for items which must be blobified.
pool::DbSelectiterator () const
 Access to select statement.
pool::DbSelectselect (ISelectStatement *sel)
 Select new tokens according to new selection criteria.
void configure (const INTuple *pTuple, const pool::DbTypeInfo *typ, const pool::DbContainer &cntH)
 Configure N-tuple callback and store properties for re-use.
virtual pool::DbStatus start (CallType action_type, void *pObj, void **context)
 Callback when a read sequence should be started.
virtual pool::DbStatus end (CallType action_type, void *context)
 Callback when a read sequence should be started.
virtual pool::DbStatus bind (CallType action_type, const pool::DbColumn *col_ident, int col_number, void *context, void **data_pointer)
 Callback to retrieve the absolute address of a column.

Private Types

typedef const ROOT::Reflex::Type & TypeH
 Reflection information.

Private Attributes

std::vector< void * > m_addr
 Vector with all addresses mapped.
std::vector< PoolDbTokenWrapm_links
 Vector to store pointers link information for address columns.
std::vector< PoolDbTokenWrap * > m_plinks
 Vector to store pointers link information for address columns.
std::vector< int > m_map
 Redirection map between N-tuple columns and DbTypeInfo columns.
pool::DbSelectm_iter
 Pointer to hold the select statement.
pool::DbBlob m_stream
 Reference to streambuffer to hold blobified data.
pool::DbContainer m_cntH
 Pointer to pool container handle.
long m_refCount
 Reference counter.


Member Typedef Documentation

typedef const ROOT::Reflex::Type& PoolDbTupleCallback::TypeH [private]

Reflection information.

Reimplemented from pool::DataCallBack.

Definition at line 45 of file PoolDbTupleCallback.h.


Constructor & Destructor Documentation

PoolDbTupleCallback::PoolDbTupleCallback ( DataObject pObj  ) 

Parameters:
svc [IN] Manager interface of conversion service

Parameters:
pObj [IN] Pointer to N-tuple object
reading [IN] Read/Write flag (Needed by base class
Returns:
Reference to object

Definition at line 24 of file PoolDbTupleCallback.cpp.

References pool::DbInstanceCount::Counter::increment(), m_refCount, s_count, and pool::DbObjectCallBack::setObject().

00025 : pool::DbDefaultDataHandler(),
00026   pool::DbObjectCallBack(0), 
00027   m_iter(0), m_cntH(pool::POOL_StorageType)
00028 {
00029   m_refCount = 1;
00030   setObject(pObj);
00031   s_count->increment();
00032 }

PoolDbTupleCallback::~PoolDbTupleCallback (  )  [virtual]

Standard Destructor.

Definition at line 35 of file PoolDbTupleCallback.cpp.

References pool::DbInstanceCount::Counter::decrement(), pool::deletePtr(), pool::DbTypeInfo::deleteRef(), m_iter, s_count, and pool::DbObjectCallBack::shape().

00036 {
00037   pool::deletePtr(m_iter);
00038   s_count->decrement();
00039   const pool::DbTypeInfo* typ = (const pool::DbTypeInfo*)shape();
00040   if ( typ ) typ->deleteRef();
00041 }


Member Function Documentation

pool::DataCallBack * PoolDbTupleCallback::clone (  )  const [virtual]

Virtual copy.

Reimplemented from pool::DbObjectCallBack.

Definition at line 44 of file PoolDbTupleCallback.cpp.

References m_refCount.

Referenced by PoolDbNTupleCnv::fillRepRefs().

00045 {
00046   PoolDbTupleCallback* cb = const_cast<PoolDbTupleCallback*>(this);
00047   cb->m_refCount++;
00048   return cb;
00049 }

void PoolDbTupleCallback::release (  )  [virtual]

Virtual delete.

Reimplemented from pool::DataCallBack.

Definition at line 52 of file PoolDbTupleCallback.cpp.

References m_refCount.

00053 {
00054   if ( --m_refCount <= 0 ) {
00055     delete this;
00056   }
00057 }

std::vector<void*>& PoolDbTupleCallback::addresses (  )  [inline]

Access to the bound addresses.

Definition at line 80 of file PoolDbTupleCallback.h.

References m_addr.

Referenced by PoolDbNTupleCnv::bindRead(), and PoolDbNTupleCnv::bindWrite().

00080 {  return m_addr;     }

const std::vector<int>& PoolDbTupleCallback::mapping (  )  [inline]

Access re-direction map.

Definition at line 82 of file PoolDbTupleCallback.h.

References m_map.

Referenced by PoolDbNTupleCnv::bindRead(), PoolDbNTupleCnv::bindWrite(), and PoolDbNTupleCnv::readData().

00082 {  return m_map;      }

std::vector<PoolDbTokenWrap*>& PoolDbTupleCallback::links (  )  [inline]

Access to pointers of the links.

Definition at line 84 of file PoolDbTupleCallback.h.

References m_plinks.

Referenced by PoolDbNTupleCnv::bindRead(), PoolDbNTupleCnv::bindWrite(), and PoolDbNTupleCnv::readData().

00084 {  return m_plinks; }

pool::DbBlob& PoolDbTupleCallback::stream (  )  [inline]

Access to streambuffer object, for items which must be blobified.

Definition at line 86 of file PoolDbTupleCallback.h.

References m_stream.

Referenced by PoolDbNTupleCnv::bindWrite(), and PoolDbNTupleCnv::readData().

00086 {  return m_stream;   }

pool::DbSelect* PoolDbTupleCallback::iterator (  )  const [inline]

Access to select statement.

Definition at line 88 of file PoolDbTupleCallback.h.

References m_iter.

Referenced by PoolDbNTupleCnv::updateObj().

00088 {  return m_iter;     }

pool::DbSelect * PoolDbTupleCallback::select ( ISelectStatement sel  ) 

Select new tokens according to new selection criteria.

Definition at line 93 of file PoolDbTupleCallback.cpp.

References pool::DbContainer::containedIn(), ISelectStatement::criteria(), pool::deletePtr(), pool::DbHandleBase< T >::isValid(), m_cntH, m_iter, pool::DbContainer::name(), pool::DbSelect::start(), ISelectStatement::STRING, and ISelectStatement::type().

Referenced by PoolDbNTupleCnv::updateObj().

00093                                                   {
00094   pool::deletePtr(m_iter);
00095   if ( m_cntH.isValid() )  {
00096     std::string criteria = (sel && (sel->type() & ISelectStatement::STRING))
00097       ? sel->criteria() : std::string("");
00098     m_iter = new pool::DbSelect( criteria );
00099     pool::DbDatabase dbH = m_cntH.containedIn();
00100     m_iter->start(dbH, m_cntH.name());
00101   }
00102   return m_iter;
00103 }

void PoolDbTupleCallback::configure ( const INTuple pTuple,
const pool::DbTypeInfo typ,
const pool::DbContainer cntH 
)

Configure N-tuple callback and store properties for re-use.

Definition at line 60 of file PoolDbTupleCallback.cpp.

References pool::DbTypeInfo::addRef(), std::vector< _Tp, _Alloc >::begin(), pool::DbTypeInfo::columns(), std::vector< _Tp, _Alloc >::end(), INTuple::items(), m_addr, m_cntH, m_links, m_map, m_plinks, m_stream, std::vector< _Tp, _Alloc >::resize(), pool::DbObjectCallBack::setShape(), and std::vector< _Tp, _Alloc >::size().

00063 {
00064   pool::DbTypeInfo::Columns::const_iterator ic;
00065   const INTuple::ItemContainer& items = pTuple->items();
00066   const pool::DbTypeInfo::Columns& cols = typ->columns();
00067   size_t colsize = cols.size();
00068   m_map.resize(items.size()+1,-1);
00069   for(size_t item_no = 0; item_no < items.size(); ++item_no ) {
00070     int icc = 0;
00071     m_map[item_no] = -1;
00072     const std::string& itm_nam = items[item_no]->name();
00073     for (ic=cols.begin(); ic != cols.end(); ++ic, ++icc )  {
00074       if ( (*ic)->name() == itm_nam )  {
00075         m_map[item_no] = icc;
00076         break;
00077       }
00078     }
00079   }
00080   m_addr.resize(colsize);
00081   m_addr[colsize-1] = &m_stream;
00082   m_links.resize(m_map.size());
00083   m_plinks.resize(m_map.size());
00084   for(size_t i = 0; i < m_map.size(); ++i )  {
00085     m_plinks[i] = &m_links[i];
00086   }
00087   m_cntH = cntH;
00088   typ->addRef();
00089   setShape(typ);
00090 }

pool::DbStatus PoolDbTupleCallback::start ( CallType  action_type,
void *  pObj,
void **  context 
) [virtual]

Callback when a read sequence should be started.

Reimplemented from pool::DbObjectCallBack.

Definition at line 107 of file PoolDbTupleCallback.cpp.

References pool::Success.

00110 {
00111   return pool::Success;
00112 }

pool::DbStatus PoolDbTupleCallback::end ( CallType  action_type,
void *  context 
) [virtual]

Callback when a read sequence should be started.

Reimplemented from pool::DbObjectCallBack.

Definition at line 115 of file PoolDbTupleCallback.cpp.

References pool::Success.

00117 {
00118   return pool::Success;
00119 }

pool::DbStatus PoolDbTupleCallback::bind ( CallType  action_type,
const pool::DbColumn col_ident,
int  col_number,
void *  context,
void **  data_pointer 
) [virtual]

Callback to retrieve the absolute address of a column.

Reimplemented from pool::DbObjectCallBack.

Definition at line 123 of file PoolDbTupleCallback.cpp.

References pool::DataCallBack::GET, m_addr, pool::DataCallBack::PUT, and pool::Success.

00128 {
00129   switch(action_type)  {
00130   case GET:
00131     *data_pointer = m_addr[col_number];
00132     break;
00133   case PUT:
00134     *data_pointer = m_addr[col_number];
00135     break;
00136   }
00137   return pool::Success;
00138 }


Member Data Documentation

std::vector< void* > PoolDbTupleCallback::m_addr [private]

Vector with all addresses mapped.

Definition at line 47 of file PoolDbTupleCallback.h.

Referenced by addresses(), bind(), and configure().

std::vector<PoolDbTokenWrap> PoolDbTupleCallback::m_links [private]

Vector to store pointers link information for address columns.

Definition at line 49 of file PoolDbTupleCallback.h.

Referenced by configure().

std::vector<PoolDbTokenWrap*> PoolDbTupleCallback::m_plinks [private]

Vector to store pointers link information for address columns.

Definition at line 51 of file PoolDbTupleCallback.h.

Referenced by configure(), and links().

std::vector<int> PoolDbTupleCallback::m_map [private]

Redirection map between N-tuple columns and DbTypeInfo columns.

Definition at line 53 of file PoolDbTupleCallback.h.

Referenced by configure(), and mapping().

pool::DbSelect* PoolDbTupleCallback::m_iter [private]

Pointer to hold the select statement.

Definition at line 55 of file PoolDbTupleCallback.h.

Referenced by iterator(), select(), and ~PoolDbTupleCallback().

pool::DbBlob PoolDbTupleCallback::m_stream [private]

Reference to streambuffer to hold blobified data.

Definition at line 57 of file PoolDbTupleCallback.h.

Referenced by configure(), and stream().

pool::DbContainer PoolDbTupleCallback::m_cntH [private]

Pointer to pool container handle.

Definition at line 59 of file PoolDbTupleCallback.h.

Referenced by configure(), and select().

long PoolDbTupleCallback::m_refCount [private]

Reference counter.

Definition at line 61 of file PoolDbTupleCallback.h.

Referenced by clone(), PoolDbTupleCallback(), and release().


The documentation for this class was generated from the following files:
Generated at Fri Jul 18 12:09:00 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004