| The Gaudi Framework v27r1

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
DataObjectHandleBase Class Reference

DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h. More...

`#include <GaudiKernel/DataObjectHandleBase.h>`

Inheritance diagram for DataObjectHandleBase:
[legend]
Collaboration diagram for DataObjectHandleBase:
[legend]

## Public Member Functions
| DataObjectHandleBase ()
| DataObjectHandleBase (const DataObjID &k, Gaudi::DataHandle::Mode a, IDataHandleHolder *o)
| DataObjectHandleBase (const std::string &k, Gaudi::DataHandle::Mode a, IDataHandleHolder *o)
virtual | ~DataObjectHandleBase ()
const std::string | toString () const
const std::string | pythonRepr () const
void | fromString (const std::string &s)
bool | isOptional () const
| Check if the data object declared is optional for the algorithm. More...
void | setOptional (bool optional=true)
const std::vector< std::string > & | alternativeDataProductNames () const
void | setAlternativeDataProductNames (const std::vector< std::string > &alternativeAddresses)
bool | initialized () const
bool | wasRead () const
bool | wasWritten () const
bool | isValid () const
Public Member Functions inherited from Gaudi::DataHandle
| DataHandle ()
| DataHandle (const DataObjID &k, Mode a=Reader, IDataHandleHolder *owner=0)
virtual | ~DataHandle ()
virtual void | setOwner (IDataHandleHolder *o)
virtual IDataHandleHolder * | owner () const
virtual Mode | mode () const
virtual void | setKey (const DataObjID &key)
virtual void | updateKey (const std::string &key)
virtual const std::string & | objKey () const
virtual const DataObjID & | fullKey () const
virtual void | reset (bool)
virtual StatusCode | commit ()

## Protected Member Functions
void | setRead (bool wasRead=true)
void | setWritten (bool wasWritten=true)
void | init ()
Protected Member Functions inherited from Gaudi::DataHandle
virtual void | setMode (const Mode &mode)

## Protected Attributes
SmartIF< IDataProviderSvc > | m_EDS
SmartIF< IMessageSvc > | m_MS
bool | m_init
bool | m_goodType
bool | m_optional
bool | m_wasRead
bool | m_wasWritten
std::vector< std::string > | m_altNames
Protected Attributes inherited from Gaudi::DataHandle
DataObjID | m_key
IDataHandleHolder * | m_owner

## Friends
std::ostream & | operator<< (std::ostream &str, const DataObjectHandleBase &d)

## Additional Inherited Members
Public Types inherited from Gaudi::DataHandle
enum | Mode { Reader = 1<<2, Writer = 1<<4, Updater = Reader | Writer }

## Detailed Description

DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.

Base class for handles to Data Objects in the Event Store, to simplify access via Properties.

provides accessors to AlternateNames, and Optional parameters

Author
  Charles Leggett

Date
  2015-09-01

Definition at line 24 of file DataObjectHandleBase.h.

## Constructor & Destructor Documentation

DataObjectHandleBase::DataObjectHandleBase | ( |  | ) |

Definition at line 15 of file DataObjectHandleBase.cpp.

15 :
16 Gaudi::DataHandle(), m_init(false),
17 m_goodType(false), m_optional(false), m_wasRead(false), m_wasWritten(false) {}
DataObjectHandleBase::m_wasRead
bool m_wasRead
Definition: DataObjectHandleBase.h:72
DataObjectHandleBase::m_init
bool m_init
Definition: DataObjectHandleBase.h:69
DataObjectHandleBase::m_optional
bool m_optional
Definition: DataObjectHandleBase.h:71
DataObjectHandleBase::m_goodType
bool m_goodType
Definition: DataObjectHandleBase.h:70
Gaudi::DataHandle
Definition: DataHandle.h:27
DataObjectHandleBase::m_wasWritten
bool m_wasWritten
Definition: DataObjectHandleBase.h:72

DataObjectHandleBase::DataObjectHandleBase | ( | const DataObjID & | k,
|  | Gaudi::DataHandle::Mode | a,
|  | IDataHandleHolder * | o
| ) |  |

Definition at line 20 of file DataObjectHandleBase.cpp.

22 :
23 Gaudi::DataHandle(k,a,owner), m_init(false), m_goodType(false),
24 m_optional(false), m_wasRead(false), m_wasWritten(false) {}
DataObjectHandleBase::m_wasRead
bool m_wasRead
Definition: DataObjectHandleBase.h:72
DataObjectHandleBase::m_init
bool m_init
Definition: DataObjectHandleBase.h:69
DataObjectHandleBase::m_optional
bool m_optional
Definition: DataObjectHandleBase.h:71
DataObjectHandleBase::m_goodType
bool m_goodType
Definition: DataObjectHandleBase.h:70
Gaudi::DataHandle
Definition: DataHandle.h:27
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:45
DataObjectHandleBase::m_wasWritten
bool m_wasWritten
Definition: DataObjectHandleBase.h:72

DataObjectHandleBase::DataObjectHandleBase | ( | const std::string & | k,
|  | Gaudi::DataHandle::Mode | a,
|  | IDataHandleHolder * | o
| ) |  |

Definition at line 28 of file DataObjectHandleBase.cpp.

30 :
31 DataObjectHandleBase(DataObjID(k), a, owner){}
DataObjID
Definition: DataObjID.h:38
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:45
DataObjectHandleBase::DataObjectHandleBase
DataObjectHandleBase()
Definition: DataObjectHandleBase.cpp:15

virtual DataObjectHandleBase::~DataObjectHandleBase | ( |  | ) |
| inline virtual

Definition at line 34 of file DataObjectHandleBase.h.

34 {}

## Member Function Documentation

const std::vector<std::string>& DataObjectHandleBase::alternativeDataProductNames | ( |  | ) | const
| inline

Definition at line 48 of file DataObjectHandleBase.h.

48 {
49 return m_altNames; }
DataObjectHandleBase::m_altNames
std::vector< std::string > m_altNames
Definition: DataObjectHandleBase.h:74

void DataObjectHandleBase::fromString | ( | const std::string & | s | ) |

Definition at line 54 of file DataObjectHandleBase.cpp.

54 {
55 Gaudi::Parsers::parse(*this,s).ignore();
56 }
Gaudi::Parsers::parse
StatusCode parse(GaudiUtils::HashMap< K, V > &result, const std::string &input)
Basic parser for the types of HashMap used in DODBasicMapper.
Definition: DODBasicMapper.cpp:11
StatusCode::ignore
void ignore() const
Definition: StatusCode.h:108

void DataObjectHandleBase::init | ( |  | ) |
| protected

Definition at line 61 of file DataObjectHandleBase.cpp.

61 {
62
63 if (m_init) return;
64
65 if (m_owner == 0) return;
66
67 setRead(false);
68 setWritten(false);
69
70 Algorithm* algorithm = dynamic_cast<Algorithm*>( m_owner );
71 if (algorithm != 0) {
72 // Fetch the event Data Service from the algorithm
73 m_EDS = algorithm->evtSvc();
74 m_MS = algorithm->msgSvc();
75 } else {
76 AlgTool* tool = dynamic_cast<AlgTool*>( owner() );
77 if (tool != 0) {
78 m_EDS = tool->evtSvc();
79 m_MS = tool->msgSvc();
80 } else {
81 throw GaudiException( "owner is not an AlgTool or Algorithm" ,
82 "Invalid Cast", StatusCode::FAILURE) ;
83 }
84 }
85
86 m_init = true;
87
88 }
DataObjectHandleBase::setWritten
void setWritten(bool wasWritten=true)
Definition: DataObjectHandleBase.h:60
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
DataObjectHandleBase::m_EDS
SmartIF< IDataProviderSvc > m_EDS
Definition: DataObjectHandleBase.h:66
DataObjectHandleBase::m_init
bool m_init
Definition: DataObjectHandleBase.h:69
DataObjectHandleBase::setRead
void setRead(bool wasRead=true)
Definition: DataObjectHandleBase.h:59
StatusCode::FAILURE
Definition: StatusCode.h:29
Gaudi::DataHandle::m_owner
IDataHandleHolder * m_owner
Definition: DataHandle.h:64
AlgTool::evtSvc
IDataProviderSvc * evtSvc() const
accessor to event service service
Definition: AlgTool.cpp:95
Algorithm
Base class from which all concrete algorithm classes should be derived.
Definition: Algorithm.h:74
Algorithm::evtSvc
SmartIF< IDataProviderSvc > & evtSvc() const
shortcut for method eventSvc
Definition: Algorithm.h:284
AlgTool
Base class from which all the concrete tool classes should be derived.
Definition: AlgTool.h:45
CommonMessagingBase::msgSvc
SmartIF< IMessageSvc > & msgSvc() const
The standard message service.
Definition: CommonMessaging.h:73
DataObjectHandleBase::m_MS
SmartIF< IMessageSvc > m_MS
Definition: DataObjectHandleBase.h:67
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:45

bool DataObjectHandleBase::initialized | ( |  | ) | const
| inline

Definition at line 52 of file DataObjectHandleBase.h.

52 { return m_init; }
DataObjectHandleBase::m_init
bool m_init
Definition: DataObjectHandleBase.h:69

bool DataObjectHandleBase::isOptional | ( |  | ) | const
| inline

Check if the data object declared is optional for the algorithm.

Definition at line 45 of file DataObjectHandleBase.h.

45 {return m_optional;}
DataObjectHandleBase::m_optional
bool m_optional
Definition: DataObjectHandleBase.h:71

bool DataObjectHandleBase::isValid | ( |  | ) | const

Definition at line 93 of file DataObjectHandleBase.cpp.

93 {
94
95 return ( fullKey() != INVALID_DATAOBJID );
96
97 }
Gaudi::DataHandle::fullKey
virtual const DataObjID & fullKey() const
Definition: DataHandle.h:53
INVALID_DATAOBJID
const DataObjID INVALID_DATAOBJID
Definition: DataObjectHandleBase.cpp:11

const std::string DataObjectHandleBase::pythonRepr | ( |  | ) | const
| virtual

Reimplemented from Gaudi::DataHandle.

Definition at line 48 of file DataObjectHandleBase.cpp.

48 {
49 return "DataObjectHandleBase(\"" + toString() + "\")";
50 }
DataObjectHandleBase::toString
const std::string toString() const
Definition: DataObjectHandleBase.cpp:36

void DataObjectHandleBase::setAlternativeDataProductNames | ( | const std::vector< std::string > & | alternativeAddresses | ) |
| inline

Definition at line 50 of file DataObjectHandleBase.h.

50 { m_altNames = alternativeAddresses; }
DataObjectHandleBase::m_altNames
std::vector< std::string > m_altNames
Definition: DataObjectHandleBase.h:74

void DataObjectHandleBase::setOptional | ( | bool | optional = `true` | ) |
| inline

Definition at line 46 of file DataObjectHandleBase.h.

46 { m_optional = optional; }
DataObjectHandleBase::m_optional
bool m_optional
Definition: DataObjectHandleBase.h:71

void DataObjectHandleBase::setRead | ( | bool | wasRead = `true` | ) |
| inline protected

Definition at line 59 of file DataObjectHandleBase.h.

59 {m_wasRead = wasRead;}
DataObjectHandleBase::m_wasRead
bool m_wasRead
Definition: DataObjectHandleBase.h:72
DataObjectHandleBase::wasRead
bool wasRead() const
Definition: DataObjectHandleBase.h:53

void DataObjectHandleBase::setWritten | ( | bool | wasWritten = `true` | ) |
| inline protected

Definition at line 60 of file DataObjectHandleBase.h.

60 {m_wasWritten = wasWritten;}
DataObjectHandleBase::wasWritten
bool wasWritten() const
Definition: DataObjectHandleBase.h:54
DataObjectHandleBase::m_wasWritten
bool m_wasWritten
Definition: DataObjectHandleBase.h:72

const std::string DataObjectHandleBase::toString | ( |  | ) | const

Definition at line 36 of file DataObjectHandleBase.cpp.

36 {
37 std::ostringstream ost;
38 ost << m_key << "|" << mode() << "|" << isOptional() << "|";
39 for (auto &a : m_altNames) {
40 ost << a << "&";
41 }
42 // ost << ")";
43 return ost.str();
44 }
Gaudi::DataHandle::mode
virtual Mode mode() const
Definition: DataHandle.h:47
Gaudi::DataHandle::m_key
DataObjID m_key
Definition: DataHandle.h:63
std::ostringstream
STL class.
std::ostringstream::str
T str(T...args)
DataObjectHandleBase::m_altNames
std::vector< std::string > m_altNames
Definition: DataObjectHandleBase.h:74
DataObjectHandleBase::isOptional
bool isOptional() const
Check if the data object declared is optional for the algorithm.
Definition: DataObjectHandleBase.h:45

bool DataObjectHandleBase::wasRead | ( |  | ) | const
| inline

Definition at line 53 of file DataObjectHandleBase.h.

53 { return m_wasRead; }
DataObjectHandleBase::m_wasRead
bool m_wasRead
Definition: DataObjectHandleBase.h:72

bool DataObjectHandleBase::wasWritten | ( |  | ) | const
| inline

Definition at line 54 of file DataObjectHandleBase.h.

54 { return m_wasWritten; }
DataObjectHandleBase::m_wasWritten
bool m_wasWritten
Definition: DataObjectHandleBase.h:72

## Friends And Related Function Documentation

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

Definition at line 102 of file DataObjectHandleBase.cpp.

102 {
103
104 str << d.fullKey() << " m: " << d.mode();
105 if (d.owner() != 0) {
106 str << " o: " << d.owner()->name();
107 }
108
109 str << " opt: " << d.isOptional();
110
111 if (d.alternativeDataProductNames().size() != 0) {
112 str << " alt: [";
113 for ( auto &n : d.alternativeDataProductNames()) {
114 str << n << ",";
115 }
116 str << "]";
117 }
118
119 return str;
120 }
Gaudi::DataHandle::mode
virtual Mode mode() const
Definition: DataHandle.h:47
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
INamedInterface::name
virtual const std::string & name() const =0
Retrieve the name of the instance.
Gaudi::DataHandle::fullKey
virtual const DataObjID & fullKey() const
Definition: DataHandle.h:53
std::vector::size
T size(T...args)
DataObjectHandleBase::isOptional
bool isOptional() const
Check if the data object declared is optional for the algorithm.
Definition: DataObjectHandleBase.h:45
DataObjectHandleBase::alternativeDataProductNames
const std::vector< std::string > & alternativeDataProductNames() const
Definition: DataObjectHandleBase.h:48
Gaudi::DataHandle::owner
virtual IDataHandleHolder * owner() const
Definition: DataHandle.h:45

## Member Data Documentation

std::vector<std::string> DataObjectHandleBase::m_altNames
| protected

Definition at line 74 of file DataObjectHandleBase.h.

SmartIF<IDataProviderSvc> DataObjectHandleBase::m_EDS
| protected

Definition at line 66 of file DataObjectHandleBase.h.

bool DataObjectHandleBase::m_goodType
| protected

Definition at line 70 of file DataObjectHandleBase.h.

bool DataObjectHandleBase::m_init
| protected

Definition at line 69 of file DataObjectHandleBase.h.

SmartIF<IMessageSvc> DataObjectHandleBase::m_MS
| protected

Definition at line 67 of file DataObjectHandleBase.h.

bool DataObjectHandleBase::m_optional
| protected

Definition at line 71 of file DataObjectHandleBase.h.

bool DataObjectHandleBase::m_wasRead
| protected

Definition at line 72 of file DataObjectHandleBase.h.

bool DataObjectHandleBase::m_wasWritten
| protected

Definition at line 72 of file DataObjectHandleBase.h.

The documentation for this class was generated from the following files:

- GaudiKernel/GaudiKernel/DataObjectHandleBase.h
- GaudiKernel/src/Lib/DataObjectHandleBase.cpp