The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
DataHandle.h
Go to the documentation of this file.
1/***********************************************************************************\
2* (c) Copyright 1998-2025 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#pragma once
12
15
16//---------------------------------------------------------------------------
17
30
31//---------------------------------------------------------------------------
32
34
35namespace Gaudi {
36
37 class DataHandle {
38 public:
39 enum Mode { Reader = 1 << 2, Writer = 1 << 4 };
40
42 : m_key( std::move( k ) ), m_owner( owner ), m_mode( a ) {}
43
44 DataHandle( DataObjID k, bool isCond, Mode a = Reader, IDataHandleHolder* owner = nullptr )
45 : m_key( std::move( k ) ), m_owner( owner ), m_mode( a ), m_isCond( isCond ) {}
46
48
49 virtual ~DataHandle() = default;
50
51 virtual void setOwner( IDataHandleHolder* o ) { m_owner = o; }
52 virtual IDataHandleHolder* owner() const { return m_owner; }
53
54 virtual Mode mode() const { return m_mode; }
55
56 virtual void setKey( DataObjID key ) { m_key = std::move( key ); }
57 virtual void updateKey( std::string key ) { m_key.updateKey( std::move( key ) ); }
58
59 virtual const std::string& objKey() const { return m_key.key(); }
60 virtual const DataObjID& fullKey() const { return m_key; }
61
62 virtual void reset( bool ) {}
63
64 virtual std::string pythonRepr() const;
65 virtual bool init() { return true; }
66
67 // is this a ConditionHandle?
68 virtual bool isCondition() const { return m_isCond; }
69
70 friend std::ostream& operator<<( std::ostream& str, const DataHandle& d );
71
72 protected:
79 DataObjID m_key = { "NONE" };
81
82 static const std::string default_type;
83
84 private:
86 bool m_isCond = false;
87 };
88
89 namespace Parsers {
90 StatusCode parse( DataHandle&, std::string_view );
91 }
92 namespace Utils {
93 GAUDI_API std::ostream& toStream( const DataHandle& v, std::ostream& o );
94 }
95} // namespace Gaudi
#define GAUDI_API
Definition Kernel.h:49
DataHandleProperty.h GaudiKernel/DataHandleProperty.h.
virtual bool init()
Definition DataHandle.h:65
DataHandle(DataObjID k, bool isCond, Mode a=Reader, IDataHandleHolder *owner=nullptr)
Definition DataHandle.h:44
virtual void setOwner(IDataHandleHolder *o)
Definition DataHandle.h:51
static const std::string default_type
Definition DataHandle.h:82
virtual std::string pythonRepr() const
friend std::ostream & operator<<(std::ostream &str, const DataHandle &d)
DataObjID m_key
The key of the object behind this DataHandle Although it may look strange to have it mutable,...
Definition DataHandle.h:79
virtual bool isCondition() const
Definition DataHandle.h:68
IDataHandleHolder * m_owner
Definition DataHandle.h:80
virtual IDataHandleHolder * owner() const
Definition DataHandle.h:52
virtual const std::string & objKey() const
Definition DataHandle.h:59
virtual void updateKey(std::string key)
Definition DataHandle.h:57
virtual Mode mode() const
Definition DataHandle.h:54
virtual void setKey(DataObjID key)
Definition DataHandle.h:56
virtual ~DataHandle()=default
virtual const DataObjID & fullKey() const
Definition DataHandle.h:60
DataHandleProperty PropertyType
Definition DataHandle.h:47
DataHandle(DataObjID k, Mode a=Reader, IDataHandleHolder *owner=nullptr)
Definition DataHandle.h:41
virtual void reset(bool)
Definition DataHandle.h:62
This class is used for returning status codes from appropriate routines.
Definition StatusCode.h:64
StatusCode parse(GaudiUtils::HashMap< K, V > &result, std::string_view input)
Basic parser for the types of HashMap used in DODBasicMapper.
std::ostream & toStream(ITERATOR first, ITERATOR last, std::ostream &s, const std::string &open, const std::string &close, const std::string &delim)
the helper function to print the sequence
Definition ToStream.h:304
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
STL namespace.