CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Private Member Functions | Static Private Attributes
CmsMTDStringToEnum Class Reference

#include <CmsMTDStringToEnum.h>

Classes

struct  Impl
 

Public Types

typedef std::map< std::string, GeometricTimingDet::GeometricTimingEnumTypeMapEnumType
 
typedef std::map< GeometricTimingDet::GeometricTimingEnumType, std::string > ReverseMapEnumType
 

Public Member Functions

std::string const & name (GeometricTimingDet::GeometricTimingEnumType) const
 
GeometricTimingDet::GeometricTimingEnumType type (std::string const &) const
 

Static Private Member Functions

static MapEnumType const & map ()
 
static ReverseMapEnumType const & reverseMap ()
 

Static Private Attributes

static const Impl m_impl
 

Detailed Description

Builds map between Det type and an enum

Definition at line 10 of file CmsMTDStringToEnum.h.

Member Typedef Documentation

Definition at line 12 of file CmsMTDStringToEnum.h.

Definition at line 13 of file CmsMTDStringToEnum.h.

Member Function Documentation

static MapEnumType const& CmsMTDStringToEnum::map ( )
inlinestaticprivate

Definition at line 19 of file CmsMTDStringToEnum.h.

References CmsMTDStringToEnum::Impl::_map, and m_impl.

Referenced by type().

19 { return m_impl._map; }
static const Impl m_impl
std::string const & CmsMTDStringToEnum::name ( GeometricTimingDet::GeometricTimingEnumType  t) const

Definition at line 78 of file CmsMTDStringToEnum.cc.

References end, AlCaHLTBitMon_ParallelJobs::p, reverseMap(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by config.CFG::__str__(), validation.Sample::digest(), and VIDSelectorBase.VIDSelectorBase::initialize().

78  {
79  static std::string const u("Unknown");
80  ReverseMapEnumType::const_iterator p = reverseMap().find(t);
81  if (p != reverseMap().end())
82  return p->second;
83  return u;
84 }
static ReverseMapEnumType const & reverseMap()
#define end
Definition: vmac.h:39
static ReverseMapEnumType const& CmsMTDStringToEnum::reverseMap ( )
inlinestaticprivate

Definition at line 20 of file CmsMTDStringToEnum.h.

References CmsMTDStringToEnum::Impl::_reverseMap, and m_impl.

Referenced by name().

20 { return m_impl._reverseMap; }
static const Impl m_impl
ReverseMapEnumType _reverseMap
GeometricTimingDet::GeometricTimingEnumType CmsMTDStringToEnum::type ( std::string const &  s) const

Definition at line 67 of file CmsMTDStringToEnum.cc.

References dqmdumpme::first, map(), min(), AlCaHLTBitMon_ParallelJobs::p, alignCSCRings::s, GeometricTimingDet::unknown, and findQualityFiles::v.

Referenced by CmsMTDConstruction::buildBTLModule(), CmsMTDConstruction::buildComponent(), CmsMTDTrayBuilder::buildComponent(), CmsMTDBuilder::buildComponent(), CmsMTDEndcapBuilder::buildComponent(), CmsMTDSubStrctBuilder::buildComponent(), CmsMTDConstruction::buildETLModule(), and DDDCmsMTDConstruction::construct().

67  {
68  // remove namespace if present
69  std::string_view v = s;
70  auto first = v.find_first_of(":");
71  v.remove_prefix(std::min(first + 1, v.size()));
72  MapEnumType::const_iterator p = map().find({v.data(), v.size()});
73  if (p != map().end())
74  return p->second;
76 }
static MapEnumType const & map()
T min(T a, T b)
Definition: MathUtil.h:58

Member Data Documentation

const CmsMTDStringToEnum::Impl CmsMTDStringToEnum::m_impl
staticprivate

Definition at line 29 of file CmsMTDStringToEnum.h.

Referenced by map(), and reverseMap().