The Gaudi Framework  master (37c0b60a)
Gaudi::DataHandle Class Reference

#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/DataHandle.h>

Inheritance diagram for Gaudi::DataHandle:
Collaboration diagram for Gaudi::DataHandle:

Public Types

enum  Mode { Reader = 1 << 2, Writer = 1 << 4 }
 
using PropertyType = DataHandleProperty
 

Public Member Functions

 DataHandle (DataObjID k, Mode a=Reader, IDataHandleHolder *owner=nullptr)
 
 DataHandle (DataObjID k, bool isCond, Mode a=Reader, IDataHandleHolder *owner=nullptr)
 
virtual ~DataHandle ()=default
 
virtual void setOwner (IDataHandleHolder *o)
 
virtual IDataHandleHolderowner () const
 
virtual Mode mode () const
 
virtual void setKey (DataObjID key)
 
virtual void updateKey (std::string key)
 
virtual const std::stringobjKey () const
 
virtual const DataObjIDfullKey () const
 
virtual void reset (bool)
 
virtual std::string pythonRepr () const
 
virtual bool init ()
 
virtual bool isCondition () const
 

Protected Attributes

DataObjID m_key = { "NONE" }
 The key of the object behind this DataHandle Although it may look strange to have it mutable, this can actually change in case the object had alternative names, and it should not be visible to the end user, for which the Handle is still the same. More...
 
IDataHandleHolderm_owner = nullptr
 

Static Protected Attributes

static const std::string default_type = "unknown_t"
 

Private Attributes

Mode m_mode = Reader
 
bool m_isCond = false
 

Friends

std::ostreamoperator<< (std::ostream &str, const DataHandle &d)
 

Detailed Description

Definition at line 38 of file DataHandle.h.

Member Typedef Documentation

◆ PropertyType

Member Enumeration Documentation

◆ Mode

Enumerator
Reader 
Writer 

Definition at line 40 of file DataHandle.h.

40 { Reader = 1 << 2, Writer = 1 << 4 };

Constructor & Destructor Documentation

◆ DataHandle() [1/2]

Gaudi::DataHandle::DataHandle ( DataObjID  k,
Mode  a = Reader,
IDataHandleHolder owner = nullptr 
)
inline

Definition at line 42 of file DataHandle.h.

43  : m_key( std::move( k ) ), m_owner( owner ), m_mode( a ) {}

◆ DataHandle() [2/2]

Gaudi::DataHandle::DataHandle ( DataObjID  k,
bool  isCond,
Mode  a = Reader,
IDataHandleHolder owner = nullptr 
)
inline

Definition at line 45 of file DataHandle.h.

46  : m_key( std::move( k ) ), m_owner( owner ), m_mode( a ), m_isCond( isCond ) {}

◆ ~DataHandle()

virtual Gaudi::DataHandle::~DataHandle ( )
virtualdefault

Member Function Documentation

◆ fullKey()

virtual const DataObjID& Gaudi::DataHandle::fullKey ( ) const
inlinevirtual

Definition at line 61 of file DataHandle.h.

61 { return m_key; }

◆ init()

virtual bool Gaudi::DataHandle::init ( )
inlinevirtual

Reimplemented in DataObjectHandleBase.

Definition at line 66 of file DataHandle.h.

66 { return true; }

◆ isCondition()

virtual bool Gaudi::DataHandle::isCondition ( ) const
inlinevirtual

Definition at line 69 of file DataHandle.h.

69 { return m_isCond; }

◆ mode()

virtual Mode Gaudi::DataHandle::mode ( ) const
inlinevirtual

Definition at line 55 of file DataHandle.h.

55 { return m_mode; }

◆ objKey()

virtual const std::string& Gaudi::DataHandle::objKey ( ) const
inlinevirtual

Definition at line 60 of file DataHandle.h.

60 { return m_key.key(); }

◆ owner()

virtual IDataHandleHolder* Gaudi::DataHandle::owner ( ) const
inlinevirtual

Definition at line 53 of file DataHandle.h.

53 { return m_owner; }

◆ pythonRepr()

std::string Gaudi::DataHandle::pythonRepr ( ) const
virtual

Reimplemented in DataObjectHandle< AnyDataWithViewWrapper< View, Owned > >, DataObjectHandle< AnyDataWrapper< T > >, DataObjectHandle< std::optional< Gaudi::NamedRange_< T > > >, DataObjectHandle< Gaudi::NamedRange_< T > >, and DataObjectHandle< Gaudi::Range_< T > >.

Definition at line 19 of file DataHandle.cpp.

19  {
21  ost << "DataHandle(" << fullKey() << ", '";
22  switch ( mode() ) {
24  ost << "R";
25  break;
26  case DataHandle::Mode::Writer:
27  ost << "W";
28  break;
29  default:
30  ost << "UNKNOWN";
31  break;
32  }
33  ost << "', '" + default_type + "')";
34  return ost.str();
35  }

◆ reset()

virtual void Gaudi::DataHandle::reset ( bool  )
inlinevirtual

Definition at line 63 of file DataHandle.h.

63 {}

◆ setKey()

virtual void Gaudi::DataHandle::setKey ( DataObjID  key)
inlinevirtual

Definition at line 57 of file DataHandle.h.

57 { m_key = std::move( key ); }

◆ setOwner()

virtual void Gaudi::DataHandle::setOwner ( IDataHandleHolder o)
inlinevirtual

Definition at line 52 of file DataHandle.h.

52 { m_owner = o; }

◆ updateKey()

virtual void Gaudi::DataHandle::updateKey ( std::string  key)
inlinevirtual

Definition at line 58 of file DataHandle.h.

58 { m_key.updateKey( std::move( key ) ); }

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream str,
const DataHandle d 
)
friend

Definition at line 37 of file DataHandle.cpp.

37  {
38  str << d.fullKey() << " m: " << d.mode();
39  if ( d.owner() ) str << " o: " << d.owner()->name();
40  return str;
41  }

Member Data Documentation

◆ default_type

std::string const Gaudi::DataHandle::default_type = "unknown_t"
staticprotected

Definition at line 83 of file DataHandle.h.

◆ m_isCond

bool Gaudi::DataHandle::m_isCond = false
private

Definition at line 87 of file DataHandle.h.

◆ m_key

DataObjID Gaudi::DataHandle::m_key = { "NONE" }
protected

The key of the object behind this DataHandle Although it may look strange to have it mutable, this can actually change in case the object had alternative names, and it should not be visible to the end user, for which the Handle is still the same.

Definition at line 80 of file DataHandle.h.

◆ m_mode

Mode Gaudi::DataHandle::m_mode = Reader
private

Definition at line 86 of file DataHandle.h.

◆ m_owner

IDataHandleHolder* Gaudi::DataHandle::m_owner = nullptr
protected

Definition at line 81 of file DataHandle.h.


The documentation for this class was generated from the following files:
std::move
T move(T... args)
Gaudi::DataHandle::default_type
static const std::string default_type
Definition: DataHandle.h:83
DataObjID::updateKey
void updateKey(std::string key)
Definition: DataObjID.h:109
Gaudi::DataHandle::m_mode
Mode m_mode
Definition: DataHandle.h:86
Gaudi::DataHandle::Writer
@ Writer
Definition: DataHandle.h:40
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:53
Gaudi::DataHandle::m_owner
IDataHandleHolder * m_owner
Definition: DataHandle.h:81
std::ostringstream
STL class.
Gaudi::DataHandle::m_key
DataObjID m_key
The key of the object behind this DataHandle Although it may look strange to have it mutable,...
Definition: DataHandle.h:80
Gaudi::DataHandle::mode
virtual Mode mode() const
Definition: DataHandle.h:55
Gaudi::DataHandle::Reader
@ Reader
Definition: DataHandle.h:40
DataObjID::key
const std::string & key() const
only return the last part of the key
Definition: DataObjID.h:60
std::ostringstream::str
T str(T... args)
Gaudi::DataHandle::fullKey
virtual const DataObjID & fullKey() const
Definition: DataHandle.h:61
ProduceConsume.key
key
Definition: ProduceConsume.py:84
Gaudi::DataHandle::m_isCond
bool m_isCond
Definition: DataHandle.h:87
compareOutputFiles.Reader
Reader
Definition: compareOutputFiles.py:489