The Gaudi Framework  master (b9786168)
Loading...
Searching...
No Matches
DataObjectHandleBase.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
13#include <mutex>
14
19#include <GaudiKernel/SmartIF.h>
20
21//---------------------------------------------------------------------------
22
31
32//---------------------------------------------------------------------------
33
35
36public:
39
40 ~DataObjectHandleBase() override;
44
47 template <std::derived_from<IProperty> OWNER, class K>
48 inline DataObjectHandleBase( OWNER* owner, Gaudi::DataHandle::Mode m, std::string name, K key = {},
49 std::string doc = "" )
50 : DataObjectHandleBase( std::move( key ), m, owner ) {
51 auto p = owner->declareProperty( std::move( name ), *this, std::move( doc ) );
52 p->template setOwnerType<OWNER>();
53 }
54
55 friend std::ostream& operator<<( std::ostream& str, const DataObjectHandleBase& d );
56
58 bool isOptional() const { return m_optional; }
59 void setOptional( bool optional = true ) { m_optional = optional; }
60
61 bool isValid() const;
62
63protected:
64 bool init() override;
65
66 DataObject* fetch() const;
67
68protected:
71
72 bool m_init = false;
73 bool m_optional = false;
74};
DataObjectHandleBase GaudiKernel/DataObjectHandleBase.h.
void setOptional(bool optional=true)
friend std::ostream & operator<<(std::ostream &str, const DataObjectHandleBase &d)
SmartIF< IDataProviderSvc > m_EDS
SmartIF< IMessageSvc > m_MS
DataObjectHandleBase(OWNER *owner, Gaudi::DataHandle::Mode m, std::string name, K key={}, std::string doc="")
Autodeclaring constructor with property name, mode, key and documentation.
DataObjectHandleBase(const DataObjectHandleBase &)=delete
bool isOptional() const
Check if the data object declared is optional for the algorithm.
DataObjectHandleBase(DataObjID k, Gaudi::DataHandle::Mode a, IDataHandleHolder *owner)
DataObject * fetch() const
DataObjectHandleBase & operator=(const DataObjectHandleBase &)
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
virtual IDataHandleHolder * owner() const
Definition DataHandle.h:52
Small smart pointer class with automatic reference counting for IInterface.
Definition SmartIF.h:28
STL namespace.