| The Gaudi Framework v28r2p1 (f1a77ff4)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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