Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:13:34

0001 //==========================================================================
0002 //  AIDA Detector description implementation 
0003 //--------------------------------------------------------------------------
0004 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
0005 // All rights reserved.
0006 //
0007 // For the licensing terms see $DD4hepINSTALL/LICENSE.
0008 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
0009 //
0010 // Author     : M.Frank
0011 //
0012 //==========================================================================
0013 #ifndef DD4HEP_OBJECTEXTENSIONS_H
0014 #define DD4HEP_OBJECTEXTENSIONS_H
0015 
0016 // Framework include files
0017 #include <DD4hep/ExtensionEntry.h>
0018 
0019 // C/C++ include files
0020 #include <map>
0021 
0022 /// Namespace for the AIDA detector description toolkit
0023 namespace dd4hep {
0024 
0025   /// Implementation of an object supporting arbitrary user extensions
0026   /**
0027    *  Usage by inheritance of the client supporting the functionality
0028    *
0029    *  \author  M.Frank
0030    *  \version 1.0
0031    *  \ingroup DD4HEP_CORE
0032    */
0033   class ObjectExtensions   {
0034   public:
0035     /// The extensions object
0036     std::map<unsigned long long int, ExtensionEntry*>    extensions;   //!
0037 
0038   public:
0039     /// Default constructor
0040     ObjectExtensions(const std::type_info& parent_type);
0041     /// Copy constructor
0042     ObjectExtensions(const ObjectExtensions& copy) = delete;
0043     /// Default destructor
0044     virtual ~ObjectExtensions();
0045     /// Assignment operator
0046     ObjectExtensions& operator=(const ObjectExtensions& copy) = delete;
0047     /// Initialize non-persistent object containers (e.g. after loading from ROOT file)
0048     void initialize();
0049     /// Move extensions to target object
0050     void move(ObjectExtensions& copy);
0051     /// Clear all extensions
0052     void clear(bool destroy=true);
0053     /// Copy object extensions from another object. Hosting type must be identical!
0054     void copyFrom(const std::map<unsigned long long int,ExtensionEntry*>& ext, void* arg);
0055     /// Add an extension object to the detector element
0056     void* addExtension(unsigned long long int key, ExtensionEntry* entry);
0057     /// Remove an existing extension object from the instance
0058     void* removeExtension(unsigned long long int key, bool destroy);
0059     /// Access an existing extension object from the detector element
0060     void* extension(unsigned long long int key, bool alert) const;
0061     /// Access an existing extension object from the detector element
0062     void* extension(unsigned long long int key) const;
0063   };
0064 
0065 } /* End namespace dd4hep        */
0066 #endif // DD4HEP_OBJECTEXTENSIONS_H