#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 25 of file StringToEnumValue.h.
References cms::cuda::assert().
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 57 of file StringToEnumValue.h.
References runTheMatrix::ret, str, AlCaHLTBitMon_QueryRunRegistry::string, and trackerHitRTTI::vector.