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 (const std::string &name, const std::string &ns)
 Constructs a DDName with name name and assigns name to the namespace ns. More...
 
 DDName (const std::string &name)
 Creates a DDName with name in the current namespace defined in the singleton DDCurrentNamespace. More...
 
 DDName (const char *name)
 
 DDName (const char *name, const char *ns)
 
 DDName ()
 
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

using DDName::id_type = int

Definition at line 19 of file DDName.h.

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

Definition at line 21 of file DDName.h.

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

Definition at line 20 of file DDName.h.

Constructor & Destructor Documentation

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 16 of file DDName.cc.

17  : id_( registerName( std::make_pair( name, ns ))->second )
18 { }
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:67
U second(std::pair< T, U > const &p)
id_type id_
Definition: DDName.h:52
static Registry::iterator registerName(const std::pair< std::string, std::string > &s)
Definition: DDName.cc:81
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
DDName::DDName ( const std::string &  name)

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

Definition at line 20 of file DDName.cc.

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

21  : id_( 0 )
22 {
23  std::pair<std::string, std::string> result = DDSplit( name );
24  if( result.second.empty()) {
25  id_ = registerName( std::make_pair( result.first, DDCurrentNamespace::ns()))->second;
26  }
27  else {
28  id_ = registerName( result )->second;
29  }
30 }
static std::string & ns()
id_type id_
Definition: DDName.h:52
static Registry::iterator registerName(const std::pair< std::string, std::string > &s)
Definition: DDName.cc:81
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
DDName::DDName ( const char *  name)

Definition at line 32 of file DDName.cc.

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

33  : id_( 0 )
34 {
35  std::pair< std::string, std::string > result = DDSplit( name );
36  if( result.second.empty()) {
37  id_ = registerName( std::make_pair( result.first, DDCurrentNamespace::ns()))->second;
38  }
39  else {
40  id_ = registerName( result )->second;
41  }
42 }
static std::string & ns()
id_type id_
Definition: DDName.h:52
static Registry::iterator registerName(const std::pair< std::string, std::string > &s)
Definition: DDName.cc:81
std::pair< std::string, std::string > DDSplit(const std::string &n)
split into (name,namespace), separator = &#39;:&#39;
Definition: DDSplit.cc:3
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
DDName::DDName ( const char *  name,
const char *  ns 
)

Definition at line 44 of file DDName.cc.

45  : id_( registerName( std::make_pair( std::string( name ), std::string( ns )))->second )
46 { }
const std::string & ns() const
Returns the namespace.
Definition: DDName.cc:67
U second(std::pair< T, U > const &p)
id_type id_
Definition: DDName.h:52
static Registry::iterator registerName(const std::pair< std::string, std::string > &s)
Definition: DDName.cc:81
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
DDName::DDName ( )
explicit

Definition at line 48 of file DDName.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

49  : id_(0)
50 { }
id_type id_
Definition: DDName.h:52

Member Function Documentation

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

Definition at line 45 of file DDName.h.

References id_.

45 { return id_; }
id_type id_
Definition: DDName.h:52
const std::string & DDName::name ( ) const

Returns the name.

Definition at line 53 of file DDName.cc.

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

Referenced by config.CFG::__str__(), PrintGeomSummary::addSolid(), DDEcalEndcapAlgo::addTmp(), DDG4SolidConverter::box(), GEMGeometryBuilderFromDDD::build(), MagGeoBuilderFromDDD::build(), ME0GeometryParsFromDD::buildChamber(), ME0GeometryBuilderFromDDD::buildChamber(), GEMGeometryParsFromDD::buildChamber(), GEMGeometryBuilderFromDDD::buildChamber(), CmsTrackerPixelPhase1EndcapBuilder::buildComponent(), CTPPSGeometryESModule::buildDetGeomDesc(), ME0GeometryParsFromDD::buildEtaPartition(), GEMGeometryParsFromDD::buildEtaPartition(), ME0GeometryBuilderFromDDD::buildEtaPartition(), GEMGeometryBuilderFromDDD::buildEtaPartition(), ME0GeometryParsFromDD::buildGeometry(), ME0GeometryBuilderFromDDD::buildGeometry(), GEMGeometryParsFromDD::buildGeometry(), RPCGeometryBuilderFromDDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), ME0GeometryParsFromDD::buildLayer(), ME0GeometryBuilderFromDDD::buildLayer(), GEMGeometryParsFromDD::buildSuperChamber(), GEMGeometryBuilderFromDDD::buildSuperChamber(), DDDividedGeometryObject::checkNDivAndWidth(), DDG4SolidConverter::cons(), DDHGCalTBModuleX::constructBlocks(), DDHCalBarrelAlgo::constructInsideDetectors(), DDHCalEndcapAlgo::constructInsideModule(), DDHCalEndcapAlgo::constructInsideModule0(), DDG4Builder::convertLV(), DDG4Builder::convertMaterial(), TGeoMgrFromDdd::createShape(), TGeoFromDddService::createShape(), DDG4SolidConverter::cuttubs(), DD_NC(), DDBox::DDBox(), DDCheckAll(), DDCheckMaterial(), DDCompareEPV(), DDCons::DDCons(), DDCutTubs::DDCutTubs(), DDEllipticalTube::DDEllipticalTube(), DDExtrudedPolygon::DDExtrudedPolygon(), DDIntersection::DDIntersection(), DDPolycone::DDPolycone(), DDPolyhedra::DDPolyhedra(), DDPseudoTrap::DDPseudoTrap(), DDrot(), DDrotReflect(), DDShapelessSolid::DDShapelessSolid(), DDSphere::DDSphere(), DDSubtraction::DDSubtraction(), DDTorus::DDTorus(), DDTrap::DDTrap(), DDTruncTubs::DDTruncTubs(), DDTubs::DDTubs(), DDUnion::DDUnion(), DDHtmlLpDetails::details(), DDHtmlMaDetails::details(), validation.Sample::digest(), DDG4SolidConverter::ellipticaltube(), DDHCalForwardAlgo::execute(), DDTIBLayerAlgo_MTCC::execute(), DDPixBarLayerAlgo::execute(), DDPixBarLayerUpgradeAlgo::execute(), DDTIBLayerAlgo::execute(), DDTECModuleAlgo::execute(), DDTIDRingAlgo::execute(), DDCutTubsFromPoints::execute(), DDTBH4Algo::execute(), DDEcalBarrelNewAlgo::execute(), DDEcalBarrelAlgo::execute(), DDPixFwdBlades::execute(), DDG4SolidConverter::extrudedpolygon(), fullname(), HcalTB06BeamSD::getNames(), MaterialBudgetHcalHistos::getNames(), HCalSD::getNames(), HCalSD::HCalSD(), HcalTB06BeamSD::HcalTB06BeamSD(), VIDSelectorBase.VIDSelectorBase::initialize(), DreamSD::initMap(), HcalTB02SD::initMap(), ECalSD::initMap(), DDG4SolidConverter::intersection(), CmsMTDDebugNavigator::iterate(), CmsTrackerDebugNavigator::iterate(), HGCalGeomParameters::loadGeometryHexagon(), DDDividedConsRho::makeDDLogicalPart(), DDDividedBoxX::makeDDLogicalPart(), DDDividedTubsRho::makeDDLogicalPart(), DDDividedPolyconeRho::makeDDLogicalPart(), DDDividedPolyhedraRho::makeDDLogicalPart(), DDDividedTrdX::makeDDLogicalPart(), DDDividedConsPhi::makeDDLogicalPart(), DDDividedBoxY::makeDDLogicalPart(), DDDividedPolyconePhi::makeDDLogicalPart(), DDDividedPolyhedraPhi::makeDDLogicalPart(), DDDividedConsZ::makeDDLogicalPart(), DDDividedTubsZ::makeDDLogicalPart(), DDDividedBoxZ::makeDDLogicalPart(), DDDividedPolyconeZ::makeDDLogicalPart(), DDDividedPolyhedraZ::makeDDLogicalPart(), DDDividedTrdZ::makeDDLogicalPart(), DDDividedTubsPhi::makeDDRotation(), DDDividedConsPhi::makeDDRotation(), DDDividedPolyconePhi::makeDDRotation(), DDDividedPolyhedraPhi::makeDDRotation(), DDLDivision::makeDivider(), operator<<(), DDG4SolidConverter::polycone_rrz(), DDG4SolidConverter::polycone_rz(), DDG4SolidConverter::polyhedra_rrz(), DDG4SolidConverter::polyhedra_rz(), DDLRotationByAxis::processElement(), DDLPosPart::processElement(), DDLDivision::processElement(), DDLCompositeMaterial::processElement(), DDG4SolidConverter::pseudotrap(), GeometricTimingDetLoader::putOne(), GeometricDetLoader::putOne(), PGeometricDetBuilder::putOne(), DDG4SolidConverter::sphere(), DDG4SolidConverter::subtraction(), DDG4SolidConverter::torus(), DDG4SolidConverter::trap(), DDG4SolidConverter::trunctubs(), DDG4SolidConverter::tubs(), DDG4SolidConverter::unionsolid(), PrintGeomInfoAction::update(), Vispa.Views.PropertyView.Property::valueChanged(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDEcalBarrelAlgo::web(), and DDEcalBarrelNewAlgo::web().

54 {
55  const static std::string ano_( "anonymous" );
56  const std::string * result;
57  if( id_ == 0 ) {
58  result = &ano_;
59  }
60  else {
61  result = &DDI::Singleton<IdToName>::instance()[id_]->first.first;
62  }
63  return *result;
64 }
static value_type & instance()
id_type id_
Definition: DDName.h:52
const std::string & DDName::ns ( ) const

Returns the namespace.

Definition at line 67 of file DDName.cc.

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

Referenced by DD_NC(), DDBox::DDBox(), DDCheckAll(), DDCheckMaterial(), DDCons::DDCons(), DDCutTubs::DDCutTubs(), DDEllipticalTube::DDEllipticalTube(), DDExtrudedPolygon::DDExtrudedPolygon(), DDIntersection::DDIntersection(), DDPolycone::DDPolycone(), DDPolyhedra::DDPolyhedra(), DDPseudoTrap::DDPseudoTrap(), DDShapelessSolid::DDShapelessSolid(), DDSphere::DDSphere(), DDSubtraction::DDSubtraction(), DDTorus::DDTorus(), DDTrap::DDTrap(), DDTruncTubs::DDTruncTubs(), DDTubs::DDTubs(), DDUnion::DDUnion(), DDHtmlLpDetails::details(), DDHtmlMaDetails::details(), DDCutTubsFromPoints::execute(), fullname(), DDDividedTubsRho::makeDDLogicalPart(), DDDividedConsRho::makeDDLogicalPart(), DDDividedBoxX::makeDDLogicalPart(), DDDividedPolyhedraRho::makeDDLogicalPart(), DDDividedTrdX::makeDDLogicalPart(), DDDividedPolyconeRho::makeDDLogicalPart(), DDDividedBoxY::makeDDLogicalPart(), DDDividedConsPhi::makeDDLogicalPart(), DDDividedPolyhedraPhi::makeDDLogicalPart(), DDDividedPolyconePhi::makeDDLogicalPart(), DDDividedBoxZ::makeDDLogicalPart(), DDDividedTubsZ::makeDDLogicalPart(), DDDividedConsZ::makeDDLogicalPart(), DDDividedPolyconeZ::makeDDLogicalPart(), DDDividedTrdZ::makeDDLogicalPart(), DDDividedPolyhedraZ::makeDDLogicalPart(), DDDividedTubsPhi::makeDDRotation(), DDDividedConsPhi::makeDDRotation(), DDDividedPolyconePhi::makeDDRotation(), DDDividedPolyhedraPhi::makeDDRotation(), DDLDivision::makeDivider(), operator<<(), DDLPosPart::processElement(), DDLDivision::processElement(), DDLCompositeMaterial::processElement(), and PGeometricDetBuilder::putOne().

68 {
69  const static std::string ano_( "anonymous" );
70  const std::string * result;
71  if( id_ == 0 ) {
72  result = &ano_;
73  }
74  else {
75  result = &DDI::Singleton<IdToName>::instance()[id_]->first.second;
76  }
77  return *result;
78 }
static value_type & instance()
id_type id_
Definition: DDName.h:52
bool DDName::operator< ( const DDName rhs) const
inline

Definition at line 47 of file DDName.h.

References id_.

47 { return id_ < rhs.id_; }
id_type id_
Definition: DDName.h:52
bool DDName::operator== ( const DDName rhs) const
inline

Definition at line 48 of file DDName.h.

References id_.

48 { return id_ == rhs.id_; }
id_type id_
Definition: DDName.h:52
DDName::Registry::iterator DDName::registerName ( const std::pair< std::string, std::string > &  s)
staticprivate

Definition at line 81 of file DDName.cc.

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

Referenced by DDName().

82 {
85  Registry::size_type sz = reg.size();
86  if( !sz )
87  {
88  reg[std::make_pair( std::string(""), std::string(""))] = 0;
89  idToName.emplace_back( reg.begin());
90  ++sz;
91  }
92  Registry::value_type val( nm, sz );
93  std::pair<Registry::iterator, bool> result = reg.insert( val );
94  if( result.second ) {
95  idToName.emplace_back( result.first );
96  }
97  return result.first;
98 }
std::map< std::pair< std::string, std::string >, id_type > Registry
Definition: DDName.h:20
uint16_t size_type
static value_type & instance()
std::vector< Registry::const_iterator > IdToName
Definition: DDName.h:21

Member Data Documentation

id_type DDName::id_
private

Definition at line 52 of file DDName.h.

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