Go to the documentation of this file.
11 #ifndef GAUDIKERNEL_KEYEDTRAITS_H
12 #define GAUDIKERNEL_KEYEDTRAITS_H
14 #define CHECK_KEYED_CONTAINER
23 template <
class T,
class M>
43 template <
class CONTAINER,
class DATATYPE>
49 template <
class SETUP>
94 static long hash(
const key_type& key_value ) {
return key_value; }
97 if (
v )
v->setKey( k );
104 #ifdef CHECK_KEYED_CONTAINER
105 return (
v ) ? (
hash(
v->key() ) ==
hash( k ) ) :
false;
124 template <
class CONTAINER,
class DATATYPE>
125 struct traits :
public key_traits<typename DATATYPE::key_type> {
128 #ifdef CHECK_KEYED_CONTAINER
129 return size_t( cnt->
size() ) > size_t( traits::hash( k ) );
136 #endif // GAUDIKERNEL_KEYEDTRAITS_H
@ OBJ_ERASED
Object was removed, but not deleted
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
KeyedObjectManager Class to manage keyed objects.
@ OBJ_INSERTED
Object was inserted into the container.
KeyedObject< key_type > obj_type
Declaration of keyed object type.
static long addRef(obj_type *v)
Add reference counter to object when inserted into the container.
static bool checkBounds(const std::vector< DATATYPE * > *cnt, const typename DATATYPE::key_type &k)
Allow to check the access to container elements for consistency.
static bool checkKey(obj_type *v, const key_type &k)
Check the validity of the object's key.
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
@ OBJ_CANNOT_INSERT
Cannot insert object into container.
static key_type makeKey(int k)
static long identifier(const key_type &k)
Full unhashed key identifier.
static void setKey(obj_type *v, const key_type &k)
Set object key when inserted into the container.
@ OBJ_DELETED
Object was removed from the container and deleted.
@ OBJ_NOT_FOUND
Object not present in the container.
template class KeyedContainer, KeyedContainer.h
Definition of the templated KeyedObject class.
static long release(obj_type *v)
Release reference to object.
static key_type makeKey(long k)
Create key from its full integer representation.
KEY key_type
Declaration of key-type.
GAUDI_API void cannotAssignObjectKey()
Function to be called when an object key cannot be assigned.
GAUDI_API void containerIsInconsistent()
Function to be called to indicate that the container is found to be inconsistent.
static long hash(const key_type &key_value)
Hash function for this key.