LCIO  02.17
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Attributes | List of all members
UTIL::IndexMap Class Reference

utility class to manage indices according to Collection Parameters More...

#include <IndexMap.h>

Public Member Functions

 IndexMap (const EVENT::LCCollection *col, const std::string &key1, const std::string &key2)
 Constructor: takes as arguments the collection where the parameters are stored and the parameter names to manage Before you loop over a collection create an IndexMap object with the keys to manage. More...
 
 IndexMap (const IndexMap &)=delete
 no copy constructor More...
 
IndexMapoperator= (const IndexMap &)=delete
 no assignment operator More...
 
 ~IndexMap ()
 
int encode (const std::string name)
 encode string to index (e.g. More...
 
const std::stringdecode (int type) const
 decode int to string (e.g. More...
 

Protected Attributes

const EVENT::LCCollection_col
 
const std::string _key1
 
const std::string _key2
 
EVENT::StringVec _strvec {}
 
EVENT::IntVec _intvec {}
 

Detailed Description

utility class to manage indices according to Collection Parameters

EXP: UNDER DEVELOPMENT!!! - Don't use this class yet

Author
engels
Version
Id:
IndexMap.h,v 1.2 2006-09-21 06:10:38 gaede Exp

Definition at line 21 of file IndexMap.h.

Constructor & Destructor Documentation

UTIL::IndexMap::IndexMap ( const EVENT::LCCollection col,
const std::string key1,
const std::string key2 
)

Constructor: takes as arguments the collection where the parameters are stored and the parameter names to manage Before you loop over a collection create an IndexMap object with the keys to manage.

Example:

LCCollection* col = evt->getCollection( "Vertices" ) ;

IndexMap imvtx( col, "AlgorithmNames", "AlgorithmTypes" ) ;

Loop over Collection....

Vertex* v = dynamic_cast<Vertex*>( col->getElementAt( i ) ) ;

cout << "vertex " << i << has been created with " << imvtx.decode( v->getAlgorithmType() ) << endl;

End Loop


For using the encoding use similar process:

IndexMap imvtx( col, "AlgorithmNames", "AlgorithmTypes" ) ;

Loop for creating vertices...

VertexImpl* v = new VertexImpl ;

v->setAlgorithmType( imvtx.encode( "ZvTop" ) );

// If the parameter "ZvTop" or even the collection parameters "AlgorithmNames" and "AlgorithmTypes" do not exist // they are automatically added and ZvTop gets a corresponding new AlgorithmType which is also automatically added

End Loop

Definition at line 12 of file IndexMap.cc.

References _col, _intvec, _strvec, EVENT::LCParameters::getIntVals(), EVENT::LCCollection::getParameters(), and EVENT::LCParameters::getStringVals().

UTIL::IndexMap::IndexMap ( const IndexMap )
delete

no copy constructor

UTIL::IndexMap::~IndexMap ( )

Definition at line 19 of file IndexMap.cc.

Member Function Documentation

const std::string & UTIL::IndexMap::decode ( int  type) const

decode int to string (e.g.

cout << "vertex has been created with " << imvtx.decode( vtx->getAlgorithmType() ) << endl;

Definition at line 42 of file IndexMap.cc.

References _intvec, _strvec, and std::vector< T >::size().

int UTIL::IndexMap::encode ( const std::string  name)

encode string to index (e.g.

vertex->setAlgorithmType( imvtx.enconde( "ZvTop" ) );

Definition at line 21 of file IndexMap.cc.

References _col, _intvec, _key1, _key2, _strvec, std::vector< T >::push_back(), and std::vector< T >::size().

IndexMap& UTIL::IndexMap::operator= ( const IndexMap )
delete

no assignment operator

Member Data Documentation

const EVENT::LCCollection* UTIL::IndexMap::_col
protected

Definition at line 75 of file IndexMap.h.

Referenced by encode(), and IndexMap().

EVENT::IntVec UTIL::IndexMap::_intvec {}
protected

Definition at line 79 of file IndexMap.h.

Referenced by decode(), encode(), and IndexMap().

const std::string UTIL::IndexMap::_key1
protected

Definition at line 76 of file IndexMap.h.

Referenced by encode().

const std::string UTIL::IndexMap::_key2
protected

Definition at line 77 of file IndexMap.h.

Referenced by encode().

EVENT::StringVec UTIL::IndexMap::_strvec {}
protected

Definition at line 78 of file IndexMap.h.

Referenced by decode(), encode(), and IndexMap().


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