File indexing completed on 2025-01-18 09:57:37
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIHIVE_DATAOBJECTHANDLEBASE_H
0012 #define GAUDIHIVE_DATAOBJECTHANDLEBASE_H
0013
0014 #include <mutex>
0015
0016 #include "GaudiKernel/DataHandle.h"
0017 #include "GaudiKernel/IDataProviderSvc.h"
0018 #include "GaudiKernel/IMessageSvc.h"
0019 #include "GaudiKernel/IProperty.h"
0020 #include "GaudiKernel/SmartIF.h"
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 class DataObjectHandleBase : public Gaudi::DataHandle {
0036
0037 public:
0038 DataObjectHandleBase( DataObjID k, Gaudi::DataHandle::Mode a, IDataHandleHolder* owner );
0039 DataObjectHandleBase( std::string k, Gaudi::DataHandle::Mode a, IDataHandleHolder* owner );
0040
0041 ~DataObjectHandleBase() override;
0042 DataObjectHandleBase( const DataObjectHandleBase& ) = delete;
0043 DataObjectHandleBase( DataObjectHandleBase&& );
0044 DataObjectHandleBase& operator=( const DataObjectHandleBase& );
0045
0046
0047
0048 template <class OWNER, class K, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
0049 inline DataObjectHandleBase( OWNER* owner, Gaudi::DataHandle::Mode m, std::string name, K key = {},
0050 std::string doc = "" )
0051 : DataObjectHandleBase( std::move( key ), m, owner ) {
0052 auto p = owner->declareProperty( std::move( name ), *this, std::move( doc ) );
0053 p->template setOwnerType<OWNER>();
0054 }
0055
0056 friend std::ostream& operator<<( std::ostream& str, const DataObjectHandleBase& d );
0057
0058
0059 bool isOptional() const { return m_optional; }
0060 void setOptional( bool optional = true ) { m_optional = optional; }
0061
0062 bool isValid() const;
0063
0064 protected:
0065 bool init() override;
0066
0067 DataObject* fetch() const;
0068
0069 protected:
0070 SmartIF<IDataProviderSvc> m_EDS;
0071 SmartIF<IMessageSvc> m_MS;
0072
0073 bool m_init = false;
0074 bool m_optional = false;
0075 };
0076
0077 #endif