Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  master (d98a2936)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
DataObject Class Reference

#include <GaudiKernel/DataObject.h>

Inheritance diagram for DataObject:
Collaboration diagram for DataObject:

Public Member Functions

 DataObject ()
 Standard Constructor. More...
 
 DataObject (const DataObject &rhs)
 Copy Constructor. More...
 
DataObjectoperator= (const DataObject &rhs)
 Assignment Operator. More...
 
 DataObject (DataObject &&rhs)
 Move Constructor. More...
 
DataObjectoperator= (DataObject &&rhs)
 Move Assignment Operator. More...
 
virtual ~DataObject ()
 Standard Destructor. More...
 
virtual unsigned long addRef ()
 Add reference to object. More...
 
virtual unsigned long release ()
 release reference to object More...
 
virtual const CLIDclID () const
 Retrieve reference to class definition structure. More...
 
const std::string & name () const
 Retreive DataObject name. It is the name when registered in the store. More...
 
virtual StatusCode update ()
 Provide empty placeholder for internal object reconfiguration callback. More...
 

Static Public Member Functions

static const CLIDclassID ()
 Retrieve reference to class definition structure (static access) More...
 

Private Attributes

std::atomic< unsigned long > m_refCount = 0
 Reference count. More...
 
unsigned char m_version = 0
 Version number. More...
 
IRegistrym_pRegistry = nullptr
 Pointer to the Registry Object. More...
 
std::unique_ptr< LinkManagerm_pLinkMgr
 Store of symbolic links. More...
 

inline code of class DataObject


void setRegistry (IRegistry *pRegistry)
 Set pointer to Registry. More...
 
IRegistryregistry () const
 Get pointer to Registry. More...
 
LinkManagerlinkMgr ()
 Retrieve Link manager. More...
 
const LinkManagerlinkMgr () const
 
unsigned char version () const
 Retrieve version number of this object representation. More...
 
void setVersion (unsigned char vsn)
 Set version number of this object representation. More...
 
unsigned long refCount () const
 Return the refcount. More...
 
virtual std::ostream & fillStream (std::ostream &s) const
 Fill the output stream (ASCII) More...
 
std::ostream & operator<< (std::ostream &s, const DataObject &obj)
 Output operator (ASCII) More...
 

Detailed Description

A DataObject is the base class of any identifiable object on any data store. The base class supplies the implementation of data streaming.

Author
M.Frank

Definition at line 37 of file DataObject.h.

Constructor & Destructor Documentation

◆ DataObject() [1/3]

DataObject::DataObject ( )

Standard Constructor.

Definition at line 23 of file DataObject.cpp.

23 : m_pLinkMgr{ new LinkManager() } {}

◆ DataObject() [2/3]

DataObject::DataObject ( const DataObject rhs)

Copy Constructor.

Definition at line 26 of file DataObject.cpp.

26 : m_version{ rhs.m_version }, m_pLinkMgr{ new LinkManager() } {}

◆ DataObject() [3/3]

DataObject::DataObject ( DataObject &&  rhs)

Move Constructor.

Definition at line 36 of file DataObject.cpp.

37  : m_version{ std::move( rhs.m_version ) }, m_pLinkMgr{ std::move( rhs.m_pLinkMgr ) } {}

◆ ~DataObject()

DataObject::~DataObject ( )
virtual

Standard Destructor.

Definition at line 47 of file DataObject.cpp.

47  {
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 }

Member Function Documentation

◆ addRef()

unsigned long DataObject::addRef ( )
virtual

Add reference to object.

Definition at line 63 of file DataObject.cpp.

63 { return ++m_refCount; }

◆ classID()

const CLID & DataObject::classID ( )
static

Retrieve reference to class definition structure (static access)

Retrieve Pointer to class definition structure.

Definition at line 69 of file DataObject.cpp.

69 { return CLID_DataObject; }

◆ clID()

const CLID & DataObject::clID ( ) const
virtual

◆ fillStream()

std::ostream & DataObject::fillStream ( std::ostream &  s) const
virtual

Fill the output stream (ASCII)

Reimplemented in Gaudi::TestSuite::Event.

Definition at line 77 of file DataObject.cpp.

77  {
78  boost::io::ios_flags_saver _{ s };
79  return s << "DataObject at " << std::hex << this;
80 }

◆ linkMgr() [1/2]

LinkManager* DataObject::linkMgr ( )
inline

Retrieve Link manager.

Definition at line 81 of file DataObject.h.

81 { return m_pLinkMgr.get(); }

◆ linkMgr() [2/2]

const LinkManager* DataObject::linkMgr ( ) const
inline

Definition at line 82 of file DataObject.h.

82 { return m_pLinkMgr.get(); }

◆ name()

const std::string & DataObject::name ( ) const

Retreive DataObject name. It is the name when registered in the store.

Retrieve DataObject name. It is the name when included in the store.

Definition at line 72 of file DataObject.cpp.

72 { return m_pRegistry ? m_pRegistry->name() : _sDataObjectCppNotRegistered; }

◆ operator=() [1/2]

DataObject & DataObject::operator= ( const DataObject rhs)

Assignment Operator.

Definition at line 29 of file DataObject.cpp.

29  {
30  m_version = rhs.m_version;
31  m_pLinkMgr.reset( new LinkManager() );
32  return *this;
33 }

◆ operator=() [2/2]

DataObject & DataObject::operator= ( DataObject &&  rhs)

Move Assignment Operator.

Assignment Operator.

Definition at line 40 of file DataObject.cpp.

40  {
41  m_version = std::move( rhs.m_version );
42  m_pLinkMgr = std::move( rhs.m_pLinkMgr );
43  return *this;
44 }

◆ refCount()

unsigned long DataObject::refCount ( ) const
inline

Return the refcount.

Definition at line 88 of file DataObject.h.

88 { return m_refCount; }

◆ registry()

IRegistry* DataObject::registry ( ) const
inline

Get pointer to Registry.

Definition at line 79 of file DataObject.h.

79 { return m_pRegistry; }

◆ release()

unsigned long DataObject::release ( )
virtual

release reference to object

Decrease reference count.

Definition at line 56 of file DataObject.cpp.

56  {
57  unsigned long cnt = --m_refCount;
58  if ( 0 == cnt ) delete this;
59  return cnt;
60 }

◆ setRegistry()

void DataObject::setRegistry ( IRegistry pRegistry)
inline

Set pointer to Registry.

Definition at line 77 of file DataObject.h.

77 { m_pRegistry = pRegistry; }

◆ setVersion()

void DataObject::setVersion ( unsigned char  vsn)
inline

Set version number of this object representation.

Definition at line 86 of file DataObject.h.

86 { m_version = vsn; }

◆ update()

StatusCode DataObject::update ( )
virtual

Provide empty placeholder for internal object reconfiguration callback.

Reimplemented in KeyedContainer< DATATYPE, MAPPING >, KeyedContainer< Gaudi::TestSuite::MyVertex >, and KeyedContainer< Gaudi::TestSuite::MyTrack >.

Definition at line 75 of file DataObject.cpp.

75 { return StatusCode::SUCCESS; }

◆ version()

unsigned char DataObject::version ( ) const
inline

Retrieve version number of this object representation.

Definition at line 84 of file DataObject.h.

84 { return m_version; }

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const DataObject obj 
)
friend

Output operator (ASCII)

Definition at line 92 of file DataObject.h.

92 { return obj.fillStream( s ); }

Member Data Documentation

◆ m_pLinkMgr

std::unique_ptr<LinkManager> DataObject::m_pLinkMgr
private

Store of symbolic links.

Definition at line 46 of file DataObject.h.

◆ m_pRegistry

IRegistry* DataObject::m_pRegistry = nullptr
private

Pointer to the Registry Object.

Definition at line 44 of file DataObject.h.

◆ m_refCount

std::atomic<unsigned long> DataObject::m_refCount = 0
private

Reference count.

Definition at line 40 of file DataObject.h.

◆ m_version

unsigned char DataObject::m_version = 0
private

Version number.

Definition at line 42 of file DataObject.h.


The documentation for this class was generated from the following files:
MSG::hex
MsgStream & hex(MsgStream &log)
Definition: MsgStream.h:258
DataObject::m_pLinkMgr
std::unique_ptr< LinkManager > m_pLinkMgr
Store of symbolic links.
Definition: DataObject.h:46
gaudirun.s
string s
Definition: gaudirun.py:346
DataObject::m_version
unsigned char m_version
Version number.
Definition: DataObject.h:42
DataObject::m_pRegistry
IRegistry * m_pRegistry
Pointer to the Registry Object.
Definition: DataObject.h:44
DataObject::m_refCount
std::atomic< unsigned long > m_refCount
Reference count.
Definition: DataObject.h:40
IRegistry::name
virtual const name_type & name() const =0
Name of the directory (or key)
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition: StatusCode.h:99
DataObject::fillStream
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)
Definition: DataObject.cpp:77