| # Gaudi Framework, version v20r3
Generated: 24 Nov 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 @608::createItem | ( | MsgStream & | log,
|  | INTuple * | tuple,
|  | INTupleItem * | src,
|  | const TYP & | null |
| ) |  |  | `[inline, static]`

Type information of the item

Definition at line 30 of file CollectionCloneAlg.cpp.

    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 @608::upper | ( | const INTupleItem * | item | ) | `[inline, static]`

Definition at line 24 of file CollectionCloneAlg.cpp.

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