CMS 3D CMS Logo

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

DDName is used to identify DDD entities uniquely. More...

#include <DDName.h>

Public Types

using id_type = int
 
using IdToName = std::vector< Registry::const_iterator >
 
using Registry = std::map< std::pair< std::string, std::string >, id_type >
 

Public Member Functions

 DDName ()
 
 DDName (const char *name)
 
 DDName (const char *name, const char *ns)
 
 DDName (const std::string &name)
 Creates a DDName with name in the current namespace defined in the singleton DDCurrentNamespace. More...
 
 DDName (const std::string &name, const std::string &ns)
 Constructs a DDName with name name and assigns name to the namespace ns. More...
 
const std::string fullname () const
 
id_type id () const
 
const std::string & name () const
 Returns the name. More...
 
const std::string & ns () const
 Returns the namespace. More...
 
bool operator< (const DDName &rhs) const
 
bool operator== (const DDName &rhs) const
 

Static Private Member Functions

static Registry::iterator registerName (const std::pair< std::string, std::string > &s)
 

Private Attributes

id_type id_
 

Detailed Description

DDName is used to identify DDD entities uniquely.

A DDName consists of a name and a namespace. Both are represented as std::string.

Definition at line 15 of file DDName.h.

Member Typedef Documentation

◆ id_type

using DDName::id_type = int

Definition at line 17 of file DDName.h.

◆ IdToName

using DDName::IdToName = std::vector<Registry::const_iterator>

Definition at line 19 of file DDName.h.

◆ Registry

using DDName::Registry = std::map<std::pair<std::string, std::string>, id_type>

Definition at line 18 of file DDName.h.

Constructor & Destructor Documentation

◆ DDName() [1/5]

DDName::DDName ( const std::string &  name,
const std::string &  ns 
)

Constructs a DDName with name name and assigns name to the namespace ns.

Definition at line 15 of file DDName.cc.

15 : id_(registerName(std::make_pair(name, ns))->second) {}

◆ DDName() [2/5]

DDName::DDName ( const std::string &  name)

Creates a DDName with name in the current namespace defined in the singleton DDCurrentNamespace.

Definition at line 17 of file DDName.cc.

17  : id_(0) {
18  std::pair<std::string, std::string> result = DDSplit(name);
19  if (result.second.empty()) {
20  id_ = registerName(std::make_pair(result.first, DDCurrentNamespace::ns()))->second;
21  } else {
22  id_ = registerName(result)->second;
23  }
24 }

References DDSplit(), id_, name(), DDCurrentNamespace::ns(), registerName(), and mps_fire::result.

◆ DDName() [3/5]

DDName::DDName ( const char *  name)

Definition at line 26 of file DDName.cc.

26  : id_(0) {
27  std::pair<std::string, std::string> result = DDSplit(name);
28  if (result.second.empty()) {
29  id_ = registerName(std::make_pair(result.first, DDCurrentNamespace::ns()))->second;
30  } else {
31  id_ = registerName(result)->second;
32  }
33 }

References DDSplit(), id_, name(), DDCurrentNamespace::ns(), registerName(), and mps_fire::result.

◆ DDName() [4/5]

DDName::DDName ( const char *  name,
const char *  ns 
)

Definition at line 35 of file DDName.cc.

36  : id_(registerName(std::make_pair(std::string(name), std::string(ns)))->second) {}

◆ DDName() [5/5]

DDName::DDName ( )
explicit

Definition at line 38 of file DDName.cc.

38 : id_(0) {}

Member Function Documentation

◆ fullname()

const std::string DDName::fullname ( ) const
inline

◆ id()

id_type DDName::id ( ) const
inline

Definition at line 42 of file DDName.h.

42 { return id_; }

References id_.

◆ name()

const std::string & DDName::name ( ) const

Returns the name.

Definition at line 40 of file DDName.cc.

40  {
41  const static std::string ano_("anonymous");
42  const std::string* result;
43  if (id_ == 0) {
44  result = &ano_;
45  } else {
47  }
48  return *result;
49 }

References id_, DDI::Singleton< I >::instance(), mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by config.CFG::__str__(), PrintGeomSummary::addSolid(), DDEcalEndcapAlgo::addTmp(), DDG4SolidConverter::box(), HcalTB06BeamParametersFromDD::build(), HcalTB02ParametersFromDD::build(), EcalSimParametersFromDD::build(), GEMGeometryBuilderFromDDD::build(), MagGeoBuilderFromDDD::build(), ME0GeometryParsFromDD::buildChamber(), GEMGeometryParsFromDD::buildChamber(), ME0GeometryBuilder::buildChamber(), GEMGeometryBuilderFromDDD::buildChamber(), CTPPSGeometryESModule::buildDetGeomDesc(), ME0GeometryParsFromDD::buildEtaPartition(), GEMGeometryParsFromDD::buildEtaPartition(), ME0GeometryBuilder::buildEtaPartition(), GEMGeometryBuilderFromDDD::buildEtaPartition(), ME0GeometryParsFromDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), GEMGeometryParsFromDD::buildGeometry(), ME0GeometryBuilder::buildGeometry(), RPCGeometryBuilderFromDDD::buildGeometry(), ME0GeometryParsFromDD::buildLayer(), ME0GeometryBuilder::buildLayer(), GEMGeometryParsFromDD::buildSuperChamber(), GEMGeometryBuilderFromDDD::buildSuperChamber(), DDDividedGeometryObject::checkNDivAndWidth(), DDG4SolidConverter::cons(), DDG4Builder::convertMaterial(), TGeoMgrFromDdd::createMaterial(), TGeoMgrFromDdd::createShape(), TGeoMgrFromDdd::createVolume(), DDG4SolidConverter::cuttubs(), DDCheckAll(), DDCheckMaterial(), DDCompareEPV(), DDName(), DDrot(), DDrotReflect(), DDHtmlLpDetails::details(), DDHtmlMaDetails::details(), validation.Sample::digest(), DDG4SolidConverter::ellipticaltube(), DDTIBLayerAlgo_MTCC::execute(), DDTBH4Algo::execute(), DDTIDRingAlgo::execute(), DDCutTubsFromPoints::execute(), DDPixBarLayerUpgradeAlgo::execute(), DDPixBarLayerAlgo::execute(), DDTIBLayerAlgo::execute(), DDHCalForwardAlgo::execute(), DDTECModuleAlgo::execute(), DDEcalBarrelNewAlgo::execute(), DDEcalBarrelAlgo::execute(), DDPixFwdBlades::execute(), DDG4SolidConverter::extrudedpolygon(), fullname(), PPSGeometryBuilder::getGeographicalID(), VIDSelectorBase.VIDSelectorBase::initialize(), DreamSD::initMap(), DDG4SolidConverter::intersection(), HGCalGeomParameters::loadGeometryHexagon(), DDDividedTubsRho::makeDDLogicalPart(), DDDividedConsRho::makeDDLogicalPart(), DDDividedBoxX::makeDDLogicalPart(), DDDividedTrdX::makeDDLogicalPart(), DDDividedPolyhedraRho::makeDDLogicalPart(), DDDividedPolyconeRho::makeDDLogicalPart(), DDDividedConsPhi::makeDDLogicalPart(), DDDividedBoxY::makeDDLogicalPart(), DDDividedPolyconePhi::makeDDLogicalPart(), DDDividedPolyhedraPhi::makeDDLogicalPart(), DDDividedBoxZ::makeDDLogicalPart(), DDDividedConsZ::makeDDLogicalPart(), DDDividedTubsZ::makeDDLogicalPart(), DDDividedPolyconeZ::makeDDLogicalPart(), DDDividedTrdZ::makeDDLogicalPart(), DDDividedPolyhedraZ::makeDDLogicalPart(), DDDividedTubsPhi::makeDDRotation(), DDDividedConsPhi::makeDDRotation(), DDDividedPolyconePhi::makeDDRotation(), DDDividedPolyhedraPhi::makeDDRotation(), DDLDivision::makeDivider(), DDFilteredView::name(), DDG4SolidConverter::polycone_rrz(), DDG4SolidConverter::polycone_rz(), DDG4SolidConverter::polyhedra_rrz(), DDG4SolidConverter::polyhedra_rz(), DDLPosPart::processElement(), DDLDivision::processElement(), DDLCompositeMaterial::processElement(), DDG4SolidConverter::sphere(), DDG4SolidConverter::subtraction(), DDG4SolidConverter::torus(), DDG4SolidConverter::trap(), DDG4SolidConverter::tubs(), DDG4SolidConverter::unionsolid(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDEcalBarrelAlgo::web(), and DDEcalBarrelNewAlgo::web().

◆ ns()

const std::string & DDName::ns ( ) const

◆ operator<()

bool DDName::operator< ( const DDName rhs) const
inline

Definition at line 44 of file DDName.h.

44 { return id_ < rhs.id_; }

References id_.

◆ operator==()

bool DDName::operator== ( const DDName rhs) const
inline

Definition at line 45 of file DDName.h.

45 { return id_ == rhs.id_; }

References id_.

◆ registerName()

DDName::Registry::iterator DDName::registerName ( const std::pair< std::string, std::string > &  s)
staticprivate

Definition at line 62 of file DDName.cc.

62  {
65  Registry::size_type sz = reg.size();
66  if (!sz) {
67  reg[std::make_pair(std::string(""), std::string(""))] = 0;
68  idToName.emplace_back(reg.begin());
69  ++sz;
70  }
71  Registry::value_type val(nm, sz);
72  std::pair<Registry::iterator, bool> result = reg.insert(val);
73  if (result.second) {
74  idToName.emplace_back(result.first);
75  }
76  return result.first;
77 }

References DDI::Singleton< I >::instance(), mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, and heppy_batch::val.

Referenced by DDName().

Member Data Documentation

◆ id_

id_type DDName::id_
private

Definition at line 48 of file DDName.h.

Referenced by DDName(), id(), name(), ns(), operator<(), and operator==().

edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:215
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
DDName::id_
id_type id_
Definition: DDName.h:48
DDI::Singleton::instance
static value_type & instance()
DDName::name
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
reco::JetExtendedAssociation::value_type
Container::value_type value_type
Definition: JetExtendedAssociation.h:30
DDName::IdToName
std::vector< Registry::const_iterator > IdToName
Definition: DDName.h:19
heppy_batch.val
val
Definition: heppy_batch.py:351
DDName::ns
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:51
DDCurrentNamespace::ns
static std::string & ns()
Definition: DDCurrentNamespace.cc:3
mps_fire.result
result
Definition: mps_fire.py:303
DDName::Registry
std::map< std::pair< std::string, std::string >, id_type > Registry
Definition: DDName.h:18
DDName::registerName
static Registry::iterator registerName(const std::pair< std::string, std::string > &s)
Definition: DDName.cc:62
DDSplit
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = ':'
Definition: DDSplit.cc:3