Gaudi Framework, version v21r9

Home   Generated: 3 May 2010

PoolDbTupleCallback Class Reference

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

#include <PoolDbTupleCallback.h>

Inheritance diagram for PoolDbTupleCallback:

Inheritance graph
[legend]
Collaboration diagram for PoolDbTupleCallback:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 PoolDbTupleCallback (DataObject *pObj)
 Initializing constructor for N-tuple callback object.
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::TypeTypeH
 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.


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 41 of file PoolDbTupleCallback.h.


Member Typedef Documentation

Reflection information.

Reimplemented from pool::DataCallBack.

Definition at line 46 of file PoolDbTupleCallback.h.


Constructor & Destructor Documentation

PoolDbTupleCallback::PoolDbTupleCallback ( DataObject pObj  ) 

Initializing constructor for N-tuple callback object.

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

Definition at line 33 of file PoolDbTupleCallback.cpp.

00034 : pool::DbDefaultDataHandler(),
00035   pool::DbObjectCallBack(0), 
00036   m_iter(0), m_cntH(pool::POOL_StorageType)
00037 {
00038   m_refCount = 1;
00039   setObject(pObj);
00040   s_count->increment();
00041 }

PoolDbTupleCallback::~PoolDbTupleCallback (  )  [virtual]

Standard Destructor.

Definition at line 44 of file PoolDbTupleCallback.cpp.

00045 {
00046   pool::deletePtr(m_iter);
00047   s_count->decrement();
00048   const pool::DbTypeInfo* typ = (const pool::DbTypeInfo*)shape();
00049   if ( typ ) typ->deleteRef();
00050 }


Member Function Documentation

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

Virtual copy.

Reimplemented from pool::DbObjectCallBack.

Definition at line 53 of file PoolDbTupleCallback.cpp.

00054 {
00055   PoolDbTupleCallback* cb = const_cast<PoolDbTupleCallback*>(this);
00056   cb->m_refCount++;
00057   return cb;
00058 }

void PoolDbTupleCallback::release (  )  [virtual]

Virtual delete.

Reimplemented from pool::DataCallBack.

Definition at line 61 of file PoolDbTupleCallback.cpp.

00062 {
00063   if ( --m_refCount <= 0 ) {
00064     delete this;
00065   }
00066 }

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

Access to the bound addresses.

Definition at line 81 of file PoolDbTupleCallback.h.

00081 {  return m_addr;     }

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

Access re-direction map.

Definition at line 83 of file PoolDbTupleCallback.h.

00083 {  return m_map;      }

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

Access to pointers of the links.

Definition at line 85 of file PoolDbTupleCallback.h.

00085 {  return m_plinks; }

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

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

Definition at line 87 of file PoolDbTupleCallback.h.

00087 {  return m_stream;   }

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

Access to select statement.

Definition at line 89 of file PoolDbTupleCallback.h.

00089 {  return m_iter;     }

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

Select new tokens according to new selection criteria.

Definition at line 102 of file PoolDbTupleCallback.cpp.

00102                                                   {
00103   pool::deletePtr(m_iter);
00104   if ( m_cntH.isValid() )  {
00105     std::string criteria = (sel && (sel->type() & ISelectStatement::STRING))
00106       ? sel->criteria() : std::string("");
00107     m_iter = new pool::DbSelect( criteria );
00108     pool::DbDatabase dbH = m_cntH.containedIn();
00109     m_iter->start(dbH, m_cntH.name());
00110   }
00111   return m_iter;
00112 }

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 69 of file PoolDbTupleCallback.cpp.

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

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 116 of file PoolDbTupleCallback.cpp.

00119 {
00120   return pool::Success;
00121 }

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 124 of file PoolDbTupleCallback.cpp.

00126 {
00127   return pool::Success;
00128 }

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 132 of file PoolDbTupleCallback.cpp.

00137 {
00138   switch(action_type)  {
00139   case GET:
00140     *data_pointer = m_addr[col_number];
00141     break;
00142   case PUT:
00143     *data_pointer = m_addr[col_number];
00144     break;
00145   }
00146   return pool::Success;
00147 }


Member Data Documentation

Vector with all addresses mapped.

Definition at line 48 of file PoolDbTupleCallback.h.

Vector to store pointers link information for address columns.

Definition at line 50 of file PoolDbTupleCallback.h.

Vector to store pointers link information for address columns.

Definition at line 52 of file PoolDbTupleCallback.h.

Redirection map between N-tuple columns and DbTypeInfo columns.

Definition at line 54 of file PoolDbTupleCallback.h.

Pointer to hold the select statement.

Definition at line 56 of file PoolDbTupleCallback.h.

Reference to streambuffer to hold blobified data.

Definition at line 58 of file PoolDbTupleCallback.h.

Pointer to pool container handle.

Definition at line 60 of file PoolDbTupleCallback.h.

Reference counter.

Definition at line 62 of file PoolDbTupleCallback.h.


The documentation for this class was generated from the following files:

Generated at Mon May 3 12:26:04 2010 for Gaudi Framework, version v21r9 by Doxygen version 1.5.6 written by Dimitri van Heesch, © 1997-2004