CMS 3D CMS Logo

EgHLTComCodes.h
Go to the documentation of this file.
1 #ifndef DQMOFFLINE_TRIGGER_EGHLTCOMCODES
2 #define DQMOFFLINE_TRIGGER_EGHLTCOMCODES
3 
4 #include <cstring>
5 #include <string>
6 #include <vector>
7 #include <iostream>
8 #include <algorithm>
9 
10 namespace egHLT {
11 
12  class ComCodes {
13 
14  private:
15  std::vector<std::pair<std::string,int> > _codeDefs;
16 
17  public:
18  ComCodes(){}
19  ComCodes(const ComCodes& rhs):_codeDefs(rhs._codeDefs){}
20  ~ComCodes(){}
21 
22  //accessors
23  int getCode(const char *descript)const;
24  void getCodeName(int code,std::string& id)const;
25 
26  //modifiers
27  void setCode(const char *descript,int code);
28 
29  //key comp
30  static bool keyComp(const std::pair<std::string,int>& lhs,const std::pair<std::string,int>& rhs);
31  void sort(){std::sort(_codeDefs.begin(),_codeDefs.end(),keyComp);}
32 
33  };
34 }
35 #endif
36 
void setCode(const char *descript, int code)
Definition: EgHLTComCodes.cc:7
int getCode(const char *descript) const
ComCodes(const ComCodes &rhs)
Definition: EgHLTComCodes.h:19
std::vector< std::pair< std::string, int > > _codeDefs
Definition: EgHLTComCodes.h:15
static bool keyComp(const std::pair< std::string, int > &lhs, const std::pair< std::string, int > &rhs)
void getCodeName(int code, std::string &id) const