The Gaudi Framework  v33r0 (d5ea422b)
DataObject.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2019 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 #ifndef GAUDIKERNEL_DATAOBJECT_H
12 #define GAUDIKERNEL_DATAOBJECT_H
13 
14 // Framework include files
15 #include "GaudiKernel/ClassID.h"
16 #include "GaudiKernel/StatusCode.h"
17 
18 // STL includes
19 #include <memory>
20 #include <ostream>
21 #include <string>
22 
23 // Forward declarations
24 class IOpaqueAddress;
25 class StreamBuffer;
26 class LinkManager;
27 class IRegistry;
28 
29 // Definition of the CLID for this class
30 static const CLID CLID_DataObject = 1;
31 
41 private:
43  unsigned long m_refCount = 0;
45  unsigned char m_version = 0;
47  IRegistry* m_pRegistry = nullptr;
50 
51 public:
53  DataObject();
55  DataObject( const DataObject& rhs );
57  DataObject& operator=( const DataObject& rhs );
59  DataObject( DataObject&& rhs );
61  DataObject& operator=( DataObject&& rhs );
63  virtual ~DataObject();
65  virtual unsigned long addRef();
67  virtual unsigned long release();
69  virtual const CLID& clID() const;
71  static const CLID& classID();
73  const std::string& name() const;
74 
76  virtual StatusCode update();
77 
79  void setRegistry( IRegistry* pRegistry ) { m_pRegistry = pRegistry; }
82  IRegistry* registry() const { return m_pRegistry; }
84  LinkManager* linkMgr() const { return m_pLinkMgr.get(); }
86  unsigned char version() const { return m_version; }
88  void setVersion( unsigned char vsn ) { m_version = vsn; }
90  unsigned long refCount() const { return m_refCount; }
92  virtual std::ostream& fillStream( std::ostream& s ) const {
93  s << "DataObject at " << std::hex << this;
94  return s;
95  }
97  friend std::ostream& operator<<( std::ostream& s, const DataObject& obj ) { return obj.fillStream( s ); }
98 };
99 
100 // Additional functions to support the Serialization of objects in the transient store
101 
102 namespace Gaudi {
103  GAUDI_API void pushCurrentDataObject( DataObject** pobjAddr );
106 } // namespace Gaudi
107 
108 #endif // GAUDIKERNEL_DATAOBJECT_H
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:82
GAUDI_API void popCurrentDataObject()
The stream buffer is a small object collecting object data.
Definition: StreamBuffer.h:51
GAUDI_API DataObject * getCurrentDataObject()
LinkManager * linkMgr() const
Retrieve Link manager.
Definition: DataObject.h:84
virtual std::ostream & fillStream(std::ostream &s) const
Fill the output stream (ASCII)
Definition: DataObject.h:92
unsigned char version() const
Retrieve version number of this object representation.
Definition: DataObject.h:86
unsigned long refCount() const
Return the refcount.
Definition: DataObject.h:90
STL class.
This class is used for returning status codes from appropriate routines.
Definition: StatusCode.h:61
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:32
unsigned int CLID
Class ID definition.
Definition: ClassID.h:18
GAUDI_API void pushCurrentDataObject(DataObject **pobjAddr)
T get(T... args)
friend std::ostream & operator<<(std::ostream &s, const DataObject &obj)
Output operator (ASCII)
Definition: DataObject.h:97
std::unique_ptr< LinkManager > m_pLinkMgr
Store of symbolic links.
Definition: DataObject.h:49
string s
Definition: gaudirun.py:328
T hex(T... args)
Opaque address interface definition.
#define GAUDI_API
Definition: Kernel.h:81
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:40
STL class.
Header file for std:chrono::duration-based Counters.
Definition: __init__.py:1
void setVersion(unsigned char vsn)
Set version number of this object representation.
Definition: DataObject.h:88