Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v36r16 (ea80daf8)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataObjectHandleBase.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2020 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #ifndef GAUDIHIVE_DATAOBJECTHANDLEBASE_H
12 #define GAUDIHIVE_DATAOBJECTHANDLEBASE_H
13 
14 #include <mutex>
15 
16 #include "GaudiKernel/DataHandle.h"
19 #include "GaudiKernel/IProperty.h"
20 #include "GaudiKernel/SmartIF.h"
21 
22 //---------------------------------------------------------------------------
23 
33 //---------------------------------------------------------------------------
34 
36 
37 public:
40 
41  ~DataObjectHandleBase() override;
45 
48  template <class OWNER, class K, typename = std::enable_if_t<std::is_base_of_v<IProperty, OWNER>>>
50  std::string doc = "" )
52  auto p = owner->declareProperty( std::move( name ), *this, std::move( doc ) );
53  p->template setOwnerType<OWNER>();
54  }
55 
56  friend std::ostream& operator<<( std::ostream& str, const DataObjectHandleBase& d );
57 
59  bool isOptional() const { return m_optional; }
60  void setOptional( bool optional = true ) { m_optional = optional; }
61 
62  bool isValid() const;
63 
64 protected:
65  bool init() override;
66 
67  DataObject* fetch() const;
68 
69 protected:
72 
73  bool m_init = false;
74  bool m_optional = false;
75 
81  mutable std::atomic<bool> m_searchDone = false; // TODO: optimize it so that it is std::any_of( objKey, ":" )
82 
88 };
89 
90 #endif
IDataHandleHolder
Definition: IDataHandleHolder.h:24
std::string
STL class.
std::move
T move(T... args)
DataObjectHandleBase::m_EDS
SmartIF< IDataProviderSvc > m_EDS
Definition: DataObjectHandleBase.h:70
DataObjectHandleBase::m_MS
SmartIF< IMessageSvc > m_MS
Definition: DataObjectHandleBase.h:71
DataObjectHandleBase::setOptional
void setOptional(bool optional=true)
Definition: DataObjectHandleBase.h:60
DataObjectHandleBase::m_optional
bool m_optional
Definition: DataObjectHandleBase.h:74
Gaudi::DataHandle
Definition: DataHandle.h:38
DataObjectHandleBase::operator=
DataObjectHandleBase & operator=(const DataObjectHandleBase &)
Definition: DataObjectHandleBase.cpp:37
IMessageSvc.h
IDataProviderSvc.h
DataObjectHandleBase::isOptional
bool isOptional() const
Check if the data object declared is optional for the algorithm.
Definition: DataObjectHandleBase.h:59
DataObjectHandleBase::DataObjectHandleBase
DataObjectHandleBase(OWNER *owner, Gaudi::DataHandle::Mode m, std::string name, K key={}, std::string doc="")
Autodeclaring constructor with property name, mode, key and documentation.
Definition: DataObjectHandleBase.h:49
SmartIF.h
TimingHistograms.name
name
Definition: TimingHistograms.py:25
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:53
DataObjectHandleBase::m_init
bool m_init
Definition: DataObjectHandleBase.h:73
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:108
std::ostream
STL class.
DataObjectHandleBase::DataObjectHandleBase
DataObjectHandleBase(const DataObjectHandleBase &)=delete
DataObjectHandleBase
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
Definition: DataObjectHandleBase.h:35
SmartIF< IDataProviderSvc >
std::atomic< bool >
DataObjID
Definition: DataObjID.h:47
DataObjectHandleBase::fetch
DataObject * fetch() const
Definition: DataObjectHandleBase.cpp:65
Gaudi::DataHandle::Mode
Mode
Definition: DataHandle.h:40
DataObjectHandleBase::m_searchDone
std::atomic< bool > m_searchDone
Whether the search part of the fetch method (so dealing with alt names was already executed or not.
Definition: DataObjectHandleBase.h:81
DataObjectHandleBase::operator<<
friend std::ostream & operator<<(std::ostream &str, const DataObjectHandleBase &d)
Definition: DataObjectHandleBase.cpp:139
DataObject
Definition: DataObject.h:40
DataHandle.h
DataObjectHandleBase::~DataObjectHandleBase
~DataObjectHandleBase() override
Definition: DataObjectHandleBase.cpp:62
std::mutex
STL class.
DataObjectHandleBase::DataObjectHandleBase
DataObjectHandleBase(DataObjID k, Gaudi::DataHandle::Mode a, IDataHandleHolder *owner)
Definition: DataObjectHandleBase.cpp:51
IProperty.h
DataObjectHandleBase::isValid
bool isValid() const
Definition: DataObjectHandleBase.cpp:135
DataObjectHandleBase::m_searchMutex
std::mutex m_searchMutex
A Mutex protecting the calls to the search part of the fetch method, so that we are sure that we only...
Definition: DataObjectHandleBase.h:87
ProduceConsume.key
key
Definition: ProduceConsume.py:81
DataObjectHandleBase::init
bool init() override
Definition: DataObjectHandleBase.cpp:110