Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-22 10:32:43

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 //
0014 // NOTE:
0015 //
0016 // This is an internal include file. It should only be included to 
0017 // instantiate code. Otherwise the Conditions include file should be
0018 // sufficient for all practical purposes.
0019 //
0020 //==========================================================================
0021 #ifndef DD4HEP_DETAIL_CONDITIONSINTERNA_H
0022 #define DD4HEP_DETAIL_CONDITIONSINTERNA_H
0023 
0024 // Framework include files
0025 #include <DD4hep/DetElement.h>
0026 #include <DD4hep/Conditions.h>
0027 #include <DD4hep/Grammar.h>
0028 #include <DD4hep/NamedObject.h>
0029 
0030 // C/C++ include files
0031 #include <map>
0032 
0033 
0034 /// Namespace for the AIDA detector description toolkit
0035 namespace dd4hep {
0036 
0037   // Forward declarations
0038   class IOVType;
0039 
0040   /// DD4hep internal namespace declaration for utilities and implementation details
0041   /** Internaly defined datastructures are not presented to the
0042    *  user directly, but are used by dedicated views.
0043    *
0044    *  \author  M.Frank
0045    *  \version 1.0
0046    *  \ingroup DD4HEP_CONDITIONS
0047    */
0048   namespace detail {
0049 
0050     /// The data class behind a conditions handle.
0051     /**
0052      *  See ConditionsInterna.cpp for the implementation.
0053      *
0054      *  \author  M.Frank
0055      *  \version 1.0
0056      *  \ingroup DD4HEP_CONDITIONS
0057      *
0058      * The copy and move constructors have been removed from this class. It would be
0059      * unsafe to copy or move an instance of it as:
0060      *  - we do not know how to copy the OpaqueDataBlock member "data"
0061      *  - there are potentially Handles pointing to instantiated ConditionObjects that would be invalid
0062      *    after a copy or move.
0063      */
0064     class ConditionObject
0065 #if defined(DD4HEP_CONDITIONS_HAVE_NAME)
0066       : public NamedObject
0067 #endif
0068     {
0069     public:
0070       /// Condition value (in string form)
0071       std::string          value;
0072 #if defined(DD4HEP_CONDITIONS_DEBUG) || !defined(DD4HEP_MINIMAL_CONDITIONS)
0073       /// Condition validity (in string form)
0074       std::string          validity;
0075       /// Condition address
0076       std::string          address;
0077       /// Comment string
0078       std::string          comment;
0079 #endif
0080       /// Data block
0081       OpaqueDataBlock      data;
0082       /// Interval of validity
0083       const IOV*           iov   = 0;     //! No ROOT persistency
0084       /// Hash value of the name
0085       Condition::key_type  hash  = 0;
0086       /// Flags
0087       Condition::mask_type flags = 0;
0088       /// Reference count
0089       int                  refCount = 1;
0090       /// Default constructor
0091       ConditionObject();
0092       /// No copy constructor
0093       ConditionObject(const ConditionObject&) = delete;
0094       // No move constructor
0095       ConditionObject(ConditionObject&&) = delete;
0096       /// Standard constructor
0097       ConditionObject(const std::string& nam,const std::string& tit="");
0098       /// Standard Destructor
0099       virtual ~ConditionObject();
0100       /// No assignment operation
0101       ConditionObject& operator=(const ConditionObject&) = delete;
0102       /// No move assignment operator
0103       ConditionObject& operator=(ConditionObject&&) = delete;
0104       /// Increase reference counter (Used by persistency mechanism)
0105       ConditionObject* addRef()  {  ++refCount; return this;         }
0106       /// Release object (Used by persistency mechanism)
0107       void release();
0108       /// Data offset from the opaque data block pointer to the condition
0109       static size_t offset();
0110       /// Move data content: 'from' will be reset to NULL
0111       ConditionObject& move(ConditionObject& from);
0112       /// Access safely the IOV
0113       const IOV* iovData() const;
0114       /// Access safely the IOV-type
0115       const IOVType* iovType() const;
0116       /// Access the bound data payload. Exception id object is unbound
0117       void* payload() const;
0118       /// Check if object is already bound....
0119       bool is_bound()  const                           {  return data.is_bound();         }
0120       bool is_traced()  const                          {  return true;                    }
0121       /// Flag operations: Set a conditons flag
0122       void setFlag(Condition::mask_type option)        {  flags |= option;                }
0123       /// Flag operations: UN-Set a conditons flag
0124       void unFlag(Condition::mask_type option)         {  flags &= ~option;               }
0125       /// Flag operations: Test for a given a conditons flag
0126       bool testFlag(Condition::mask_type option) const {  return option == (flags&option);}
0127     };
0128 
0129   }       /* End namespace detail                   */
0130 }         /* End namespace dd4hep                   */
0131 #endif // DD4HEP_DETAIL_CONDITIONSINTERNA_H