DDName is used to identify DDD entities uniquely. More...
#include <DDName.h>
Public Types | |
typedef DDCurrentNamespace | CNS |
typedef int | id_type |
typedef std::vector < Registry::const_iterator > | IdToName |
typedef std::map< std::pair < std::string, std::string > , id_type > | Registry |
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. | |
DDName (const std::string &name) | |
Creates a DDName with name in the current namespace defined in the singleton DDCurrentNamespace. | |
DDName (const char *name, const char *ns) | |
DDName (id_type) | |
DDName (const char *name) | |
DDName () | |
const std::string | fullname () const |
id_type | id () const |
const std::string & | name () const |
Returns the name. | |
const std::string & | ns () const |
Returns the namespace. | |
operator std::string () const | |
bool | operator< (const DDName &rhs) const |
bool | operator== (const DDName &rhs) const |
Static Public Member Functions | |
static void | defineId (const std::pair< std::string, std::string > &, id_type id) |
register pre-defined ids | |
static bool | exists (const std::string &name, const std::string &ns) |
true, if a DDName with given name and namespace (ns) already is registerd, otherwise false | |
Static Private Member Functions | |
static Registry::iterator | registerName (const std::pair< std::string, std::string > &s) |
Private Attributes | |
id_type | id_ |
Friends | |
class | DStreamer |
DDName is used to identify DDD entities uniquely.
A DDName consists of a name and a namespace. Both are represented as std::string.
typedef DDCurrentNamespace DDName::CNS |
typedef int DDName::id_type |
typedef std::vector<Registry::const_iterator> DDName::IdToName |
typedef std::map<std::pair<std::string,std::string>,id_type> DDName::Registry |
DDName::DDName | ( | const std::string & | name, |
const std::string & | ns | ||
) |
DDName::DDName | ( | const std::string & | name | ) |
Creates a DDName with name in the current namespace defined in the singleton DDCurrentNamespace.
Definition at line 24 of file DDName.cc.
References DDSplit(), id_, DDCurrentNamespace::ns(), registerName(), and query::result.
: id_(0) { std::pair<std::string,std::string> result = DDSplit(name); if (result.second == "") { id_ = registerName(std::make_pair(result.first,DDCurrentNamespace::ns()))->second; } else { id_ = registerName(result)->second; } }
DDName::DDName | ( | const char * | name | ) |
Definition at line 37 of file DDName.cc.
References DDSplit(), id_, DDCurrentNamespace::ns(), registerName(), and query::result.
: id_(0) { std::pair<std::string,std::string> result = DDSplit(name); if (result.second == "") { id_ = registerName(std::make_pair(result.first,DDCurrentNamespace::ns()))->second; } else { id_ = registerName(result)->second; } }
DDName::DDName | ( | const char * | name, |
const char * | ns | ||
) |
Definition at line 50 of file DDName.cc.
: id_(registerName(std::make_pair(std::string(name),std::string(ns)))->second) { }
DDName::DDName | ( | DDName::id_type | id | ) |
void DDName::defineId | ( | const std::pair< std::string, std::string > & | nm, |
DDName::id_type | id | ||
) | [static] |
register pre-defined ids
Definition at line 63 of file DDName.cc.
References Exception, first, id(), instance, and alignCSCRings::s.
Referenced by DDStreamer::names_read().
{ IdToName & id2n = DDI::Singleton<IdToName>::instance(); /* Semantics: If id exists && the registered value matches the given one, do nothing If id exists && the registered value DOES NOT match, throw If id DOES NOT exists, register with the given value */ if ( id < id_type(id2n.size()) ) { if(id2n[id]->first != nm) { std::stringstream s; s << id; throw cms::Exception("DDException") << "DDName::DDName(std::pair<std::string,std::string>,id_type): id=" + s.str() + " reg-name=?"; } } else { id2n.resize(id+1); DDI::Singleton<Registry>::instance()[nm]=id; id2n[id] = DDI::Singleton<Registry>::instance().find(nm); } }
bool DDName::exists | ( | const std::string & | name, |
const std::string & | ns | ||
) | [static] |
true, if a DDName with given name and namespace (ns) already is registerd, otherwise false
Definition at line 116 of file DDName.cc.
References instance, and AlCaHLTBitMon_ParallelJobs::p.
{ const std::pair<std::string,std::string> p(name,ns); Registry::const_iterator it = DDI::Singleton<Registry>::instance().find(p); return it != DDI::Singleton<Registry>::instance().end() ? true : false; }
const std::string DDName::fullname | ( | ) | const [inline] |
Returns a string complete of the namespace and name separated by ":". Most likely you want to use ns() and / or name() methods instead.
Definition at line 56 of file DDName.h.
Referenced by TGeoMgrFromDdd::createMaterial(), TGeoFromDddService::createMaterial(), TGeoMgrFromDdd::createShape(), TGeoFromDddService::createShape(), TGeoMgrFromDdd::createVolume(), TGeoFromDddService::createVolume(), DDEcalEndcapAlgo::EEPositionCRs(), DDEcalEndcapAlgo::execute(), DDErrorDetection::lp_cpv(), DDCompareSolid::operator()(), DDCompareBoolSol::operator()(), DDCompareCPV::operator()(), DDCompareDDRot::operator()(), DDCompareLP::operator()(), and DDG4SolidConverter::trunctubs().
id_type DDName::id | ( | void | ) | const [inline] |
Definition at line 61 of file DDName.h.
References id_.
Referenced by defineId(), nameout(), and operator<<().
{ return id_;}
const std::string & DDName::name | ( | ) | const |
Returns the name.
Definition at line 87 of file DDName.cc.
References id_, instance, query::result, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by DDEcalEndcapAlgo::addTmp(), DDCompactView::algoPosPart(), MaterialForOnline::beginRun(), DDG4SolidConverter::box(), MagGeoBuilderFromDDD::build(), RPCGeometryBuilderFromDDD::buildGeometry(), GEMGeometryBuilderFromDDD::buildGeometry(), GEMGeometryParsFromDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), DDG4SolidConverter::cons(), DDHCalBarrelAlgo::constructInsideDetectors(), DDHCalEndcapAlgo::constructInsideModule(), DDHCalEndcapAlgo::constructInsideModule0(), DDG4Builder::convertLV(), DDG4Builder::convertMaterial(), TGeoMgrFromDdd::createShape(), TGeoFromDddService::createShape(), DD_NC(), DDBox::DDBox(), DDCheckAll(), DDCheckMaterial(), DDCons::DDCons(), DDEllipsoid::DDEllipsoid(), DDEllipticalTube::DDEllipticalTube(), DDIntersection::DDIntersection(), DDOrb::DDOrb(), DDParallelepiped::DDParallelepiped(), DDPolycone::DDPolycone(), DDPolyhedra::DDPolyhedra(), DDPseudoTrap::DDPseudoTrap(), DDrot(), DDrotReflect(), DDShapelessSolid::DDShapelessSolid(), DDSphere::DDSphere(), DDSubtraction::DDSubtraction(), DDTorus::DDTorus(), DDTrap::DDTrap(), DDTruncTubs::DDTruncTubs(), DDTubs::DDTubs(), DDUnion::DDUnion(), DDG4SolidConverter::ellipsoid(), DDG4SolidConverter::ellipticaltube(), DDTBH4Algo::execute(), DDPixBarStackLayerAlgo::execute(), DDTIBLayerAlgo_MTCC::execute(), DDEcalBarrelNewAlgo::execute(), DDPixBarLayerAlgo::execute(), DDEcalBarrelAlgo::execute(), DDTECModuleAlgo::execute(), DDTIBLayerAlgo::execute(), DDPixBarTPGStackLayerAlgo::execute(), DDTIDRingAlgo::execute(), DDHCalForwardAlgo::execute(), DDPixBarLayerUpgradeAlgoCoverage::execute(), DDPixBarLayerUpgradeAlgo::execute(), fullname(), HcalTB06BeamSD::getNames(), MaterialBudgetHcalHistos::getNames(), HCalSD::getNames(), HCalSD::HCalSD(), HcalTB06BeamSD::HcalTB06BeamSD(), HcalTB02SD::initMap(), ECalSD::initMap(), DreamSD::initMap(), DDG4SolidConverter::intersection(), CmsTrackerDebugNavigator::iterate(), DDDividedConsRho::makeDDLogicalPart(), DDDividedBoxX::makeDDLogicalPart(), DDDividedTrdZ::makeDDLogicalPart(), DDDividedConsZ::makeDDLogicalPart(), DDDividedPolyhedraPhi::makeDDLogicalPart(), DDDividedConsPhi::makeDDLogicalPart(), DDDividedPolyconePhi::makeDDLogicalPart(), DDDividedPolyhedraRho::makeDDLogicalPart(), DDDividedTrdX::makeDDLogicalPart(), DDDividedBoxZ::makeDDLogicalPart(), DDDividedPolyhedraZ::makeDDLogicalPart(), DDDividedTubsRho::makeDDLogicalPart(), DDDividedBoxY::makeDDLogicalPart(), DDDividedPolyconeRho::makeDDLogicalPart(), DDDividedPolyconeZ::makeDDLogicalPart(), DDDividedTubsZ::makeDDLogicalPart(), DDDividedPolyconePhi::makeDDRotation(), DDDividedConsPhi::makeDDRotation(), DDDividedTubsPhi::makeDDRotation(), DDDividedPolyhedraPhi::makeDDRotation(), DDLDivision::makeDivider(), nameout_strings(), operator std::string(), DDCompareEPV::operator()(), operator<<(), DDG4SolidConverter::orb(), DDG4SolidConverter::para(), DDG4SolidConverter::polycone_rrz(), DDG4SolidConverter::polycone_rz(), DDG4SolidConverter::polyhedra_rrz(), DDG4SolidConverter::polyhedra_rz(), DDLDivision::processElement(), DDLCompositeMaterial::processElement(), DDLPosPart::processElement(), DDLRotationByAxis::processElement(), DDG4SolidConverter::pseudotrap(), GeometricDetLoader::putOne(), PGeometricDetBuilder::putOne(), CocoaAnalyzer::ReadXMLFile(), DDG4SolidConverter::reflected(), DDG4SolidConverter::sphere(), DDG4SolidConverter::subtraction(), DDG4SolidConverter::torus(), DDG4SolidConverter::trap(), DDG4SolidConverter::trunctubs(), DDG4SolidConverter::tubs(), DDG4SolidConverter::unionsolid(), PrintGeomInfoAction::update(), MagGeoBuilderFromDDD::volumeHandle::volumeHandle(), DDEcalBarrelNewAlgo::web(), and DDEcalBarrelAlgo::web().
{ static std::string ano_("anonymous"); const std::string * result; if (id_ < 0) { result = &ano_; } else { result = &DDI::Singleton<IdToName>::instance()[id_]->first.first; } return *result; }
const std::string & DDName::ns | ( | ) | const |
Returns the namespace.
Definition at line 101 of file DDName.cc.
References id_, instance, query::result, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by DDCompactView::algoPosPart(), DD_NC(), DDBox::DDBox(), DDCheckAll(), DDCheckMaterial(), DDCons::DDCons(), DDEllipsoid::DDEllipsoid(), DDEllipticalTube::DDEllipticalTube(), DDIntersection::DDIntersection(), DDOrb::DDOrb(), DDParallelepiped::DDParallelepiped(), DDPolycone::DDPolycone(), DDPolyhedra::DDPolyhedra(), DDPseudoTrap::DDPseudoTrap(), DDShapelessSolid::DDShapelessSolid(), DDSphere::DDSphere(), DDSubtraction::DDSubtraction(), DDTorus::DDTorus(), DDTrap::DDTrap(), DDTruncTubs::DDTruncTubs(), DDTubs::DDTubs(), DDUnion::DDUnion(), fullname(), hierarchy(), DDDividedConsRho::makeDDLogicalPart(), DDDividedBoxX::makeDDLogicalPart(), DDDividedTrdZ::makeDDLogicalPart(), DDDividedConsZ::makeDDLogicalPart(), DDDividedPolyhedraPhi::makeDDLogicalPart(), DDDividedConsPhi::makeDDLogicalPart(), DDDividedPolyconePhi::makeDDLogicalPart(), DDDividedPolyhedraRho::makeDDLogicalPart(), DDDividedTrdX::makeDDLogicalPart(), DDDividedBoxZ::makeDDLogicalPart(), DDDividedPolyhedraZ::makeDDLogicalPart(), DDDividedTubsRho::makeDDLogicalPart(), DDDividedBoxY::makeDDLogicalPart(), DDDividedPolyconeRho::makeDDLogicalPart(), DDDividedPolyconeZ::makeDDLogicalPart(), DDDividedTubsZ::makeDDLogicalPart(), DDDividedPolyconePhi::makeDDRotation(), DDDividedConsPhi::makeDDRotation(), DDDividedTubsPhi::makeDDRotation(), DDDividedPolyhedraPhi::makeDDRotation(), DDLDivision::makeDivider(), nameout_strings(), operator std::string(), operator<<(), DDLDivision::processElement(), DDLCompositeMaterial::processElement(), DDLPosPart::processElement(), and PGeometricDetBuilder::putOne().
{ static std::string ano_("anonymous"); const std::string * result; if (id_ < 0) { result = &ano_; } else { result = &DDI::Singleton<IdToName>::instance()[id_]->first.second; } return *result; }
DDName::operator std::string | ( | ) | const [inline] |
bool DDName::operator< | ( | const DDName & | rhs | ) | const [inline] |
bool DDName::operator== | ( | const DDName & | rhs | ) | const [inline] |
DDName::Registry::iterator DDName::registerName | ( | const std::pair< std::string, std::string > & | s | ) | [static, private] |
Definition at line 124 of file DDName.cc.
References instance, query::result, and AlCaHLTBitMon_QueryRunRegistry::string.
Referenced by DDName().
{ Registry& reg_ = DDI::Singleton<Registry>::instance(); IdToName & idToName = DDI::Singleton<IdToName>::instance(); Registry::size_type sz = reg_.size(); if (!sz) { reg_[std::make_pair(std::string(""),std::string(""))] = 0; idToName.push_back(reg_.begin()); ++sz; } Registry::value_type val(nm, sz); std::pair<Registry::iterator,bool> result = reg_.insert(val); if (result.second) { idToName.push_back(result.first); } return result.first; }
id_type DDName::id_ [private] |
Definition at line 67 of file DDName.h.
Referenced by DDName(), id(), name(), ns(), operator<(), and operator==().