1 #ifndef GAUDIKERNEL_KEYEDOBJECT_H 2 #define GAUDIKERNEL_KEYEDOBJECT_H 53 bool m_hasKey =
false;
62 void setKey(
const key_type& key );
70 KeyedObject(
const key_type& kval ) : m_key( kval ), m_refCount( 0 ), m_hasKey( true ) {}
74 const key_type&
key()
const {
return m_key; }
76 bool hasKey()
const {
return m_hasKey; }
101 setParent(
nullptr );
117 long cnt = --m_refCount;
118 if ( cnt <= 0 )
delete this;
154 #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.
KEY key_type
Definition of the key-type to access object.
KeyedObject(const KeyedObject ©)
NOBODY may copy these objects.
static key_type makeKey(long k)
Create key from its full integer representation.
KeyedObject(const key_type &kval)
Standard Constructor accepting the object's key.
virtual StreamBuffer & serialize(StreamBuffer &s) const
Serialize the object for writing.
void setKey(const key_type &key)
Set object key.
Containers::key_traits< key_type > traits
definition of the container key traits to be made friend
const key_type & key() const
Retrieve Key of the object.
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.
bool hasKey() const
Check if the object has a key assigned or not.
StreamBuffer & serialize(StreamBuffer &s) const override
Serialize the object for writing.
GAUDI_API void cannotAssignObjectKey()
Function to be called when an object key cannot be assigned.
long index() const override
Distance in the parent container.
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.
static void setKey(obj_type *v, const key_type &k)
Set object key when inserted into the container.