diff --git a/DDCore/include/DD4hep/Fields.h b/DDCore/include/DD4hep/Fields.h index f1c9594e4197524a5248325ff12708119e44b6ca..b19014b21e6f6a9bcbb2a2d95eaea23b8de00860 100644 --- a/DDCore/include/DD4hep/Fields.h +++ b/DDCore/include/DD4hep/Fields.h @@ -47,7 +47,7 @@ namespace DD4hep { typedef std::map<std::string,PropertyValues> Properties; /// Internal data class shared by all handles of a given type - struct Object { + struct Object : public TNamed { /// Field type int type; /// Field extensions @@ -114,7 +114,7 @@ namespace DD4hep { typedef std::map<std::string,std::string> PropertyValues; typedef std::map<std::string,PropertyValues> Properties; - struct Object { + struct Object : public TNamed { int type; CartesianField electric; CartesianField magnetic; diff --git a/DDCore/include/DD4hep/Objects.h b/DDCore/include/DD4hep/Objects.h index 7b403f2b95e9e0e72af84794024879d019d40b74..9e69323896ef18c3680d0e334cd6edf9cc4d2211 100644 --- a/DDCore/include/DD4hep/Objects.h +++ b/DDCore/include/DD4hep/Objects.h @@ -66,6 +66,8 @@ namespace DD4hep { * @version 1.0 */ struct Author : public Ref_t { + /// Definition of the implementation type + typedef TNamed Object; /// Default constructor Author() : Ref_t() {} /// Constructorto be used for assignment from a handle @@ -94,7 +96,7 @@ namespace DD4hep { * @version 1.0 */ struct Header : public Ref_t { - struct Object { + struct Object : public TNamed { std::string url; std::string author; std::string status; @@ -149,6 +151,8 @@ namespace DD4hep { * @version 1.0 */ struct Constant : public Ref_t { + /// Definition of the implementation type + typedef TNamed Object; /// Default constructor Constant() : Ref_t() {} /// Constructorto be used for assignment from a handle @@ -211,6 +215,8 @@ namespace DD4hep { * @version 1.0 */ struct Atom : public Handle<TGeoElement> { + /// Definition of the implementation type + typedef TGeoElement Object; /// Default constructor Atom() : Handle<TGeoElement>() {} /// Constructorto be used for assignment from a handle @@ -228,6 +234,8 @@ namespace DD4hep { * @version 1.0 */ struct Material : public Handle<TGeoMedium> { + /// Definition of the implementation type + typedef TGeoMedium Object; /// Default constructor Material() : Handle<TGeoMedium>() {} /// Constructorto be used for assignment from material handle @@ -253,7 +261,7 @@ namespace DD4hep { DASHED=0x2, LAST_STYLE }; - struct Object { + struct Object : public TNamed { unsigned long magic; void* col; int color; @@ -276,9 +284,6 @@ namespace DD4hep { /// Assignment operator VisAttr& operator=(const VisAttr& attr) { m_element = attr.m_element; return *this; } - /// Additional data accessor - Object& _data() const { return *data<Object>(); } - /// Get Flag to show/hide daughter elements bool showDaughters() const; /// Set Flag to show/hide daughter elements @@ -371,7 +376,7 @@ namespace DD4hep { * @version 1.0 */ struct LimitSet : public Ref_t { - struct Object : public std::set<Limit> { + struct Object : public TNamed, public std::set<Limit> { /// Standard constructor Object(); /// Default destructor @@ -396,7 +401,7 @@ namespace DD4hep { * @version 1.0 */ struct Region : public Ref_t { - struct Object { + struct Object : public TNamed { unsigned long magic; double threshold; double cut; @@ -416,8 +421,6 @@ namespace DD4hep { /// Constructor to be used when creating a new object Region(const std::string& name); - /// Additional data accessor - Object& _data() const { return *data<Object>(); } Region& setStoreSecondaries(bool value); Region& setThreshold(double value); Region& setCut(double value); diff --git a/DDCore/include/DD4hep/Readout.h b/DDCore/include/DD4hep/Readout.h index 271bf7a87ba3392e19807dfaf102410ba611bf50..690064105b75f6e0dee1eb741f3e9f8b7bb1d3ac 100644 --- a/DDCore/include/DD4hep/Readout.h +++ b/DDCore/include/DD4hep/Readout.h @@ -32,14 +32,14 @@ namespace DD4hep { * @version 1.0 */ struct Readout : public Ref_t { - public: - + public: + /** @class Readout::Object Readout.h DD4hep/Readout.h * * @author M.Frank * @version 1.0 */ - struct Object { + struct Object : public TNamed { /// Handle to the readout segmentation Segmentation segmentation; /// Handle to the volume @@ -51,11 +51,7 @@ namespace DD4hep { /// Default destructor ~Object(); }; - protected: - /// Additional data accessor - Object& _data() const { return *data<Object>(); } - - public: + public: /// Default constructor Readout() : Ref_t() {} /// Constructor to be used when reading the already parsed object @@ -78,7 +74,7 @@ namespace DD4hep { * @version 1.0 */ struct Alignment : public Ref_t { - struct Object { + struct Object : public TNamed { Volume volume; }; /// Default constructor @@ -97,7 +93,7 @@ namespace DD4hep { * @version 1.0 */ struct Conditions : public Ref_t { - struct Object { + struct Object : public TNamed { }; /// Default constructor Conditions() : Ref_t() {} diff --git a/DDCore/src/Fields.cpp b/DDCore/src/Fields.cpp index 83a0866537fe1821b3a7fc14787008645303f422..e3f532f00c91b8048a4df357e6b9595a009b527f 100644 --- a/DDCore/src/Fields.cpp +++ b/DDCore/src/Fields.cpp @@ -21,7 +21,7 @@ namespace { } /// Default constructor -CartesianField::Object::Object() : type(UNKNOWN) { +CartesianField::Object::Object() : TNamed(), type(UNKNOWN) { InstanceCount::increment(this); } @@ -62,8 +62,7 @@ OverlayedField::Object::~Object() { /// Object constructor OverlayedField::OverlayedField(const string& name) : Ref_t() { - Value<TNamed,Object>* ptr = new Value<TNamed,Object>(); - assign(ptr,name,"overlay_field"); + assign(new Object(),name,"overlay_field"); } /// Access to properties container diff --git a/DDCore/src/LCDDImp.cpp b/DDCore/src/LCDDImp.cpp index 6d66e0e4ed75440830817032cec04616818d8577..f76188460cbf3db5d80a1eac2e381dcc841f16ce 100644 --- a/DDCore/src/LCDDImp.cpp +++ b/DDCore/src/LCDDImp.cpp @@ -40,7 +40,7 @@ using namespace DD4hep; using namespace std; namespace { struct TopDetElement : public DetElement { - TopDetElement(const string& nam, Volume vol) : DetElement(nam,/* "structure", */0) { _data().volume = vol; } + TopDetElement(const string& nam, Volume vol) : DetElement(nam,/* "structure", */0) { object<Object>().volume = vol; } }; struct TypePreserve { LCDDBuildType& m_t; diff --git a/DDCore/src/Readout.cpp b/DDCore/src/Readout.cpp index 59766c279b0340314a5f2dd89dd7ece3397b3867..3b425a5d28abb1a40f189676bc5e7a9bee15c97c 100644 --- a/DDCore/src/Readout.cpp +++ b/DDCore/src/Readout.cpp @@ -27,14 +27,14 @@ Readout::Object::~Object() { /// Initializing constructor to create a new object Readout::Readout(const string& nam) { - assign(new Value<TNamed,Object>(),nam,"readout"); + assign(new Object(),nam,"readout"); } /// Assign IDDescription to readout structure void Readout::setIDDescriptor(const Ref_t& new_descriptor) const { if ( isValid() ) { // Remember: segmentation is NOT owned by readout structure! if ( new_descriptor.isValid() ) { // Do NOT delete! - _data().id = new_descriptor; + object<Object>().id = new_descriptor; return; } } @@ -43,13 +43,13 @@ void Readout::setIDDescriptor(const Ref_t& new_descriptor) const { /// Access IDDescription structure IDDescriptor Readout::idSpec() const { - return _data().id; + return object<Object>().id; } /// Assign segmentation structure to readout void Readout::setSegmentation(const Segmentation& seg) const { if ( isValid() ) { - Object& ro = _data(); + Object& ro = object<Object>(); Segmentation::Implementation* e = ro.segmentation.ptr(); if ( e ) { // Remember: segmentation is owned by readout structure! delete e; // Need to delete the segmentation object @@ -64,17 +64,17 @@ void Readout::setSegmentation(const Segmentation& seg) const { /// Access segmentation structure Segmentation Readout::segmentation() const { - return _data().segmentation; + return object<Object>().segmentation; } /// Initializing constructor to create a new object Alignment::Alignment(const LCDD& /* lcdd */, const string& nam) { - assign(new Value<TNamed,Object>(),nam,"alignment"); + assign(new Object(),nam,"alignment"); } /// Initializing constructor to create a new object Conditions::Conditions(const LCDD& /* lcdd */, const string& nam) { - assign(new Value<TNamed,Object>(),nam,"conditions"); + assign(new Object(),nam,"conditions"); }