![]() |
![]() |
DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep
Rev:Unversioneddirectory
|
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects. More...
#include <Handle.h>
Public Types | |
typedef T | Implementation |
Extern accessible definition of the contained element type. More... | |
typedef Handle< Implementation > | handle_t |
Declaration of 'self'. More... | |
Public Member Functions | |
Handle ()=default | |
Defaulot constructor. More... | |
Handle (const Handle< T > &e)=default | |
Copy constructor. More... | |
Handle (T *e) | |
Initializing constructor from pointer. More... | |
template<typename Q > | |
Handle (Q *e) | |
Initializing constructor from unrelated pointer with type checking. More... | |
template<typename Q > | |
Handle (const Handle< Q > &e) | |
Initializing constructor from unrelated handle with type checking. More... | |
Handle< T > & | operator= (const Handle< T > &e)=default |
Assignment operator. More... | |
bool | operator== (const Handle< T > &e) const |
Boolean operator == used for RB tree insertions. More... | |
bool | operator< (const Handle< T > &e) const |
Boolean operator < used for RB tree insertions. More... | |
bool | operator> (const Handle< T > &e) const |
Boolean operator > used for RB tree insertions. More... | |
bool | isValid () const |
Check the validity of the object held by the handle. More... | |
bool | operator! () const |
Check the validity of the object held by the handle. More... | |
Handle< T > & | clear () |
Release the object held by the handle. More... | |
T * | operator-> () const |
Access the held object using the -> operator. More... | |
operator T & () const | |
Automatic type conversion to an object references. More... | |
T & | operator* () const |
Access the held object using the * operator. More... | |
T * | ptr () const |
Access to the held object. More... | |
template<typename Q > | |
Q * | _ptr () const |
Access to an unrelated object type. More... | |
template<typename Q > | |
Q * | data () const |
Access to an unrelated object type. More... | |
template<typename Q > | |
Q & | object () const |
Access to an unrelated object type. More... | |
T * | access () const |
Checked object access. Throws invalid handle runtime exception. More... | |
void | verifyObject () const |
Verify the object type after a (re-)assignment. More... | |
const char * | name () const |
Access the object name (or "" if not supported by the object) More... | |
void | assign (Implementation *n, const std::string &nam, const std::string &title) |
Assign a new named object. Note: object references must be managed by the user. More... | |
template<> | |
void | assign (_Segmentation *s, const std::string &n, const std::string &) |
template<> | |
const char * | name () const |
Static Public Member Functions | |
static void | bad_assignment (const std::type_info &from, const std::type_info &to) |
Helper routine called when unrelated types are assigned. More... | |
Public Attributes | |
T * | m_element = 0 |
Single and only data member: Reference to the actual element. More... | |
Handle: a templated class like a shared pointer, which allows specialized access to tgeometry objects.
The Handle is the base class to access all objects in DD4hep. Objects, which consist ONLY of data are NEVER passed directly. They are ALWAYS passed using handles. Such handles are 'handy' ;-). Assignment is to and from different handles is possible using concrete type checking.
Real benefits can result from sophisticated handle subclasses, which can implement any desired user functionality with out compromising the object's data content. This leads to very flexible implementations, where the same data may be shared by many handle implementations providing different functionality to the clients.
In this sense, is the consequent use of handles to access data nothing else then the consequent application of component oriented programming using local objects from the heap.
Note: If you cannot live with this approach, it is better you get hands of this software package, because you will try to consequently fight the framework, which will frustrate you (and also me).
typedef Handle<Implementation> DD4hep::Handle< T >::handle_t |
typedef T DD4hep::Handle< T >::Implementation |
|
default |
Defaulot constructor.
|
default |
Copy constructor.
|
inline |
|
inline |
Access to an unrelated object type.
Definition at line 153 of file Handle.h.
Referenced by DD4hep::Geometry::Volume::setMaterial().
T * DD4hep::Handle< T >::access | ( | ) | const |
Checked object access. Throws invalid handle runtime exception.
Definition at line 41 of file Handle.inl.
References DD4hep::invalidHandleError().
Referenced by DD4hep::Geometry::DetElement::add(), DD4hep::Geometry::World::alignmentsLoader(), DD4hep::Geometry::DetElement::children(), DD4hep::Geometry::DetElement::clone(), DD4hep::Geometry::SensitiveDetector::combineHits(), DD4hep::Geometry::DetElement::combineHits(), DD4hep::Geometry::World::conditionsLoader(), DD4hep::Geometry::SensitiveDetector::energyCutoff(), DD4hep::Geometry::DetElement::hasAlignments(), DD4hep::Geometry::DetElement::hasConditions(), DD4hep::Geometry::SensitiveDetector::hitsCollection(), DD4hep::Geometry::SensitiveDetector::i_addExtension(), DD4hep::Geometry::DetElement::i_addExtension(), DD4hep::Geometry::DetElement::i_addUpdateCall(), DD4hep::Geometry::SensitiveDetector::i_extension(), DD4hep::Geometry::DetElement::i_extension(), DD4hep::Geometry::DetElement::id(), DD4hep::Geometry::World::lcdd(), DD4hep::Geometry::SensitiveDetector::limits(), DD4hep::Geometry::DetElement::nominal(), DD4hep::Geometry::DetElement::parentTransformation(), DD4hep::Geometry::SensitiveDetector::readout(), DD4hep::Geometry::SensitiveDetector::region(), DD4hep::Geometry::DetElement::removeAtUpdate(), DD4hep::Geometry::SensitiveDetector::setCombineHits(), DD4hep::Geometry::DetElement::setCombineHits(), DD4hep::Geometry::SensitiveDetector::setEnergyCutoff(), DD4hep::Geometry::SensitiveDetector::setHitsCollection(), DD4hep::Geometry::SensitiveDetector::setLimitSet(), DD4hep::Geometry::DetElement::setPlacement(), DD4hep::Geometry::SensitiveDetector::setReadout(), DD4hep::Geometry::SensitiveDetector::setRegion(), DD4hep::Geometry::SensitiveDetector::setType(), DD4hep::Geometry::DetElement::setType(), DD4hep::Geometry::DetElement::setTypeFlag(), DD4hep::Geometry::SensitiveDetector::setVerbose(), DD4hep::Geometry::DetElement::survey(), DD4hep::Geometry::SensitiveDetector::verbose(), DD4hep::Geometry::DetElement::volume(), and DD4hep::Geometry::DetElement::worldTransformation().
void DD4hep::Handle< T >::assign | ( | Implementation * | n, |
const std::string & | nam, | ||
const std::string & | title | ||
) |
Assign a new named object. Note: object references must be managed by the user.
Definition at line 27 of file Handle.inl.
Referenced by DD4hep::Alignments::DetAlign::alignments(), DD4hep::Geometry::DetElementObject::assign_conditions(), DD4hep::Conditions::DetConditions::conditions(), DD4hep::Geometry::DetElement::DetElement(), DD4hep::Geometry::Readout::Readout(), DD4hep::Geometry::Segmentation::Segmentation(), and DD4hep::Geometry::SensitiveDetector::SensitiveDetector().
void DD4hep::Handle< _Segmentation >::assign | ( | _Segmentation * | s, |
const std::string & | n, | ||
const std::string & | |||
) |
Definition at line 261 of file Handle.cpp.
References s, and DD4hep::DDSegmentation::Segmentation::setName().
|
static |
Helper routine called when unrelated types are assigned.
Definition at line 21 of file Handle.inl.
References DD4hep::invalidHandleAssignmentError().
|
inline |
Release the object held by the handle.
Definition at line 132 of file Handle.h.
Referenced by DD4hep::Geometry::LCDDData::clearData(), DD4hep::Geometry::LCDDData::destroyData(), DD4hep::Geometry::DetElementObject::~DetElementObject(), and DD4hep::Geometry::SensitiveDetectorObject::~SensitiveDetectorObject().
Access to an unrelated object type.
Definition at line 157 of file Handle.h.
Referenced by DD4hep::Geometry::operator<<(), and DD4hep::Geometry::Volume::setVisAttributes().
|
inline |
Check the validity of the object held by the handle.
Definition at line 124 of file Handle.h.
Referenced by _detector(), DD4hep::Geometry::Material::A(), DD4hep::Geometry::DetElement::add(), DD4hep::Geometry::LCDDImp::addDetector(), DD4hep::DDRec::LayeringExtensionImpl::LayerAttributes::addElement(), DD4hep::Geometry::VolumeManager::addSubdetector(), DD4hep::DD4hepUI::alignmentMgr(), DD4hep::Alignments::DetAlign::alignments(), DD4hep::Geometry::DetElementObject::assign_conditions(), DD4hep::Simulation::Geant4Sensitive::cellID(), DD4hep::Simulation::Geant4VolumeManager::checkValidity(), DD4hep::Geometry::DetElement::child(), DD4hep::Geometry::GeoHandler::collect(), DD4hep::Geometry::Readout::collectionNames(), DD4hep::Geometry::Readout::collections(), DD4hep::Simulation::Geant4Converter::collectVolume(), DD4hep::Conditions::ConditionUpdateContext::condition(), DD4hep::Conditions::DetConditions::conditions(), DD4hep::Conditions::ConditionsDataLoader::ConditionsDataLoader(), DD4hep::DD4hepUI::conditionsMgr(), DD4hep::View::ConfigureEvent(), DD4hep::View::ConfigureGeometry(), DD4hep::Alignments::GlobalAlignmentWriter::createElement(), DD4hep::Utilities::createEveShape(), DD4hep::View::CreateGeometry(), DD4hep::DDRec::invalid_detector_element::createMsg(), DD4hep::XML::createPlacedEnvelope(), DD4hep::XML::createShape(), DD4hep::Geometry::LCDDImp::declareMotherVolume(), DD4hep::Geometry::Material::density(), DD4hep::DDRec::IDDecoder::detectorElement(), DD4hep::Geometry::DetectorSelector::detectors(), DD4hep::Geometry::LCDDImp::detectors(), dumpDetectors(), DD4hep::Geometry::DetectorTools::elementPath(), DD4hep::Geometry::DetectorTools::findChild(), findChildByName(), DD4hep::Geometry::DetectorTools::findDaughterElement(), DD4hep::DDRec::IDDecoder::findReadout(), DD4hep::Simulation::Geant4Sensitive::Geant4Sensitive(), DD4hep::Conditions::ConditionsDependencyHandler::get(), DD4hep::Conditions::ConditionUpdateContext::get(), DD4hep::Alignments::Container::get(), DD4hep::Conditions::Container::get(), DD4hep::Simulation::Geant4SensitiveDetector::getCellID(), DD4hep::DDRec::IDDecoder::getClosestDaughter(), DD4hep::View::GetGlobalGeometry(), DD4hep::DDRec::LayeredSubdetector::getLayeringExtension(), DD4hep::DDRec::SubdetectorExtensionImpl::getNSides(), DD4hep::DDRec::SubdetectorExtensionImpl::getRMax(), DD4hep::DDRec::SubdetectorExtensionImpl::getRMin(), DD4hep::DDRec::Subdetector::getSubdetectorExtension(), DD4hep::DDRec::Tracker::getTrackerExtension(), DD4hep::DDRec::SubdetectorExtensionImpl::getZMax(), DD4hep::DDRec::SubdetectorExtensionImpl::getZMin(), DD4hep::Simulation::Geant4Converter::handleRegion(), DD4hep::Geometry::SimpleGDMLWriter::handleVisualisation(), DD4hep::Geometry::GeometryTreeDump::handleVolume(), DD4hep::Geometry::SimpleGDMLWriter::handleVolume(), DD4hep::Simulation::Geant4Converter::handleVolume(), DD4hep::Alignments::DetAlign::hasAlignments(), DD4hep::Geometry::DetElement::hasAlignments(), DD4hep::Alignments::AlignmentData::hasCondition(), DD4hep::Conditions::DetConditions::hasConditions(), DD4hep::Geometry::DetElement::hasConditions(), DD4hep::Geometry::DetElementObject::i_access_world(), DD4hep::Geometry::GeoHandler::i_collect(), DD4hep::DDRec::IDDecoder::IDDecoder(), DD4hep::Geometry::LCDDImp::init(), DD4hep::Geometry::Material::intLength(), DD4hep::SurfaceInstaller::invalidInstaller(), DD4hep::Geometry::DetectorTools::isParentElement(), DD4hep::DD4hepUI::loadConditions(), DD4hep::Utilities::LoadDetElement(), DD4hep::Display::LoadGeoChildren(), DD4hep::Geometry::LCDDImp::mapDetectorTypes(), DD4hep::DDRec::MaterialData::MaterialData(), DD4hep::Geometry::DetElement::nominal(), DD4hep::Geometry::Readout::numCollections(), DD4hep::Conditions::ConditionsPrinter::operator()(), DD4hep::Converter< T, ARG >::operator()(), DD4hep::DDRec::MaterialData::operator=(), DD4hep::SurfaceInstaller::parentVolume(), DD4hep::Geometry::LCDDImp::pickMotherVolume(), DD4hep::Geometry::DetElement::placement(), DD4hep::Alignments::printAlignment(), printAlignmentEx(), DD4hep::Simulation::Geant4Converter::printSensitive(), DD4hep::Conditions::ConditionsProcessor::processElement(), DD4hep::Alignments::AlignmentsProcessor::processElement(), DD4hep::Geometry::Material::radLength(), DD4hep::Conditions::ConditionsManagerObject::registerUnlocked(), DD4hep::Geometry::DetElementObject::revalidate(), DD4hep::Alignments::GlobalAlignmentWriter::scan(), DD4hep::Geometry::LCDDHelper::sensitiveDetector(), DD4hep::Geometry::DetElement::setCombineHits(), DD4hep::Geometry::Readout::setIDDescriptor(), DD4hep::Geometry::Volume::setMaterial(), DD4hep::Geometry::DetElement::setPlacement(), DD4hep::Geometry::Readout::setSegmentation(), DD4hep::Geometry::Volume::setVisAttributes(), DD4hep::SurfaceInstaller::SurfaceInstaller(), DD4hep::Geometry::DetElement::survey(), DD4hep::Geometry::DetectorTools::topElement(), DD4hep::Geometry::DetElement::volumeID(), DD4hep::Geometry::VolumeManager::VolumeManager(), DD4hep::Geometry::DetElementObject::world(), DD4hep::Geometry::Material::Z(), and DD4hep::Geometry::ReadoutObject::~ReadoutObject().
const char * DD4hep::Handle< T >::name | ( | ) | const |
Access the object name (or "" if not supported by the object)
Definition at line 36 of file Handle.inl.
Referenced by DD4hep::Conditions::Test::__print_bound_container(), DD4hep::Conditions::Test::__print_bound_val(), DD4hep::Geometry::DetElement::add(), DD4hep::Geometry::LCDDImp::addDetector(), DD4hep::Geometry::VolumeManager::addSubdetector(), DD4hep::Geometry::VolumeManager::adoptPlacement(), DD4hep::Conditions::Test::check_discrete_condition(), DD4hep::View::ConfigureEvent(), DD4hep::Simulation::Geant4DetectorSensitivesConstruction::constructSensitives(), DD4hep::Simulation::Geant4Converter::create(), create_detector(), DD4hep::DDRec::MaterialManager::createAveragedMaterial(), DD4hep::View::CreateGeometry(), DD4hep::DDRec::invalid_detector_element::createMsg(), DD4hep::Simulation::Geant4SensitiveAction< T >::declareReadoutFilteredCollection(), DD4hep::Simulation::Geant4SensitiveAction< T >::defineReadoutCollection(), DD4hep::DDRec::IDDecoder::detectorElement(), dumpDetectors(), DD4hep::Geometry::DetectorTools::elementPath(), DD4hep::DDRec::findVolume(), DD4hep::Simulation::Geant4ReadoutVolumeFilter::Geant4ReadoutVolumeFilter(), DD4hep::Simulation::Geant4Sensitive::Geant4Sensitive(), DD4hep::Conditions::ConditionsManagerObject::get(), DD4hep::View::GetGlobalGeometry(), DD4hep::Simulation::Geant4Converter::handleRegion(), DD4hep::Geometry::SimpleGDMLWriter::handleVisualisation(), DD4hep::Geometry::GeometryTreeDump::handleVolume(), DD4hep::Geometry::SimpleGDMLWriter::handleVolume(), DD4hep::Simulation::Geant4Converter::handleVolume(), DD4hep::DDRec::Surface::initialize(), DD4hep::SurfaceInstaller::install(), DD4hep::SurfaceInstaller::invalidInstaller(), DD4hep::Utilities::LoadDetElement(), DD4hep::Display::LoadGeoChildren(), DD4hep::Geometry::LCDDImp::mapDetectorTypes(), DD4hep::DDRec::MaterialData::MaterialData(), DD4hep::Conditions::ConditionsPrinter::operator()(), DD4hep::DDRec::operator<<(), DD4hep::Geometry::operator<<(), DD4hep::DDRec::MaterialData::operator=(), DD4hep::Geometry::LCDDImp::pickMotherVolume(), DD4hep::Alignments::printAlignment(), DD4hep::Alignments::printElementPlacement(), DD4hep::Simulation::Geant4Converter::printSensitive(), DD4hep::Conditions::ConditionsProcessor::processElement(), DD4hep::Alignments::AlignmentsProcessor::processElement(), DD4hep::Geometry::DetElementObject::referenceTransformation(), DD4hep::Geometry::Volume::setMaterial(), DD4hep::SurfaceInstaller::SurfaceInstaller(), DD4hep::Geometry::VolumeManagerObject::update(), and DD4hep::Geometry::VolumeManager::VolumeManager().
const char * DD4hep::Handle< _Segmentation >::name | ( | ) | const |
Definition at line 265 of file Handle.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Assignment operator.
|
inline |
|
inline |
|
inline |
Access to the held object.
Definition at line 149 of file Handle.h.
Referenced by DD4hep::Conditions::ConditionsManagerObject::__queue_update(), DD4hep::Geometry::VolumeManager::_data(), DD4hep::Geometry::VolumeManager::adoptPlacement(), DD4hep::Simulation::Geant4VolumeManager::checkValidity(), DD4hep::Geometry::DetElement::child(), DD4hep::Geometry::GeoHandler::collect(), DD4hep::Alignments::AlignmentTools::computeIdeal(), DD4hep::Alignments::AlignmentTools::computeSurvey(), DD4hep::Alignments::AlignmentTools::copy(), DD4hep::Simulation::Geant4Converter::create(), DD4hep::Geometry::DetElement::DetElement(), dumpStructure(), DD4hep::Geometry::DetectorTools::elementPath(), DD4hep::Geometry::MultipoleField::fieldComponents(), DD4hep::Geometry::DetectorTools::findChild(), findChildByName(), DD4hep::Geometry::DetectorTools::findNode(), DD4hep::DDRec::findVolume(), DD4hep::Conditions::ConditionsLoaderImp::get(), DD4hep::Conditions::AlignmentsLoaderImp::get(), DD4hep::Conditions::ConditionsDependencyHandler::get(), DD4hep::Geometry::GeometryTreeDump::handleVolume(), DD4hep::Geometry::DetElementObject::i_access_world(), DD4hep::Geometry::LCDDImp::init(), DD4hep::Alignments::GlobalAlignmentCache::insert(), DD4hep::SurfaceInstaller::install(), DD4hep::Geometry::DetectorTools::isParentElement(), DD4hep::Geometry::DetElement::key(), DD4hep::Geometry::DetElement::level(), DD4hep::Utilities::LoadDetElement(), DD4hep::Display::LoadGeoChildren(), DD4hep::Conditions::make_key(), DD4hep::Alignments::AlignmentsManager::newEntry(), DD4hep::Conditions::ConditionsPool::onRegister(), DD4hep::Conditions::ConditionsPool::onRemove(), DD4hep::Alignments::DDAlignForwardCall::operator()(), DD4hep::Conditions::ConditionsPoolInsert::operator()(), DD4hep::Conditions::ConditionsPrinter::operator()(), DD4hep::Conditions::ConditionsPoolRemove::operator()(), DD4hep::Conditions::PoolInsert< pool_type >::operator()(), DD4hep::Conditions::CollectionSelect< collection_type >::operator()(), DD4hep::Conditions::ActiveSelect< collection_type >::operator()(), DD4hep::Conditions::KeyedSelect< collection_type >::operator()(), DD4hep::Geometry::DetElement::operator<(), DD4hep::Alignments::GlobalAlignment::operator=(), DD4hep::Geometry::DetElement::operator==(), DD4hep::Geometry::DetElement::parent(), DD4hep::Geometry::DetElement::path(), DD4hep::Geometry::DetElement::placementPath(), DD4hep::Alignments::printAlignment(), printAlignmentEx(), DD4hep::Alignments::printElementPlacement(), DD4hep::Geometry::DetElementObject::referenceTransformation(), DD4hep::Conditions::ConditionsManagerObject::registerCondition(), DD4hep::Geometry::DetElementObject::revalidate(), DD4hep::Geometry::Readout::setSegmentation(), DD4hep::Geometry::Volume::Volume(), DD4hep::Simulation::Geant4VolumeManager::volumeDescriptor(), DD4hep::Simulation::Geant4VolumeManager::volumeID(), DD4hep::Geometry::DetElement::world(), and DD4hep::Geometry::ReadoutObject::~ReadoutObject().
void DD4hep::Handle< T >::verifyObject | ( | ) | const |
Verify the object type after a (re-)assignment.
Referenced by DD4hep::Handle< ReadoutObject >::Handle().
T* DD4hep::Handle< T >::m_element = 0 |
Single and only data member: Reference to the actual element.
Definition at line 96 of file Handle.h.
Referenced by DD4hep::Handle< ReadoutObject >::_ptr(), DD4hep::Handle< ReadoutObject >::clear(), DD4hep::Handle< ReadoutObject >::data(), DD4hep::Handle< ReadoutObject >::isValid(), DD4hep::Handle< ReadoutObject >::object(), DD4hep::Geometry::Solid_type< TGeoTrd2 >::operator TGeoTrd2 *(), DD4hep::Geometry::Volume::operator TGeoVolume *(), DD4hep::Handle< WorldObject >::operator WorldObject &(), DD4hep::Handle< ReadoutObject >::operator!(), DD4hep::Handle< ReadoutObject >::operator*(), DD4hep::Geometry::Solid_type< TGeoBBox >::operator->(), DD4hep::Handle< ReadoutObject >::operator->(), DD4hep::Handle< ReadoutObject >::operator<(), DD4hep::Geometry::World::operator=(), DD4hep::Conditions::DetConditions::operator=(), DD4hep::Alignments::DetAlign::operator=(), DD4hep::Simulation::Geant4VolumeManager::operator=(), DD4hep::Geometry::VolumeManager::operator=(), DD4hep::Geometry::PlacedVolume::operator=(), DD4hep::Geometry::Header::operator=(), DD4hep::Geometry::Volume::operator=(), DD4hep::Geometry::Assembly::operator=(), DD4hep::Geometry::VisAttr::operator=(), DD4hep::Geometry::LimitSet::operator=(), DD4hep::Geometry::Region::operator=(), DD4hep::Geometry::WaferGridXY::operator==(), DD4hep::Geometry::PolarGridRPhi::operator==(), DD4hep::Geometry::PolarGridRPhi2::operator==(), DD4hep::Geometry::MultiSegmentation::operator==(), DD4hep::Geometry::CartesianGridXY::operator==(), DD4hep::Geometry::CartesianGridXYZ::operator==(), DD4hep::Geometry::CartesianGridYZ::operator==(), DD4hep::Geometry::CartesianGridXZ::operator==(), DD4hep::Handle< ReadoutObject >::operator==(), DD4hep::Handle< ReadoutObject >::operator>(), DD4hep::Handle< ReadoutObject >::ptr(), DD4hep::Geometry::Solid_type< TGeoBBox >::toString(), DD4hep::Geometry::SensitiveDetector::type(), DD4hep::Geometry::DetElement::type(), and DD4hep::Geometry::DetElement::typeFlag().