#include <EgHLTComCodes.h>
Public Member Functions | |
ComCodes () | |
ComCodes (const ComCodes &rhs) | |
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 12 of file EgHLTComCodes.h.
egHLT::ComCodes::ComCodes | ( | ) | [inline] |
Definition at line 18 of file EgHLTComCodes.h.
{}
egHLT::ComCodes::ComCodes | ( | const ComCodes & | rhs | ) | [inline] |
Definition at line 19 of file EgHLTComCodes.h.
:_codeDefs(rhs._codeDefs){}
egHLT::ComCodes::~ComCodes | ( | ) | [inline] |
Definition at line 20 of file EgHLTComCodes.h.
{}
int ComCodes::getCode | ( | const char * | descript | ) | const |
Definition at line 20 of file EgHLTComCodes.cc.
References _codeDefs, first, newFWLiteAna::found, i, and NULL.
Referenced by egHLT::EgCutCodes::getCode().
{ //first copy the character string to a local array so we can manipulate it char localDescript[256]; strcpy(localDescript,descript); int code = 0x0000; char* codeKey = strtok(localDescript,":"); // std::map<std::string,int> ::const_iterator mapIt; while(codeKey!=NULL){ bool found=false; for(size_t i=0;i<_codeDefs.size() && !found;i++){ if(_codeDefs[i].first.compare(codeKey)==0){ found=true; code |= _codeDefs[i].second; } } if(!found) edm::LogWarning("EgHLTComCodes") <<"ComCodes::getCode : Error, Key "<<codeKey<<" not found (likely mistyped, practical upshot is the selection is not what you think it is)";//<<std::endl; codeKey = strtok(NULL,":"); //getting new substring } return code; }
void ComCodes::getCodeName | ( | int | code, |
std::string & | id | ||
) | const |
Definition at line 52 of file EgHLTComCodes.cc.
References _codeDefs, relativeConstraints::empty, i, and edm::second().
Referenced by egHLT::EgCutCodes::getCodeName().
bool ComCodes::keyComp | ( | const std::pair< std::string, int > & | lhs, |
const std::pair< std::string, int > & | rhs | ||
) | [static] |
Definition at line 47 of file EgHLTComCodes.cc.
Referenced by sort().
{
return lhs.first < rhs.first;
}
void ComCodes::setCode | ( | const char * | descript, |
int | code | ||
) |
Definition at line 7 of file EgHLTComCodes.cc.
References _codeDefs, first, newFWLiteAna::found, and i.
Referenced by egHLT::EgCutCodes::setCodes_().
void egHLT::ComCodes::sort | ( | ) | [inline] |
Definition at line 31 of file EgHLTComCodes.h.
References _codeDefs, and keyComp().
Referenced by egHLT::EgCutCodes::setCodes_().
std::vector<std::pair<std::string,int> > egHLT::ComCodes::_codeDefs [private] |
Definition at line 15 of file EgHLTComCodes.h.
Referenced by getCode(), getCodeName(), setCode(), and sort().