Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-09-07 04:36:48

0001 //-------------------------------------------------
0002 //
0003 //   \class L1MuGMTLUTHelpers
0004 /**
0005  *   Description: Helper Functions for std::string handling in L1MuGMTLUT
0006  *                (could be found in Cobra but classes
0007  *                 should be independet of COBRA/ORCA)
0008  *
0009 */
0010 //
0011 //
0012 //   Author :
0013 //   H. Sakulin            HEPHY Vienna
0014 //
0015 //   Migrated to CMSSW:
0016 //   I. Mikulec
0017 //
0018 //--------------------------------------------------
0019 #ifndef L1TriggerGlobalMuonTrigger_L1MuGMTLUTHelpers_h
0020 #define L1TriggerGlobalMuonTrigger_L1MuGMTLUTHelpers_h
0021 
0022 //---------------
0023 // C++ Headers --
0024 //---------------
0025 
0026 #include <vector>
0027 #include <string>
0028 #include <cstdlib>
0029 #include <cstdio>
0030 
0031 //              ---------------------
0032 //              -- Class Interface --
0033 //              ---------------------
0034 
0035 class L1MuGMTLUTHelpers {
0036 public:
0037   /// constructor
0038   L1MuGMTLUTHelpers() {}
0039 
0040   /// destructor
0041   virtual ~L1MuGMTLUTHelpers() {}
0042 
0043   /// Lookup Functions
0044 
0045   /// some std::string tools
0046 
0047   class Tokenizer : public std::vector<std::string> {
0048   public:
0049     Tokenizer(const std::string& sep, const std::string& input) {
0050       size_type i = 0, j = 0;
0051       while ((j = input.find(sep, i)) != std::string::npos) {
0052         push_back(input.substr(i, j - i));
0053         i = j + sep.size();
0054       }
0055       push_back(input.substr(i));
0056     };
0057   };
0058 
0059   static int replace(std::string& input, const std::string& gone, const std::string& it, bool multiple);
0060 };
0061 
0062 #endif