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  private:
14  std::vector<std::pair<std::string, int> > _codeDefs;
15 
16  public:
17  ComCodes() = default;
18  ComCodes(const ComCodes& rhs) = default;
19  ~ComCodes() = default;
20 
21  //accessors
22  int getCode(const char* descript) const;
23  void getCodeName(int code, std::string& id) const;
24 
25  //modifiers
26  void setCode(const char* descript, int code);
27 
28  //key comp
29  static bool keyComp(const std::pair<std::string, int>& lhs, const std::pair<std::string, int>& rhs);
30  void sort() { std::sort(_codeDefs.begin(), _codeDefs.end(), keyComp); }
31  };
32 } // namespace egHLT
33 #endif
void setCode(const char *descript, int code)
Definition: EgHLTComCodes.cc:7
void getCodeName(int code, std::string &id) const
~ComCodes()=default
ComCodes()=default
int getCode(const char *descript) const
static bool keyComp(const std::pair< std::string, int > &lhs, const std::pair< std::string, int > &rhs)
std::vector< std::pair< std::string, int > > _codeDefs
Definition: EgHLTComCodes.h:14