Gaudi Framework, version v20r2

Generated: 18 Jul 2008

CollectionCloneAlg.cpp File Reference

#include "GaudiKernel/IDataProviderSvc.h"
#include "GaudiKernel/ISelectStatement.h"
#include "GaudiKernel/IDataManagerSvc.h"
#include "GaudiKernel/GenericAddress.h"
#include "GaudiKernel/SmartDataPtr.h"
#include "GaudiKernel/AlgFactory.h"
#include "GaudiKernel/Tokenizer.h"
#include "GaudiKernel/IRegistry.h"
#include "GaudiKernel/Algorithm.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/SmartIF.h"
#include "GaudiKernel/NTuple.h"
#include <vector>

Include dependency graph for CollectionCloneAlg.cpp:

Go to the source code of this file.

Classes

class  CollectionCloneAlg
 Small algorithm, which allows to merge N-tuples in a generic way. More...

Functions

template<class T>
static long upper (const INTupleItem *item)
template<class TYP>
static StatusCode createItem (MsgStream &log, INTuple *tuple, INTupleItem *src, const TYP &null)


Function Documentation

template<class TYP>
static StatusCode @604::createItem ( MsgStream log,
INTuple tuple,
INTupleItem src,
const TYP &  null 
) [static]

Definition at line 30 of file CollectionCloneAlg.cpp.

References INTuple::add(), DataTypeInfo::CHAR, NTuple::_Matrix< TYP >::create(), NTuple::_Array< TYP >::create(), NTuple::_Item< TYP >::create(), INTupleItem::dim(), endreq(), MSG::ERROR, StatusCode::FAILURE, INTupleItem::hasIndex(), INTupleItem::indexItem(), DataTypeInfo::INT, DataTypeInfo::LONG, INTupleItem::name(), name, INTupleItem::ndim(), NTuple::_Data< TYP >::range(), DataTypeInfo::SHORT, INTupleItem::type(), DataTypeInfo::UCHAR, DataTypeInfo::UINT, DataTypeInfo::ULONG, and DataTypeInfo::USHORT.

00034   {
00035     NTuple::_Data<TYP>* source = dynamic_cast<NTuple::_Data<TYP>*>(src);
00036     TYP low                    = source->range().lower();
00037     TYP high                   = source->range().upper();
00038     long hasIdx                = source->hasIndex();
00039     long ndim                  = source->ndim();
00040     const std::string& name    = source->name();
00041     std::string idxName;
00042     long dim[4], idxLen = 0;
00043     long dim1 = 1, dim2 = 1;
00044     INTupleItem* it = 0;
00045     for ( int i = 0; i < ndim; i++ ) 
00046       dim[i] = source->dim(i);
00048     if ( hasIdx )  {
00049       const INTupleItem* index = source->indexItem();
00050       idxName = index->name();
00051       switch( index->type() )    {
00052       case DataTypeInfo::UCHAR:
00053         idxLen = upper<unsigned char>(index);
00054         break;
00055       case DataTypeInfo::USHORT:
00056         idxLen = upper<unsigned short>(index);
00057         break;
00058       case DataTypeInfo::UINT:
00059         idxLen = upper<unsigned int>(index);
00060         break;
00061       case DataTypeInfo::ULONG:
00062         idxLen = upper<unsigned long>(index);
00063         break;
00064       case DataTypeInfo::CHAR:
00065         idxLen = upper<char>(index);
00066         break;
00067       case DataTypeInfo::SHORT:
00068         idxLen = upper<short>(index);
00069         break;
00070       case DataTypeInfo::INT:
00071         idxLen = upper<int>(index);
00072         break;
00073       case DataTypeInfo::LONG:
00074         idxLen = upper<long>(index);
00075         break;
00076       default:
00077         log << MSG::ERROR << "Column " << idxName 
00078             << " is not a valid index column!" << endreq;
00079         return StatusCode::FAILURE;
00080       }
00081     }
00082     switch( ndim )  {
00083     case 0:
00084       it = NTuple::_Item<TYP>::create (tuple, name, typeid(TYP), low, high, null);
00085       break;
00086     case 1:
00087       dim1 = (hasIdx) ? idxLen : dim[0];
00088       it = NTuple::_Array<TYP>::create (tuple, 
00089                                         name, 
00090                                         typeid(TYP),
00091                                         idxName, 
00092                                         dim1, 
00093                                         low, 
00094                                         high, 
00095                                         null);
00096       break;
00097     case 2:
00098       dim1 = (hasIdx) ? idxLen : dim[0];
00099       dim2 = (hasIdx) ? dim[0] : dim[1];
00100       it = NTuple::_Matrix<TYP>::create ( tuple, 
00101                                           name, 
00102                                           typeid(TYP),
00103                                           idxName, 
00104                                           dim1, 
00105                                           dim2, 
00106                                           low, 
00107                                           high, 
00108                                           null);
00109       break;
00110     default:  
00111       return StatusCode::FAILURE;
00112     }
00113     return tuple->add(it);
00114   }

template<class T>
static long @604::upper ( const INTupleItem item  )  [static]

Definition at line 24 of file CollectionCloneAlg.cpp.

References NTuple::_Data< TYP >::range().

Referenced by Genfun::GaudiMathImplementation::NumericalDefiniteIntegral::NumericalDefiniteIntegral(), and Genfun::GaudiMathImplementation::NumericalIndefiniteIntegral::QAGP().

00024                                                                  {
00025     const NTuple::_Data<T>* it = dynamic_cast<const NTuple::_Data<T>*>(item);
00026     return long(it->range().upper());
00027   }


Generated at Fri Jul 18 12:05:43 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004