DataObjectHandleBase.h
Go to the documentation of this file.
1 #ifndef GAUDIHIVE_DATAOBJECTHANDLEBASE_H
2 #define GAUDIHIVE_DATAOBJECTHANDLEBASE_H
3 
4 #include <mutex>
5 
7 #include "GaudiKernel/SmartIF.h"
10 
11 //---------------------------------------------------------------------------
12 
22 //---------------------------------------------------------------------------
23 
25 
26 public:
27 
31  IDataHandleHolder* owner);
32 
33  virtual ~DataObjectHandleBase();
37 
38 
39  std::string toString() const;
40  std::string pythonRepr() const override;
41  void fromString(const std::string& s);
42 
44 
46  bool isOptional() const {return m_optional;}
47  void setOptional(bool optional = true) { m_optional = optional; }
48 
49  bool initialized() const { return m_init; }
50  bool wasRead() const { return m_wasRead; }
51  bool wasWritten() const { return m_wasWritten; }
52 
53  bool isValid() const;
54 
55 protected:
56  void setRead(bool wasRead=true) {m_wasRead = wasRead;}
58 
59  bool init() override;
60 
61  DataObject* fetch() const;
62 
63 protected:
64 
67 
68  bool m_init = false;
69  bool m_optional = false;
70  bool m_wasRead = false;
71  bool m_wasWritten = false;
72 
78  mutable bool m_searchDone = false; // TODO: optimize it so that it is std::any_of( objKey, ":" )
79 
85 
86 };
87 
88 //---------------------------------------------------------------------------
89 //---------------------------------------------------------------------------
90 
91 
92 namespace Gaudi {
93  namespace Parsers {
95  }
96  namespace Utils {
98  }
99 }
100 
101 #endif
void setWritten(bool wasWritten=true)
SmartIF< IDataProviderSvc > m_EDS
void setRead(bool wasRead=true)
std::string toString() const
void setOptional(bool optional=true)
bool m_searchDone
Whether the search part of the fetch method (so dealing with alt names was already executed or not...
STL class.
DataObjectHandleBase & operator=(const DataObjectHandleBase &)
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:26
void fromString(const std::string &s)
StatusCode parse(DataObjectHandleBase &, const std::string &)
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
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...
string s
Definition: gaudirun.py:245
std::string pythonRepr() const override
DataObject * fetch() const
GAUDI_API std::ostream & toStream(const DataObjectHandleBase &v, std::ostream &o)
SmartIF< IMessageSvc > m_MS
bool isOptional() const
Check if the data object declared is optional for the algorithm.
#define GAUDI_API
Definition: Kernel.h:107
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
STL class.
friend std::ostream & operator<<(std::ostream &str, const DataObjectHandleBase &d)
Helper functions to set/get the application return code.
Definition: __init__.py:1
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:44
DataObjectHandleBase(const DataObjID &k, Gaudi::DataHandle::Mode a, IDataHandleHolder *owner)