#include <DQMOffline/Trigger/interface/ComCodes.h>
Public Member Functions | |
ComCodes (const ComCodes &rhs) | |
ComCodes () | |
int | getCode (const char *descript) const |
void | getCodeName (int code, std::string &id) const |
void | setCode (const char *descript, int code) |
void | sort () |
~ComCodes () | |
Static Public Member Functions | |
static bool | keyComp (const std::pair< std::string, int > &lhs, const std::pair< std::string, int > &rhs) |
Private Attributes | |
std::vector< std::pair < std::string, int > > | _codeDefs |
Definition at line 14 of file ComCodes.h.
ComCodes::ComCodes | ( | ) | [inline] |
ComCodes::ComCodes | ( | const ComCodes & | rhs | ) | [inline] |
ComCodes::~ComCodes | ( | ) | [inline] |
int ComCodes::getCode | ( | const char * | descript | ) | const |
Definition at line 17 of file ComCodes.cc.
References _codeDefs, code, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), first, i, and NULL.
Referenced by EleTypeCodes::getCode(), and CutCodes::getCode().
00018 { 00019 //first copy the character string to a local array so we can manipulate it 00020 char localDescript[256]; 00021 strcpy(localDescript,descript); 00022 00023 int code = 0x0000; 00024 char* codeKey = strtok(localDescript,":"); 00025 // std::map<std::string,int> ::const_iterator mapIt; 00026 while(codeKey!=NULL){ 00027 bool found=false; 00028 00029 for(size_t i=0;i<_codeDefs.size() && !found;i++){ 00030 if(_codeDefs[i].first.compare(codeKey)==0){ 00031 found=true; 00032 code |= _codeDefs[i].second; 00033 00034 } 00035 } 00036 00037 if(!found) std::cout<<"ComCodes::getCode : Error, Key "<<codeKey<<" not found"<<std::endl; 00038 codeKey = strtok(NULL,":"); //getting new substring 00039 00040 } 00041 return code; 00042 }
Definition at line 49 of file ComCodes.cc.
References _codeDefs, empty, i, and edm::second().
Referenced by CutCodes::getCodeName(), and EleTypeCodes::getCodeName().
00050 { 00051 id.clear(); 00052 for(size_t i=0;i<_codeDefs.size();i++){ 00053 if((code&_codeDefs[i].second)==_codeDefs[i].second){ 00054 if(!id.empty()) id+=":";//seperating entries by a ':' 00055 id+=_codeDefs[i].first; 00056 } 00057 00058 } 00059 00060 }
bool ComCodes::keyComp | ( | const std::pair< std::string, int > & | lhs, | |
const std::pair< std::string, int > & | rhs | |||
) | [static] |
Definition at line 4 of file ComCodes.cc.
References _codeDefs, first, and i.
Referenced by EleTypeCodes::setCodes_(), and CutCodes::setCodes_().
00005 { 00006 bool found=false; 00007 for(size_t i=0;i<_codeDefs.size() && !found;i++){ 00008 if(_codeDefs[i].first.compare(descript)==0) found=true; 00009 } 00010 if(!found) _codeDefs.push_back(std::make_pair<std::string,int>(descript,code)); 00011 00012 //_codeDefs[descript] = code; 00013 }
void ComCodes::sort | ( | ) | [inline] |
Definition at line 34 of file ComCodes.h.
References _codeDefs, keyComp(), and python::multivaluedict::sort().
Referenced by CutCodes::setCodes_().
std::vector<std::pair<std::string,int> > ComCodes::_codeDefs [private] |
Definition at line 18 of file ComCodes.h.
Referenced by getCode(), getCodeName(), setCode(), and sort().