File indexing completed on 2024-11-15 09:38:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef GAUDIKERNEL_DATAHANDLE
0012 #define GAUDIKERNEL_DATAHANDLE 1
0013
0014 #include "GaudiKernel/DataHandleProperty.h"
0015 #include "GaudiKernel/DataObjID.h"
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034 class IDataHandleHolder;
0035
0036 namespace Gaudi {
0037
0038 class DataHandle {
0039 public:
0040 enum Mode { Reader = 1 << 2, Writer = 1 << 4 };
0041
0042 DataHandle( DataObjID k, Mode a = Reader, IDataHandleHolder* owner = nullptr )
0043 : m_key( std::move( k ) ), m_owner( owner ), m_mode( a ){};
0044
0045 DataHandle( DataObjID k, bool isCond, Mode a = Reader, IDataHandleHolder* owner = nullptr )
0046 : m_key( std::move( k ) ), m_owner( owner ), m_mode( a ), m_isCond( isCond ){};
0047
0048 using PropertyType = DataHandleProperty;
0049
0050 virtual ~DataHandle() = default;
0051
0052 virtual void setOwner( IDataHandleHolder* o ) { m_owner = o; }
0053 virtual IDataHandleHolder* owner() const { return m_owner; }
0054
0055 virtual Mode mode() const { return m_mode; }
0056
0057 virtual void setKey( DataObjID key ) { m_key = std::move( key ); }
0058 virtual void updateKey( std::string key ) { m_key.updateKey( std::move( key ) ); }
0059
0060 virtual const std::string& objKey() const { return m_key.key(); }
0061 virtual const DataObjID& fullKey() const { return m_key; }
0062
0063 virtual void reset( bool ){};
0064
0065 virtual std::string pythonRepr() const;
0066 virtual bool init() { return true; }
0067
0068
0069 virtual bool isCondition() const { return m_isCond; }
0070
0071 friend std::ostream& operator<<( std::ostream& str, const DataHandle& d );
0072
0073 protected:
0074
0075
0076
0077
0078
0079
0080 DataObjID m_key = { "NONE" };
0081 IDataHandleHolder* m_owner = nullptr;
0082
0083 static const std::string default_type;
0084
0085 private:
0086 Mode m_mode = Reader;
0087 bool m_isCond = false;
0088 };
0089
0090 namespace Parsers {
0091 StatusCode parse( DataHandle&, const std::string& );
0092 }
0093 namespace Utils {
0094 GAUDI_API std::ostream& toStream( const DataHandle& v, std::ostream& o );
0095 }
0096 }
0097
0098 #endif