CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQMOffline/Trigger/interface/EgHLTComCodes.h

Go to the documentation of this file.
00001 #ifndef DQMOFFLINE_TRIGGER_EGHLTCOMCODES
00002 #define DQMOFFLINE_TRIGGER_EGHLTCOMCODES
00003 
00004 #include <cstring>
00005 #include <string>
00006 #include <vector>
00007 #include <iostream>
00008 #include <algorithm>
00009 
00010 namespace egHLT {
00011 
00012   class ComCodes { 
00013     
00014   private:
00015     std::vector<std::pair<std::string,int> > _codeDefs;
00016     
00017   public:
00018     ComCodes(){} 
00019     ComCodes(const ComCodes& rhs):_codeDefs(rhs._codeDefs){}
00020     ~ComCodes(){} 
00021     
00022     //accessors
00023     int getCode(const char *descript)const;
00024     void getCodeName(int code,std::string& id)const;
00025     
00026     //modifiers
00027     void setCode(const char *descript,int code);
00028     
00029     //key comp
00030     static bool keyComp(const std::pair<std::string,int>& lhs,const std::pair<std::string,int>& rhs);
00031     void sort(){std::sort(_codeDefs.begin(),_codeDefs.end(),keyComp);}
00032     
00033   };
00034 }
00035 #endif
00036