1 #ifndef GAUDIKERNEL_KEYEDOBJECT_H
2 #define GAUDIKERNEL_KEYEDOBJECT_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.
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.
long index() const override
Distance in the parent container.
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
StreamBuffer & serialize(StreamBuffer &s) const override
Serialize the object for writing.
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.
key_type m_key
Object Key; It's initial value is not determined.
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.
GAUDI_API void cannotAssignObjectKey()
Function to be called when an object key cannot be assigned.
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.