Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataObject.cpp
Go to the documentation of this file.
1 // Experiment specific include files
7 #include <memory>
8 #include <vector>
9 
10 static std::string _sDataObjectCppNotRegistered( "NotRegistered" );
11 
14 
17 
20  m_version = rhs.m_version;
22  return *this;
23 }
24 
27  : m_version{std::move( rhs.m_version )}, m_pLinkMgr{std::move( rhs.m_pLinkMgr )} {}
28 
31  m_version = std::move( rhs.m_version );
32  m_pLinkMgr = std::move( rhs.m_pLinkMgr );
33  return *this;
34 }
35 
38  // Issue a warning if the object is being deleted and the reference
39  // count is non-zero.
40  if ( m_refCount > 0 ) {
41  // Insert warning here
42  }
43 }
44 
46 unsigned long DataObject::release() {
47  unsigned long cnt = --m_refCount;
48  if ( 0 == cnt ) delete this;
49  return cnt;
50 }
51 
53 unsigned long DataObject::addRef() { return ++m_refCount; }
54 
56 const CLID& DataObject::clID() const { return CLID_DataObject; }
57 
59 const CLID& DataObject::classID() { return CLID_DataObject; }
60 
62 const std::string& DataObject::name() const { return m_pRegistry ? m_pRegistry->name() : _sDataObjectCppNotRegistered; }
63 
66 
67 static DataObject* s_objPtr = nullptr;
68 static DataObject** s_currObj = &s_objPtr;
69 
70 static std::vector<DataObject**>& objectStack() {
72  return *s_current;
73 }
74 
75 DataObject* Gaudi::getCurrentDataObject() { return *s_currObj; }
76 
77 void Gaudi::pushCurrentDataObject( DataObject** pobjAddr ) {
78  static std::vector<DataObject**>& c = objectStack();
79  c.push_back( pobjAddr );
80  s_currObj = pobjAddr ? pobjAddr : &s_objPtr;
81 }
82 
84  static std::vector<DataObject**>& c = objectStack();
85  if ( !c.empty() ) {
86  s_currObj = c.back();
87  c.pop_back();
88  } else {
89  s_currObj = &s_objPtr;
90  }
91 }
virtual StatusCode update()
Provide empty placeholder for internal object reconfiguration callback.
Definition: DataObject.cpp:65
T empty(T...args)
static const CLID & classID()
Retrieve reference to class definition structure (static access)
Definition: DataObject.cpp:59
GAUDI_API void popCurrentDataObject()
GAUDI_API DataObject * getCurrentDataObject()
constexpr static const auto SUCCESS
Definition: StatusCode.h:85
virtual const name_type & name() const =0
Name of the directory (or key)
STL class.
unsigned char m_version
Version number.
Definition: DataObject.h:35
T push_back(T...args)
virtual unsigned long addRef()
Add reference to object.
Definition: DataObject.cpp:53
virtual const CLID & clID() const
Retrieve reference to class definition structure.
Definition: DataObject.cpp:56
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:50
T pop_back(T...args)
T reset(T...args)
unsigned int CLID
Class ID definition.
Definition: ClassID.h:8
GAUDI_API void pushCurrentDataObject(DataObject **pobjAddr)
T move(T...args)
DataObject()
Standard Constructor.
Definition: DataObject.cpp:13
virtual unsigned long release()
release reference to object
Definition: DataObject.cpp:46
std::unique_ptr< LinkManager > m_pLinkMgr
Store of symbolic links.
Definition: DataObject.h:39
STL class.
STL class.
DataObject & operator=(const DataObject &rhs)
Assignment Operator.
Definition: DataObject.cpp:19
T back(T...args)
const std::string & name() const
Retreive DataObject name. It is the name when registered in the store.
Definition: DataObject.cpp:62
virtual ~DataObject()
Standard Destructor.
Definition: DataObject.cpp:37
IRegistry * m_pRegistry
Pointer to the Registry Object.
Definition: DataObject.h:37
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
unsigned long m_refCount
Reference count.
Definition: DataObject.h:33