#include <CondFormats/IdealGeometryObjects/interface/PersistentDDDObjects.h>
Public Member Functions | |
int | operator() (const std::string &str) |
Public Attributes | |
std::vector< std::string > | pStrings |
This class also returns the index in the vector so that the caller gets back the existing string or the newly inserted index (for this unique string).
FIX: Maybe the overloading of the operator() was a bad way to go...
Definition at line 31 of file PersistentDDDObjects.h.
int PStrings::operator() | ( | const std::string & | str | ) | [inline] |
Definition at line 35 of file PersistentDDDObjects.h.
00035 { 00036 // insert to vector for now. 00037 // VERY SLOW string comparison based inserts... could be a trie someday? 00038 // std::cout << "try to insert " << str << std::endl; 00039 size_t i = 0; 00040 while ( i < pStrings.size() && pStrings[i] != str ) { 00041 // std::cout << pStrings[i] << std::endl; 00042 ++i; 00043 } 00044 if ( i < pStrings.size() && pStrings[i] == str ) { 00045 return i; 00046 } 00047 pStrings.push_back(str); 00048 return pStrings.size() - 1; 00049 /* std::vector<std::string>::const_iterator it = std::find(pStrings.begin(), pStrings.end()); */ 00050 /* if ( it == pStrings.end() ) { */ 00051 /* pStrings.push_back(str); */ 00052 /* return pStrings.back(); */ 00053 /* } */ 00054 /* return *it; */ 00055 }
std::vector<std::string> PStrings::pStrings |
Definition at line 57 of file PersistentDDDObjects.h.
Referenced by WriteOneGeometryFromXML::beginJob(), and operator()().