#include <interface/PixelAliasList.h>
Public Member Functions | |
std::string | alias (unsigned int i) |
std::vector< pathAliasPair > | getConfigAliases (std::string path) |
unsigned int | getVersion (std::string path, std::string alias) |
std::vector< std::string > | getVersionAliases (std::string path) |
pathVersionAliasMmap | getVersionData () |
pathVersionAliasMmap | getVersionData (std::string koc) |
void | insertAlias (PixelConfigAlias &anAlias) |
void | insertVersionAlias (PixelVersionAlias &anAlias) |
unsigned int | key (unsigned int i) |
unsigned int | nAliases () |
std::string | name (unsigned int i) |
unsigned int | nVersionAliases () |
PixelConfigAlias | operator[] (unsigned int i) |
std::string | path (unsigned int i) |
void | readfile (std::string filename) |
void | updateConfigAlias (std::string path, unsigned int version, std::string alias, PixelConfigList &config) |
unsigned int | version (unsigned int i) |
PixelConfigAlias * | versionAliases (std::string aliasName) |
void | writefile () |
Private Attributes | |
pathAliasMmap | aliasMmap |
std::vector< PixelConfigAlias > | pixelConfigAliases_ |
std::vector< PixelVersionAlias > | pixelVersionAliases_ |
pathVersionAliasMmap | versionMmap |
A longer explanation will be placed here later
Definition at line 25 of file PixelAliasList.h.
std::string pos::PixelAliasList::alias | ( | unsigned int | i | ) | [inline] |
Definition at line 286 of file PixelAliasList.h.
References i, and pixelVersionAliases_.
Referenced by getVersion(), getVersionAliases(), insertVersionAlias(), and readfile().
{ return pixelVersionAliases_[i].alias() ;}
std::vector<pathAliasPair> pos::PixelAliasList::getConfigAliases | ( | std::string | path | ) | [inline] |
Definition at line 267 of file PixelAliasList.h.
References aliasMmap.
Referenced by pos::PixelConfigFile::getConfigAliases().
unsigned int pos::PixelAliasList::getVersion | ( | std::string | path, |
std::string | alias | ||
) | [inline] |
Definition at line 238 of file PixelAliasList.h.
References alias(), i, path(), and pixelVersionAliases_.
Referenced by pos::PixelConfigFile::getVersion().
{ for(unsigned int i=0;i<pixelVersionAliases_.size();i++){ if (pixelVersionAliases_[i].alias()==alias&& pixelVersionAliases_[i].path()==path){ return pixelVersionAliases_[i].version(); } } assert(0); return 0; }
std::vector<std::string> pos::PixelAliasList::getVersionAliases | ( | std::string | path | ) | [inline] |
Definition at line 225 of file PixelAliasList.h.
References alias(), i, path(), pixelVersionAliases_, and tmp.
Referenced by pos::PixelConfigFile::getVersionAliases().
{ std::vector<std::string> tmp; for(unsigned int i=0;i<pixelVersionAliases_.size();i++){ //std::cout << "path alias:"<<pixelVersionAliases_[i].path() // << pixelVersionAliases_[i].alias() << std::endl; if (pixelVersionAliases_[i].path()==path){ tmp.push_back(pixelVersionAliases_[i].alias()); } } return tmp; }
pathVersionAliasMmap pos::PixelAliasList::getVersionData | ( | ) | [inline] |
Definition at line 250 of file PixelAliasList.h.
References versionMmap.
Referenced by pos::PixelConfigFile::getVersionData().
{ return versionMmap ; }
pathVersionAliasMmap pos::PixelAliasList::getVersionData | ( | std::string | koc | ) | [inline] |
Definition at line 254 of file PixelAliasList.h.
References query::result, and versionMmap.
{ pathVersionAliasMmap result ; for(pathVersionAliasMmap::iterator it = versionMmap.begin() ;it != versionMmap.end() ; it ++) { if((*it).first.find(koc) != std::string::npos) { result[(*it).first] = (*it).second ; } } return result ; }
void pos::PixelAliasList::insertAlias | ( | PixelConfigAlias & | anAlias | ) | [inline] |
Definition at line 174 of file PixelAliasList.h.
References gather_cfg::cout, i, name(), pos::PixelConfigAlias::name(), and pixelConfigAliases_.
Referenced by pos::PixelConfigFile::addAlias().
{ for(unsigned int i=0;i<pixelConfigAliases_.size();i++){ if (pixelConfigAliases_[i].name()==anAlias.name()){ std::cout << "[PixelAliasList::insertAlias()]\t\t\tReplacing existing alias:" << anAlias.name()<<std::endl; pixelConfigAliases_[i]=anAlias; return; } } pixelConfigAliases_.push_back(anAlias); }
void pos::PixelAliasList::insertVersionAlias | ( | PixelVersionAlias & | anAlias | ) | [inline] |
Definition at line 194 of file PixelAliasList.h.
References pos::PixelVersionAlias::alias(), alias(), gather_cfg::cout, i, pos::PixelVersionAlias::path(), and pixelVersionAliases_.
Referenced by pos::PixelConfigFile::addVersionAlias().
{ for(unsigned int i=0;i<pixelVersionAliases_.size();i++){ if (pixelVersionAliases_[i].alias()==anAlias.alias()&& pixelVersionAliases_[i].path()==anAlias.path()){ std::cout << "[PixelAliasList::insertVersionAlias()]\t\tReplacing existing version alias:" <<anAlias.path()<< " " << anAlias.alias() << std::endl; pixelVersionAliases_[i]=anAlias; return; } } pixelVersionAliases_.push_back(anAlias); }
unsigned int pos::PixelAliasList::key | ( | unsigned int | i | ) | [inline] |
Definition at line 280 of file PixelAliasList.h.
References i, and pixelConfigAliases_.
Referenced by pos::PixelConfigFile::getAliases(), pos::PixelConfigFile::getAliases_map(), readfile(), and updateConfigAlias().
{ return pixelConfigAliases_[i].key() ;}
unsigned int pos::PixelAliasList::nAliases | ( | ) | [inline] |
Definition at line 278 of file PixelAliasList.h.
References pixelConfigAliases_.
Referenced by pos::PixelConfigFile::getAliases(), and pos::PixelConfigFile::getAliases_map().
{ return pixelConfigAliases_.size() ;}
std::string pos::PixelAliasList::name | ( | unsigned int | i | ) | [inline] |
Definition at line 279 of file PixelAliasList.h.
References i, and pixelConfigAliases_.
Referenced by pos::PixelConfigFile::getAliases(), pos::PixelConfigFile::getAliases_map(), insertAlias(), and versionAliases().
{ return pixelConfigAliases_[i].name() ;}
unsigned int pos::PixelAliasList::nVersionAliases | ( | ) | [inline] |
Definition at line 283 of file PixelAliasList.h.
References pixelVersionAliases_.
{ return pixelVersionAliases_.size() ;}
PixelConfigAlias pos::PixelAliasList::operator[] | ( | unsigned int | i | ) | [inline] |
Definition at line 281 of file PixelAliasList.h.
References i, and pixelConfigAliases_.
{ return pixelConfigAliases_[i] ;}
std::string pos::PixelAliasList::path | ( | unsigned int | i | ) | [inline] |
Definition at line 284 of file PixelAliasList.h.
References i, and pixelVersionAliases_.
Referenced by getVersion(), getVersionAliases(), and readfile().
{ return pixelVersionAliases_[i].path() ;}
void pos::PixelAliasList::readfile | ( | std::string | filename | ) | [inline] |
Definition at line 64 of file PixelAliasList.h.
References pos::PixelConfigAlias::addVersionAlias(), alias(), aliasMmap, gather_cfg::cout, recoMuon::in, key(), path(), pixelConfigAliases_, pixelVersionAliases_, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, version(), and versionMmap.
Referenced by pos::PixelConfigFile::getAlias().
{ std::ifstream in(filename.c_str()); if (!in.good()) { std::cout << "[PixelAliasList::readfile()]\t\tCould not open file:"<<filename<<std::endl; } assert(in.good()); // Added by Dario, May 28th, 2008 ===================================================================== pixelConfigAliases_.clear() ; pixelVersionAliases_.clear() ; aliasMmap.clear() ; versionMmap.clear() ; // End of Dario's addition ============================================================================ std::string tag; in >> tag; while(tag.substr(0,1) == "#") { in.ignore(4096, '\n'); //skips to endl; in >> tag; } assert(tag=="ConfigurationAliases"); in >> tag; while(tag!="VersionAliases"){ std::string alias=tag; unsigned int key; in >> key; //std::cout << "[PixelAliasList::readfile()] Alias, key:"<<alias<<" "<<key<<std::endl; PixelConfigAlias anAlias(alias,key); in >> tag; std::string theAlias = alias ; // Added by Dario, May 20th, 2008 ===================================================================== pathAliasPair tmpPAPair ; if( tag == ";" ) { tmpPAPair[""] = " " ; aliasMmap[theAlias] = tmpPAPair ; } // End of Dario's addition ============================================================================ while(tag != ";") { std::string path; std::string alias; path=tag; in >> alias; //std::cout << "[PixelAliasList::readfile()] path, alias:"<<path<<" "<<alias<<std::endl; anAlias.addVersionAlias(path,alias); // Added by Dario, May 20th, 2008 ===================================================================== tmpPAPair[path] = alias ; aliasMmap[theAlias] = tmpPAPair ; // End of Dario's addition ============================================================================ in >> tag; } pixelConfigAliases_.push_back(anAlias); in >> tag; } assert(tag=="VersionAliases"); std::string path; std::string alias; unsigned int version; in >> path; in >> version; in >> alias; in >> tag; //std::cout << "path version alias tag:"<<path<<" "<<version // <<" "<<alias<<" "<<tag<<std::endl; // Added by Dario, May 23rd, 2008 ===================================================================== versionAliasPair tmpVAPair ; // End of Dario's addition ============================================================================ while(!in.eof()){ assert(tag==";"); PixelVersionAlias aVersionAlias(path,version,alias); pixelVersionAliases_.push_back(aVersionAlias); // Added by Dario, May 23rd, 2008 ===================================================================== tmpVAPair.first = version ; tmpVAPair.second = alias ; versionMmap[path].push_back(tmpVAPair) ; // End of Dario's addition ============================================================================ in >> path; in >> version; in >> alias; in >> tag; } in.close(); }
void pos::PixelAliasList::updateConfigAlias | ( | std::string | path, |
unsigned int | version, | ||
std::string | alias, | ||
PixelConfigList & | config | ||
) | [inline] |
Definition at line 207 of file PixelAliasList.h.
References pos::PixelConfigList::clone(), i, j, key(), and pixelConfigAliases_.
Referenced by pos::PixelConfigFile::addVersionAlias().
{ //first loop over configuration aliases for(unsigned int i=0;i<pixelConfigAliases_.size();i++){ //std::cout << "Looping over aliases:"<<i<<std::endl; for(unsigned int j=0;j<pixelConfigAliases_[i].nVersionAliases();j++){ //std::cout << "Looping over versionAliases:"<<j<<std::endl; if(path==pixelConfigAliases_[i].versionAliasesPath(j)&& alias==pixelConfigAliases_[i].versionAliasesAlias(j)){ //std::cout << "Making clone!"<<std::endl; unsigned int newkey=config.clone(pixelConfigAliases_[i].key(),path,version); pixelConfigAliases_[i].setKey(newkey); } } } }
unsigned int pos::PixelAliasList::version | ( | unsigned int | i | ) | [inline] |
Definition at line 285 of file PixelAliasList.h.
References i, and pixelVersionAliases_.
Referenced by readfile().
{ return pixelVersionAliases_[i].version();}
PixelConfigAlias* pos::PixelAliasList::versionAliases | ( | std::string | aliasName | ) | [inline] |
Definition at line 185 of file PixelAliasList.h.
References i, name(), and pixelConfigAliases_.
Referenced by pos::PixelConfigFile::getVersionAliases().
{ for(unsigned int i=0;i<pixelConfigAliases_.size();i++){ if (pixelConfigAliases_[i].name()==aliasName){ return &(pixelConfigAliases_[i]); } } return 0; }
void pos::PixelAliasList::writefile | ( | ) | [inline] |
Definition at line 29 of file PixelAliasList.h.
References pos::PixelVersionAlias::alias(), createBeamHaloJobs::directory, lut2db_cfg::filename, i, j, pos::PixelConfigAlias::key(), n, pos::PixelConfigAlias::name(), pos::PixelConfigAlias::nVersionAliases(), dbtoconf::out, pos::PixelVersionAlias::path(), pixelConfigAliases_, pixelVersionAliases_, AlCaHLTBitMon_QueryRunRegistry::string, pos::PixelVersionAlias::version(), pos::PixelConfigAlias::versionAliasesAlias(), and pos::PixelConfigAlias::versionAliasesPath().
Referenced by pos::PixelConfigFile::addAlias(), and pos::PixelConfigFile::addVersionAlias().
{ std::string directory=getenv("PIXELCONFIGURATIONBASE"); std::string filename=directory+"/aliases.txt"; std::ofstream out(filename.c_str()); out << "ConfigurationAliases" <<std::endl; for(unsigned int i=0;i<pixelConfigAliases_.size();i++){ PixelConfigAlias& theAlias=pixelConfigAliases_[i]; out << theAlias.name() << " " << theAlias.key() << " "; unsigned int n=theAlias.nVersionAliases(); for (unsigned int j=0;j<n;j++){ out << theAlias.versionAliasesPath(j) << " "; out << theAlias.versionAliasesAlias(j) << " "; } out << ";" << std::endl; } out << "VersionAliases" <<std::endl; for(unsigned int i=0;i<pixelVersionAliases_.size();i++){ PixelVersionAlias& theAlias=pixelVersionAliases_[i]; out << theAlias.path() << " " << theAlias.version() << " " << theAlias.alias() << " ;"<<std::endl; } }
pathAliasMmap pos::PixelAliasList::aliasMmap [private] |
Definition at line 293 of file PixelAliasList.h.
Referenced by getConfigAliases(), and readfile().
std::vector<PixelConfigAlias> pos::PixelAliasList::pixelConfigAliases_ [private] |
Definition at line 290 of file PixelAliasList.h.
Referenced by insertAlias(), key(), nAliases(), name(), operator[](), readfile(), updateConfigAlias(), versionAliases(), and writefile().
std::vector<PixelVersionAlias> pos::PixelAliasList::pixelVersionAliases_ [private] |
Definition at line 291 of file PixelAliasList.h.
Referenced by alias(), getVersion(), getVersionAliases(), insertVersionAlias(), nVersionAliases(), path(), readfile(), version(), and writefile().
Definition at line 294 of file PixelAliasList.h.
Referenced by getVersionData(), and readfile().