| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# HbookCnv::HCWNTupleCnv Class Reference

`#include <HCWNTupleCnv.h>`

Inheritance diagram for HbookCnv::HCWNTupleCnv:

[legend]
Collaboration diagram for HbookCnv::HCWNTupleCnv:

[legend]
List of all members.

## Detailed Description

NTuple converter class definition.

Description: Definition of the converter for Ntuples using HBOOK

Dependencies:

- Base class: Gaudi/Kernel/Converter.h

History :

          +---------+----------------------------------------------+--------+
          |    Date |                 Comment                      | Who    |
          +---------+----------------------------------------------+--------+
          | 21/10/99| Initial version.                             | MF     |
          +---------+----------------------------------------------+--------+

Author: M.Frank Version: 1.0

Definition at line 48 of file HCWNTupleCnv.h.

## Public Member Functions
| HCWNTupleCnv (ISvcLocator *svc)
| Standard constructor.
virtual | ~HCWNTupleCnv ()
| Standard destructor.
## Static Public Member Functions
static const CLID & | classID ()
| Inquire class type.
## Protected Member Functions
virtual StatusCode | load (long id, INTuple *&refpObject)
| Create the transient representation of an object.
virtual StatusCode | book (long idh, const std::string &location, INTuple *pObject)
| Book the N tuple.
virtual StatusCode | declare (long idh, INTuple *pObject)
| Declare the N tuple.
virtual StatusCode | writeData (long idh, INTuple *pObject)
| Write N tuple data.
virtual StatusCode | readData (long idh, INTuple *pObject, long ievt)
| Read N tuple data.
template<class T>
size_t | saveItem (char *target, const T *src, size_t len)
template<class T>
size_t | loadItem (char *src, T *tar, size_t len)
size_t | loadItem (char *src, bool *tar, size_t len)
size_t | loadItem (char *src, float *target, size_t len)
size_t | loadItem (char *src, double *target, size_t len)
size_t | loadItem (char *src, long *target, size_t len)
size_t | loadItem (char *src, unsigned long *target, size_t len)
size_t | saveItem (char *target, float *src, size_t len)
size_t | saveItem (char *target, double *src, size_t len)
size_t | saveItem (char *target, long *src, size_t len)
size_t | saveItem (char *target, unsigned long *src, size_t len)
## Friends
class | CnvFactory< HCWNTupleCnv >
| Creator needs access to constructor/destructor.

## Constructor & Destructor Documentation

HbookCnv::HCWNTupleCnv::HCWNTupleCnv | ( | ISvcLocator * | svc | ) | `[inline]`

Standard constructor.

Definition at line 59 of file HCWNTupleCnv.h.

    00059                                      : HNTupleCnv(svc, classID())    {
    00060     }

virtual HbookCnv::HCWNTupleCnv::~HCWNTupleCnv | ( |  | ) | `[inline, virtual]`

Standard destructor.

Definition at line 62 of file HCWNTupleCnv.h.

    00062                               {
    00063     }

## Member Function Documentation

static const CLID& HbookCnv::HCWNTupleCnv::classID | ( |  | ) | `[inline, static]`

Inquire class type.

Definition at line 55 of file HCWNTupleCnv.h.

References CLID_ColumnWiseTuple.

    00055                                     {
    00056       return CLID_ColumnWiseTuple;
    00057     }

StatusCode HbookCnv::HCWNTupleCnv::load | ( | long | id,
|  | INTuple *& | refpObject |
| ) |  |  | `[protected, virtual]`

Create the transient representation of an object.

Implements HbookCnv::HNTupleCnv.

Definition at line 342 of file HCWNTupleCnv.cpp.

References INTuple::add(), INTuple::buffer(), CLID_ColumnWiseTuple, INTupleSvc::create(), HbookCnv::createNTupleItem(), CWNT_INFO(), MSG::DEBUG, endreq(), MSG::FATAL, HBNAME(), StatusCode::isSuccess(), HbookCnv::HNTupleCnv::m_ntupleSvc, Converter::msgSvc(), std::vector< _Tp, _Alloc >::push_back(), INTuple::setBuffer(), std::vector< _Tp, _Alloc >::size(), and StatusCode::SUCCESS.

    00342                                                                       {
    00343
    00344   MsgStream log(msgSvc(), "HCWNTupleCnv");
    00345
    00346   NTUPLEINFO tags;
    00347
    00348   memset(&tags,0,sizeof(tags));
    00349
    00350   std::vector<std::string> blkname;
    00351   std::vector<unsigned long> bufpos;
    00352   unsigned long totsize = 0;
    00353
    00354   tags.id = idh;
    00355   StatusCode status = ::CWNT_INFO(tags);
    00356
    00357   if ( status.isSuccess() )     {
    00358     NTuple::Tuple* pObj = 0;
    00359     status = m_ntupleSvc->create(CLID_ColumnWiseTuple, tags.title, pObj);
    00360     INTuple* ntup = dynamic_cast<INTuple*>(pObj);
    00361     try {
    00362       if ( status.isSuccess() && 0 != ntup )   {
    00363         long total_size = 0;
    00364         for ( long size = 0, i = 0; i < tags.numVar; i++, size=0 )   {
    00365           INTupleItem* item = 0;
    00366           switch( tags.type[i] )    {
    00367           case 'L':
    00368             item = createNTupleItem(tags, i, ntup, NTuple::Range<bool>::min(), NTuple::Range<bool>::max(), size);
    00369           break;
    00370           case 'I':
    00371             // if ( tags.size[i] <= sizeof(unsigned char)*CHAR_BIT )
    00372             //   item = createNTupleItem(tags, i, ntup, NTuple::Range<char>::min(), NTuple::Range<char>::max(), size);
    00373             // else if ( tags.size[i] <= sizeof(unsigned short)*CHAR_BIT )
    00374             //   item = createNTupleItem(tags, i, ntup, NTuple::Range<short>::min(), NTuple::Range<short>::max(), size);
    00375             // else if ( tags.size[i] <= sizeof(unsigned int)*CHAR_BIT )
    00376             //   item = createNTupleItem(tags, i, ntup, NTuple::Range<int>::min(), NTuple::Range<int>::max(), size);
    00377             // else
    00378             item = createNTupleItem(tags, i, ntup, NTuple::Range<long>::min(), NTuple::Range<long>::max(), size);
    00379             break;
    00380           case 'U':
    00381             // if ( tags.size[i] <= sizeof(unsigned char)*CHAR_BIT )
    00382             //   item = createNTupleItem(tags, i, ntup, NTuple::Range<unsigned char>::min(), NTuple::Range<unsigned char>::max(), size);
    00383             // else if ( tags.size[i] <= sizeof(unsigned short)*CHAR_BIT )
    00384             //   item = createNTupleItem(tags, i, ntup, NTuple::Range<unsigned short>::min(), NTuple::Range<unsigned short>::max(), size);
    00385             // else if ( tags.size[i] <= sizeof(unsigned int)*CHAR_BIT )
    00386             //   item = createNTupleItem(tags, i, ntup, NTuple::Range<unsigned int>::min(), NTuple::Range<unsigned int>::max(), size);
    00387             // else
    00388             item = createNTupleItem(tags, i, ntup, NTuple::Range<unsigned long>::min(), NTuple::Range<unsigned long>::max(), size);
    00389             break;
    00390           case 'R':
    00391             if ( (size_t)tags.size[i] <= sizeof(float)*CHAR_BIT )
    00392               item = createNTupleItem(tags, i, ntup, NTuple::Range<float>::min(), NTuple::Range<float>::max(), size);
    00393             else
    00394               item = createNTupleItem(tags, i, ntup, NTuple::Range<double>::min(), NTuple::Range<double>::max(), size);
    00395             break;
    00396           default:
    00397             break;
    00398     }
    00399     if ( item ) {
    00400       long ii;
    00401       ntup->add(item);
    00402       total_size += size;
    00403       log << MSG::DEBUG << "Create Var[" << i << "]: "
    00404           << item->typeName() << "[";
    00405       for ( ii = 0; ii < item->ndim()-1; ii++ )    {
    00406         log << item->dim(ii) << ", ";
    00407       }
    00408       if ( item->hasIndex() ) log << item->index() << "]";
    00409       else                    log << item->dim(item->ndim()) << "]";
    00410     } else {
    00411       log << MSG::FATAL << "Cannot deduce type for Var[" << i << "]: ";
    00412     }
    00413
    00414
    00415     // add sizes up
    00416     blkname.push_back(tags.block[i]);
    00417     bufpos.push_back(totsize);
    00418     totsize += size;
    00419
    00420
    00421     log << " Name:"  << tags.name[i]
    00422         << " Block: " << tags.block[i]
    00423         << " Index:<" << tags.index[i] <<">"
    00424         << " Dim:"   << tags.dim[i]
    00425         << " Typ:"   << tags.type[i]
    00426         << " Size:"  << tags.size[i]
    00427         << " [";
    00428     if ( tags.type[i] == 'I' || tags.type[i] == 'U' || tags.type[i] == 'L' )
    00429       log << tags.irange[i][0] << "," << tags.irange[i][1];
    00430     else if ( tags.type[i] == 'R' )
    00431       log << tags.frange[i][0] << "," << tags.frange[i][1];
    00432     log << "]" << endreq;
    00433   }
    00434   log << MSG::DEBUG << "Total buffer size of NTuple: " << total_size << " Bytes." << endreq;
    00435
    00436   ntup->setBuffer(new char[total_size]);
    00437   long ievt = 0;
    00438
    00439   ::HBNAME(idh," ", &ievt, "$CLEAR");
    00440
    00441   log << MSG::DEBUG << "Loading block " << blkname[0] << " at offset "
    00442       << bufpos[0] << endreq;
    00443
    00444   ::HBNAME(idh,blkname[0].c_str(),ntup->buffer(),"$SET");
    00445
    00446   std::string oldblock = blkname[0];
    00447   for (unsigned int ib=1; ib<bufpos.size(); ++ib) {
    00448     if (blkname[ib] != oldblock) {
    00449       log << MSG::DEBUG << "Loading block " << blkname[ib] << " at offset "
    00450           << bufpos[ib] << endreq;
    00451       ::HBNAME(idh,blkname[ib].c_str(),(ntup->buffer())+bufpos[ib],"$SET");
    00452       oldblock = blkname[ib];
    00453     }
    00454   }
    00455
    00456   refpObject = ntup;
    00457   return StatusCode::SUCCESS;
    00458       }
    00459     }
    00460     catch (...) {
    00461     }
    00462   }
    00463   log << MSG::ERROR << "Error loading N tuple ID:" << idh << endreq;
    00464   return StatusCode::FAILURE;
    00465 }

StatusCode HbookCnv::HCWNTupleCnv::book | ( | long | idh,
|  | const std::string & | location,
|  | INTuple * | pObject |
| ) |  |  | `[protected, virtual]`

Book the N tuple.

Implements HbookCnv::HNTupleCnv.

Definition at line 198 of file HCWNTupleCnv.cpp.

References CWNT_BOOK(), std::basic_string< _CharT, _Traits, _Alloc >::data(), MSG::DEBUG, declare(), endreq(), MSG::ERROR, StatusCode::FAILURE, HEXIST, HPRINT, MSG::INFO, MsgStream::isActive(), std::basic_string< _CharT, _Traits, _Alloc >::length(), Converter::msgSvc(), StatusCode::SUCCESS, and INTuple::title().

    00198                                                                                   {
    00199   MsgStream log(msgSvc(), "HCWNTupleCnv");
    00200   //  log << MSG::DEBUG << "in HCWNTupleCnv::book" << endreq;
    00201   if ( !::HEXIST( idh ) )   {
    00202     NTUPLEINFO tags;
    00203     memset(&tags,0, sizeof(tags));
    00204     tags.id = idh;
    00205     strncpy(tags.rzdir, loc.data()+2, loc.length()-2);
    00206     strncpy(tags.title, nt->title().data(), nt->title().length());
    00207     StatusCode status = ::CWNT_BOOK(tags);
    00208     if ( status.isSuccess() )   {
    00209       status = declare(idh, nt);
    00210       if ( status.isSuccess() )  {
    00211         log << MSG::INFO << "Booked Column wise HBOOK N tuple with ID:" << idh
    00212             << " \"" << nt->title()
    00213             << "\" in directory <" << loc << ">" << endreq;
    00214         log << MSG::DEBUG;
    00215         if ( log.isActive() ) ::HPRINT (idh);
    00216         return StatusCode::SUCCESS;
    00217       }
    00218     }
    00219     log << MSG::ERROR << "Column wise HBOOK N tuple " << idh
    00220         << "\"" << nt->title()
    00221         << "\" cannot be booked"
    00222         << " in directory <" << loc << ">" << endreq;
    00223     return status;
    00224   }
    00225   log << MSG::ERROR << "Column wise HBOOK N tuple " << idh << "\"" << nt->title()
    00226       << "\" already exists in directory <" << loc << ">" << endreq;
    00227   return StatusCode::FAILURE;
    00228 }

StatusCode HbookCnv::HCWNTupleCnv::declare | ( | long | idh,
|  | INTuple * | pObject |
| ) |  |  | `[protected, virtual]`

Declare the N tuple.

Loop over items, add them to ntuple blocks

Definition at line 91 of file HCWNTupleCnv.cpp.

References analyzeItem(), std::vector< _Tp, _Alloc >::begin(), DataTypeInfo::BOOL, std::basic_string< _CharT, _Traits, _Alloc >::c_str(), DataTypeInfo::CHAR, MSG::DEBUG, DataTypeInfo::DOUBLE, std::vector< _Tp, _Alloc >::end(), endreq(), StatusCode::FAILURE, DataTypeInfo::FLOAT, HBNAME(), DataTypeInfo::INT, INTuple::items(), DataTypeInfo::LONG, std::make_pair(), Converter::msgSvc(), std::vector< _Tp, _Alloc >::push_back(), INTuple::setBuffer(), DataTypeInfo::SHORT, std::vector< _Tp, _Alloc >::size(), StatusCode::SUCCESS, DataTypeInfo::UCHAR, DataTypeInfo::UINT, DataTypeInfo::ULONG, and DataTypeInfo::USHORT.

Referenced by book().

    00091                                                                {
    00092   MsgStream log(msgSvc(), "HCWNTupleCnv");
    00093
    00094   const INTuple::ItemContainer& cols = nt->items();
    00095   //  char text[64];
    00096   std::string desc = "";
    00097   std::string block_name,var_name;
    00098   long size = 0;
    00099   size_t cnt =0;
    00100
    00101   long cursize, oldsize = 0;
    00102   std::vector<long> item_size;
    00103   std::vector<std::pair<std::string,std::string> > item_name;
    00104
    00105   try   {
    00106     for (INTuple::ItemContainer::const_iterator i = cols.begin(); i != cols.end(); i++ )   {
    00107       std::string item = "";
    00108       switch( (*i)->type() )   {
    00109       case DataTypeInfo::BOOL:              // bool
    00110         analyzeItem('L', dynamic_cast<const NTuple::_Data<bool>*>(*i),item,
    00111                     block_name,size);
    00112         break;
    00113       case DataTypeInfo::CHAR:              // char
    00114         analyzeItem('I', dynamic_cast<const NTuple::_Data<char>*>(*i),item,
    00115                     block_name,size);
    00116         break;
    00117       case DataTypeInfo::INT:               // int
    00118         analyzeItem('I', dynamic_cast<const NTuple::_Data<int>*>(*i),item,
    00119                     block_name,size);
    00120         break;
    00121       case DataTypeInfo::SHORT:             // short
    00122         analyzeItem('I', dynamic_cast<const NTuple::_Data<short>*>(*i),item,
    00123                     block_name,size);
    00124         break;
    00125       case DataTypeInfo::LONG:              // long
    00126         analyzeItem('I', dynamic_cast<const NTuple::_Data<long>*>(*i),item,
    00127                     block_name,size);
    00128         break;
    00129       case DataTypeInfo::UCHAR:             // unsigned char
    00130         analyzeItem('U', dynamic_cast<const NTuple::_Data<unsigned char>*>(*i),
    00131                     item,block_name,size);
    00132         break;
    00133       case DataTypeInfo::USHORT:            // unsigned short
    00134         analyzeItem('U', dynamic_cast<const NTuple::_Data<unsigned short>*>(*i),
    00135                     item,block_name,size);
    00136         break;
    00137       case DataTypeInfo::UINT:              // unsigned int
    00138         analyzeItem('U', dynamic_cast<const NTuple::_Data<unsigned int>*>(*i),
    00139                     item,block_name,size);
    00140         break;
    00141       case DataTypeInfo::ULONG:             // unsigned long
    00142         analyzeItem('U', dynamic_cast<const NTuple::_Data<unsigned long>*>(*i),
    00143                     item,block_name,size);
    00144         break;
    00145       case DataTypeInfo::DOUBLE:            // double
    00146         analyzeItem('R', dynamic_cast<const NTuple::_Data<double>*>(*i),item,
    00147                     block_name,size);
    00148         break;
    00149       case DataTypeInfo::FLOAT:             // float
    00150         analyzeItem('R', dynamic_cast<const NTuple::_Data<float>*>(*i),item,
    00151                     block_name,size);
    00152       default:
    00153         break;
    00154       }
    00155       desc += item;
    00156       if ( ++cnt < cols.size() )   {
    00157         desc += ", ";
    00158       }
    00159
    00160       item_name.push_back(std::make_pair(block_name,item));
    00161       cursize = size - oldsize;
    00162       item_size.push_back(size-cursize);
    00163       oldsize = size;
    00164     }
    00165     char* buff = new char[size];
    00166     nt->setBuffer(buff);
    00167
    00168     //    const unsigned int MAX_BLOCK_NAME = 1300;
    00169     std::string block_desc = "";
    00170     char *buf_pos = buff;
    00171
    00172     std::vector<std::pair<std::string,std::string> >::const_iterator itr,end;
    00173     end = item_name.end();
    00174     int pos = 0;
    00175
    00177
    00178     for (itr=item_name.begin(); itr!=end; ++itr) {
    00179       buf_pos = buff + item_size[pos++];
    00180       block_desc = itr->second;
    00181
    00182       ::HBNAME(idh, itr->first.c_str(), buf_pos, block_desc.c_str());
    00183
    00184       log << MSG::DEBUG << "CWNT " << idh << ": added "
    00185           << itr->first << " : " << block_desc << endreq;
    00186
    00187     }
    00188
    00189     return StatusCode::SUCCESS;
    00190   }
    00191   catch (...)   {
    00192   }
    00193   return StatusCode::FAILURE;
    00194 }

StatusCode HbookCnv::HCWNTupleCnv::writeData | ( | long | idh,
|  | INTuple * | pObject |
| ) |  |  | `[protected, virtual]`

Write N tuple data.

Implements HbookCnv::HNTupleCnv.

Definition at line 232 of file HCWNTupleCnv.cpp.

References std::vector< _Tp, _Alloc >::begin(), DataTypeInfo::BOOL, INTuple::buffer(), DataTypeInfo::CHAR, DataTypeInfo::DOUBLE, std::vector< _Tp, _Alloc >::end(), DataTypeInfo::FLOAT, HFNT, DataTypeInfo::INT, INTuple::items(), DataTypeInfo::LONG, Converter::msgSvc(), INTuple::reset(), saveItem(), DataTypeInfo::SHORT, StatusCode::SUCCESS, DataTypeInfo::UCHAR, DataTypeInfo::UINT, DataTypeInfo::ULONG, and DataTypeInfo::USHORT.

    00232                                                                   {
    00233   const INTuple::ItemContainer& cols = nt->items();
    00234   MsgStream log(msgSvc(), "HCWNTupleCnv");
    00235   //  log << MSG::DEBUG << "in HCWNTupleCnv::writeData" << endreq;
    00236   char * tar = nt->buffer();
    00237   for (INTuple::ItemContainer::const_iterator i = cols.begin(); i != cols.end(); i++ )   {
    00238     switch( (*i)->type() )   {
    00239     case DataTypeInfo::BOOL:              // bool
    00240       tar += saveItem(tar, (bool*)(*i)->buffer(),   (*i)->length());
    00241       break;
    00242     case DataTypeInfo::CHAR:              // char
    00243       tar += saveItem(tar, (char*)(*i)->buffer(),   (*i)->length());
    00244       break;
    00245     case DataTypeInfo::SHORT:             // short
    00246       tar += saveItem(tar, (short*)(*i)->buffer(),  (*i)->length());
    00247       break;
    00248     case DataTypeInfo::INT:             // short
    00249       tar += saveItem(tar, (int*)(*i)->buffer(),    (*i)->length());
    00250       break;
    00251     case DataTypeInfo::LONG:             // short
    00252       tar += saveItem(tar, (long*)(*i)->buffer(),   (*i)->length());
    00253       break;
    00254     case DataTypeInfo::UCHAR:             // unsigned char
    00255       tar += saveItem(tar, (unsigned char*)(*i)->buffer(),  (*i)->length());
    00256       break;
    00257     case DataTypeInfo::USHORT:            // unsigned short
    00258       tar += saveItem(tar, (unsigned short*)(*i)->buffer(), (*i)->length());
    00259       break;
    00260     case DataTypeInfo::UINT:            // unsigned short
    00261       tar += saveItem(tar, (unsigned int*)(*i)->buffer(),   (*i)->length());
    00262       break;
    00263     case DataTypeInfo::ULONG:            // unsigned short
    00264       tar += saveItem(tar, (unsigned long*)(*i)->buffer(),  (*i)->length());
    00265       break;
    00266     case DataTypeInfo::FLOAT:            // unsigned short
    00267       tar += saveItem(tar, (float*)(*i)->buffer(), (*i)->length());
    00268       break;
    00269     case DataTypeInfo::DOUBLE:            // unsigned short
    00270       tar += saveItem(tar, (double*)(*i)->buffer(), (*i)->length());
    00271       break;
    00272     default:
    00273       break;
    00274     }
    00275   }
    00276   ::HFNT ( idh );
    00277   nt->reset();
    00278   return StatusCode::SUCCESS;
    00279 }

StatusCode HbookCnv::HCWNTupleCnv::readData | ( | long | idh,
|  | INTuple * | pObject,
|  | long | ievt |
| ) |  |  | `[protected, virtual]`

Read N tuple data.

Implements HbookCnv::HNTupleCnv.

Definition at line 283 of file HCWNTupleCnv.cpp.

References std::vector< _Tp, _Alloc >::begin(), DataTypeInfo::BOOL, INTuple::buffer(), DataTypeInfo::CHAR, DataTypeInfo::DOUBLE, std::vector< _Tp, _Alloc >::end(), endreq(), MSG::ERROR, StatusCode::FAILURE, DataTypeInfo::FLOAT, HGNT, DataTypeInfo::INT, INTuple::items(), loadItem(), DataTypeInfo::LONG, Converter::msgSvc(), DataTypeInfo::SHORT, StatusCode::SUCCESS, INTuple::title(), DataTypeInfo::UCHAR, DataTypeInfo::UINT, DataTypeInfo::ULONG, and DataTypeInfo::USHORT.

    00283                                                                                {
    00284   MsgStream log(msgSvc(), "HCWNTupleCnv");
    00285
    00286   long istat = 0;
    00287   ievt++;
    00288   ::HGNT(idh, ievt, istat);
    00289   if ( istat == 0 )   {
    00290     INTuple::ItemContainer& cols = ntup->items();
    00291     char * src = ntup->buffer();
    00292     for (INTuple::ItemContainer::iterator i = cols.begin(); i != cols.end(); i++ )   {
    00293       switch( (*i)->type() )   {
    00294       case DataTypeInfo::BOOL:              // bool
    00295         src += loadItem(src, (bool*)(*i)->buffer(), (*i)->length());
    00296         break;
    00297       case DataTypeInfo::CHAR:              // char
    00298         src += loadItem(src, (char*)(*i)->buffer(), (*i)->length());
    00299         break;
    00300       case DataTypeInfo::SHORT:             // short
    00301         src += loadItem(src, (short*)(*i)->buffer(), (*i)->length());
    00302         break;
    00303       case DataTypeInfo::INT:             // short
    00304         src += loadItem(src, (int*)(*i)->buffer(), (*i)->length());
    00305         break;
    00306       case DataTypeInfo::LONG:             // short
    00307         src += loadItem(src, (long*)(*i)->buffer(), (*i)->length());
    00308         break;
    00309       case DataTypeInfo::UCHAR:             // unsigned char
    00310         src += loadItem(src, (unsigned char*)(*i)->buffer(), (*i)->length());
    00311         break;
    00312       case DataTypeInfo::USHORT:            // unsigned short
    00313         src += loadItem(src, (unsigned short*)(*i)->buffer(), (*i)->length());
    00314         break;
    00315       case DataTypeInfo::UINT:            // unsigned short
    00316         src += loadItem(src, (unsigned int*)(*i)->buffer(), (*i)->length());
    00317         break;
    00318       case DataTypeInfo::ULONG:            // unsigned short
    00319         src += loadItem(src, (unsigned long*)(*i)->buffer(), (*i)->length());
    00320         break;
    00321       case DataTypeInfo::FLOAT:            // unsigned short
    00322         src += loadItem(src, (float*)(*i)->buffer(), (*i)->length());
    00323         break;
    00324       case DataTypeInfo::DOUBLE:            // unsigned short
    00325         src += loadItem(src, (double*)(*i)->buffer(), (*i)->length());
    00326         break;
    00327       default:
    00328         break;
    00329       }
    00330     }
    00331     return StatusCode::SUCCESS;
    00332   }
    00333
    00334   log << MSG::ERROR << "Error reading data from N tuple ID:" << idh
    00335       << " " << ntup->title()
    00336       << endreq;
    00337   return StatusCode::FAILURE;
    00338 }

template<class T>

size_t HbookCnv::HCWNTupleCnv::saveItem | ( | char * | target,
|  | const T * | src,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 76 of file HCWNTupleCnv.h.

Referenced by writeData().

    00076                                                               {
    00077       long* tar = (long*)target;
    00078       for ( size_t i = 0; i < len; i++ )   {
    00079         *(tar++) = long( *(src++));
    00080       }
    00081       return sizeof(long)*len;
    00082     }

template<class T>

size_t HbookCnv::HCWNTupleCnv::loadItem | ( | char * | src,
|  | T * | tar,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 84 of file HCWNTupleCnv.h.

References Gaudi::Units::s.

Referenced by readData().

    00084                                                      {
    00085       long* s = (long*)src;
    00086       for ( size_t i = 0; i < len; i++ )   {
    00087         *(tar++) = T( *(s++));
    00088       }
    00089       return sizeof(long)*len;
    00090     }

size_t HbookCnv::HCWNTupleCnv::loadItem | ( | char * | src,
|  | bool * | tar,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 91 of file HCWNTupleCnv.h.

References Gaudi::Units::s.

    00091                                                         {
    00092       long* s = (long*)src;
    00093       for ( size_t i = 0; i < len; i++ )   {
    00094         *(tar++) = (*(s++)) ? true : false;
    00095       }
    00096       return sizeof(long)*len;
    00097     }

size_t HbookCnv::HCWNTupleCnv::loadItem | ( | char * | src,
|  | float * | target,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 98 of file HCWNTupleCnv.h.

    00098                                                             {
    00099       memcpy(target, src, sizeof(float)*len);
    00100       return sizeof(float)*len;
    00101     }

size_t HbookCnv::HCWNTupleCnv::loadItem | ( | char * | src,
|  | double * | target,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 102 of file HCWNTupleCnv.h.

    00102                                                              {
    00103       memcpy(target, src, sizeof(double)*len);
    00104       return sizeof(double)*len;
    00105     }

size_t HbookCnv::HCWNTupleCnv::loadItem | ( | char * | src,
|  | long * | target,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 106 of file HCWNTupleCnv.h.

    00106                                                            {
    00107       memcpy(target, src, sizeof(long)*len);
    00108       return sizeof(long)*len;
    00109     }

size_t HbookCnv::HCWNTupleCnv::loadItem | ( | char * | src,
|  | unsigned long * | target,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 110 of file HCWNTupleCnv.h.

    00110                                                                     {
    00111       memcpy(target, src, sizeof(unsigned long)*len);
    00112       return sizeof(unsigned long)*len;
    00113     }

size_t HbookCnv::HCWNTupleCnv::saveItem | ( | char * | target,
|  | float * | src,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 115 of file HCWNTupleCnv.h.

    00115                                                             {
    00116       memcpy(target, src, sizeof(float)*len);
    00117       return sizeof(float)*len;
    00118     }

size_t HbookCnv::HCWNTupleCnv::saveItem | ( | char * | target,
|  | double * | src,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 119 of file HCWNTupleCnv.h.

    00119                                                              {
    00120       memcpy(target, src, sizeof(double)*len);
    00121       return sizeof(double)*len;
    00122     }

size_t HbookCnv::HCWNTupleCnv::saveItem | ( | char * | target,
|  | long * | src,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 123 of file HCWNTupleCnv.h.

    00123                                                            {
    00124       memcpy(target, src, sizeof(long)*len);
    00125       return sizeof(long)*len;
    00126     }

size_t HbookCnv::HCWNTupleCnv::saveItem | ( | char * | target,
|  | unsigned long * | src,
|  | size_t | len |
| ) |  |  | `[inline, protected]`

Definition at line 127 of file HCWNTupleCnv.h.

    00127                                                                     {
    00128       memcpy(target, src, sizeof(unsigned long)*len);
    00129       return sizeof(unsigned long)*len;
    00130     }

## Friends And Related Function Documentation

friend class CnvFactory< HCWNTupleCnv >`[friend]`

Creator needs access to constructor/destructor.

Definition at line 51 of file HCWNTupleCnv.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/HbookCnv/v14r13/src/HCWNTupleCnv.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/HbookCnv/v14r13/src/HCWNTupleCnv.cpp