utility class to manage indices according to Collection Parameters More...
#include <UTIL/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.   | |
| IndexMap (const IndexMap &) | |
| no copy constructor  | |
| IndexMap & | operator= (const IndexMap &) | 
| no assignment operator  | |
| int | encode (const std::string name) | 
| encode string to index (e.g.   | |
| const std::string & | decode (int type) const | 
| decode int to string (e.g.   | |
Protected Attributes | |
| const EVENT::LCCollection * | _col | 
| const std::string | _key1 | 
| const std::string | _key2 | 
utility class to manage indices according to Collection Parameters
EXP: UNDER DEVELOPMENT!!! - Don't use this class yet
| 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
References EVENT::LCParameters::getIntVals(), EVENT::LCCollection::getParameters(), and EVENT::LCParameters::getStringVals().
| 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;
| int UTIL::IndexMap::encode | ( | const std::string | name | ) | 
encode string to index (e.g.
vertex->setAlgorithmType( imvtx.enconde( "ZvTop" ) );
 1.6.1