The Gaudi Framework
master (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
DataObject.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2026 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
#include <
GaudiKernel/DataObject.h
>
12
#include <
GaudiKernel/IInspector.h
>
13
#include <
GaudiKernel/IRegistry.h
>
14
#include <
GaudiKernel/LinkManager.h
>
15
#include <
GaudiKernel/StreamBuffer.h
>
16
#include <boost/io/ios_state.hpp>
17
#include <memory>
18
#include <vector>
19
20
static
std::string _sDataObjectCppNotRegistered(
"NotRegistered"
);
21
23
DataObject::DataObject
() :
m_pLinkMgr
{ new
LinkManager
() } {}
24
26
DataObject::DataObject
(
const
DataObject
& rhs ) :
m_version
{ rhs.
m_version
},
m_pLinkMgr
{ new
LinkManager
() } {}
27
29
DataObject
&
DataObject::operator=
(
const
DataObject
& rhs ) {
30
m_version
= rhs.
m_version
;
31
m_pLinkMgr
.reset(
new
LinkManager
() );
32
return
*
this
;
33
}
34
36
DataObject::DataObject
(
DataObject
&& rhs )
37
:
m_version
{
std
::move( rhs.
m_version
) },
m_pLinkMgr
{
std
::move( rhs.
m_pLinkMgr
) } {}
38
40
DataObject
&
DataObject::operator=
(
DataObject
&& rhs ) {
41
m_version
= std::move( rhs.m_version );
42
m_pLinkMgr
= std::move( rhs.m_pLinkMgr );
43
return
*
this
;
44
}
45
47
DataObject::~DataObject
() {
48
// Issue a warning if the object is being deleted and the reference
49
// count is non-zero.
50
if
(
m_refCount
> 0 ) {
51
// Insert warning here
52
}
53
}
54
56
unsigned
long
DataObject::release
() {
57
unsigned
long
cnt = --
m_refCount
;
58
if
( 0 == cnt )
delete
this
;
59
return
cnt;
60
}
61
63
unsigned
long
DataObject::addRef
() {
return
++
m_refCount
; }
64
66
const
CLID
&
DataObject::clID
()
const
{
return
CLID_DataObject; }
67
69
const
CLID
&
DataObject::classID
() {
return
CLID_DataObject; }
70
72
const
std::string&
DataObject::name
()
const
{
return
m_pRegistry
?
m_pRegistry
->name() : _sDataObjectCppNotRegistered; }
73
75
StatusCode
DataObject::update
() {
return
StatusCode::SUCCESS
; }
76
77
std::ostream&
DataObject::fillStream
( std::ostream& s )
const
{
78
boost::io::ios_flags_saver _{ s };
79
return
s <<
"DataObject at "
<< std::hex <<
this
;
80
}
81
82
static
DataObject
* s_objPtr =
nullptr
;
83
static
DataObject
** s_currObj = &s_objPtr;
84
85
static
std::vector<DataObject**>& objectStack() {
86
static
std::unique_ptr<std::vector<DataObject**>> s_current{
new
std::vector<DataObject**>() };
87
return
*s_current;
88
}
89
90
DataObject
*
Gaudi::getCurrentDataObject
() {
return
*s_currObj; }
91
92
void
Gaudi::pushCurrentDataObject
(
DataObject
** pobjAddr ) {
93
static
std::vector<DataObject**>&
c
= objectStack();
94
c
.push_back( pobjAddr );
95
s_currObj = pobjAddr ? pobjAddr : &s_objPtr;
96
}
97
98
void
Gaudi::popCurrentDataObject
() {
99
static
std::vector<DataObject**>&
c
= objectStack();
100
if
( !
c
.empty() )
c
.pop_back();
101
102
s_currObj =
c
.empty() ? &s_objPtr :
c
.back();
103
}
CLID
unsigned int CLID
Class ID definition.
Definition
ClassID.h:16
DataObject.h
IInspector.h
IRegistry.h
LinkManager.h
StreamBuffer.h
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition
DataObject.h:37
DataObject::addRef
virtual unsigned long addRef()
Add reference to object.
Definition
DataObject.cpp:63
DataObject::m_refCount
std::atomic< unsigned long > m_refCount
Reference count.
Definition
DataObject.h:40
DataObject::operator=
DataObject & operator=(const DataObject &rhs)
Assignment Operator.
Definition
DataObject.cpp:29
DataObject::name
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition
DataObject.cpp:72
DataObject::m_pRegistry
IRegistry * m_pRegistry
Pointer to the Registry Object.
Definition
DataObject.h:44
DataObject::fillStream
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII).
Definition
DataObject.cpp:77
DataObject::m_pLinkMgr
std::unique_ptr< LinkManager > m_pLinkMgr
Store of symbolic links.
Definition
DataObject.h:46
DataObject::clID
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition
DataObject.cpp:66
DataObject::update
virtual StatusCode update()
Provide empty placeholder for internal object reconfiguration callback.
Definition
DataObject.cpp:75
DataObject::DataObject
DataObject()
Standard Constructor.
Definition
DataObject.cpp:23
DataObject::release
virtual unsigned long release()
release reference to object
Definition
DataObject.cpp:56
DataObject::classID
static const CLID & classID()
Retrieve reference to class definition structure (static access).
Definition
DataObject.cpp:69
DataObject::m_version
unsigned char m_version
Version number.
Definition
DataObject.h:42
DataObject::~DataObject
virtual ~DataObject()
Standard Destructor.
Definition
DataObject.cpp:47
LinkManager
A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of no...
Definition
LinkManager.h:28
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
Gaudi::pushCurrentDataObject
GAUDI_API void pushCurrentDataObject(DataObject **pobjAddr)
Gaudi::popCurrentDataObject
GAUDI_API void popCurrentDataObject()
Gaudi::getCurrentDataObject
GAUDI_API DataObject * getCurrentDataObject()
gaudirun.c
c
Definition
gaudirun.py:533
std
STL namespace.
GaudiKernel
src
Lib
DataObject.cpp
Generated on
for The Gaudi Framework by
1.17.0