1 #ifndef GAUDIKERNEL_KEYEDOBJECT_H
2 #define GAUDIKERNEL_KEYEDOBJECT_H
5 template <
class T>
struct KeyedObjectDict;
9 #include "GaudiKernel/ContainedObject.h"
10 #include "GaudiKernel/KeyedTraits.h"
11 #include "GaudiKernel/KeyedContainer.h"
27 template <
class KEY >
49 bool m_hasKey =
false;
58 void setKey(
const key_type& key);
65 KeyedObject(
const key_type& kval):m_key(kval),m_refCount(0),m_hasKey(true) { }
69 const key_type& key()
const {
return m_key; }
71 bool hasKey()
const {
return m_hasKey; }
90 template<
class KEY>
inline
101 template<
class KEY>
inline
107 template<
class KEY>
inline
109 long cnt = --m_refCount;
110 if ( cnt <= 0 )
delete this;
118 template<
class KEY>
inline
129 template<
class KEY>
inline
135 template<
class KEY>
inline
143 #endif // GAUDIKERNEL_KEYEDOBJECT_H
static long addRef(obj_type *v)
Add reference counter to object when inserted into the container.
Definition of the templated KeyedObject class.
The stream buffer is a small object collecting object data.
virtual long index() const
Distance in the parent container.
static key_type makeKey(long k)
Create key from its full integer representation.
virtual StreamBuffer & serialize(StreamBuffer &s) const
Serialize the object for writing.
void setKey(const key_type &key)
Set object key.
KEY key_type
Declaration of key-type.
StreamBuffer & serialize(StreamBuffer &s) const override
Serialize the object for writing.
unsigned long addRef()
Add reference to object (Increase reference counter).
unsigned long release()
Release reference. If the reference count is ZERO, delete the object.
static long identifier(const key_type &k)
Full unhashed key identifier.
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
virtual long remove(ContainedObject *value)=0
Release object from the container (the pointer will be removed from the container, but the object itself will remain alive).
static long release(obj_type *v)
Release reference to object.
~KeyedObject() override
Standard destructor.
ObjectContainerBase is the base class for Gaudi container classes.
GAUDI_API void cannotAssignObjectKey()
Function to be called when an object key cannot be assigned.
static void setKey(obj_type *v, const key_type &k)
Set object key when inserted into the container.