#include "FWCore/Utilities/interface/Exception.h"
#include "TEnum.h"
#include "TEnumConstant.h"
#include <cassert>
#include <string>
#include <sstream>
#include <vector>
Go to the source code of this file.
Functions | |
template<typename MyEnum > | |
int | StringToEnumValue (std::string const &enumConstName) |
template<class MyType > | |
std::vector< int > | StringToEnumValue (const std::vector< std::string > &enumNames) |
int StringToEnumValue | ( | std::string const & | enumConstName | ) |
Convert a string into the enum value it corresponds to. Example: int value = StringToEnumValue<EcalRecHit::Flags>("kGood");
Definition at line 27 of file StringToEnumValue.h.
std::vector<int> StringToEnumValue | ( | const std::vector< std::string > & | enumNames | ) |
Convert a vector<string> into a vector<int> with the enum values it corresponds to. Example:
std::vector<std::string> names; names.push_back("kWeird"); names.push_back("kGood");
std::vector<int> ints = StringToEnumValue<EcalRecHit::Flags>(names);
std::copy(ints.begin(), ints.end(), std::ostream_iterator<int>(std::cout, "-"));
Definition at line 61 of file StringToEnumValue.h.
References str, and AlCaHLTBitMon_QueryRunRegistry::string.