60template <
class DATATYPE,
class MAPPING = Containers::HashMap>
77 typedef typename std::vector<contained_type*>
seq_type;
79 typedef typename contained_type::key_type
key_type;
114#ifdef CHECK_KEYED_CONTAINER
116 if ( 0 ==
m_cont.isDirect() ) {
136 if ( p->parent() ==
this ) { p->setParent( 0 ); }
157 if ( par ==
m_obj ) { p->setParent( 0 ); }
172 m_cont.setup( (
void*)sptr, (
void**)rptr );
181 other.m_cont.setup( (
void*)&other.m_sequential, (
void**)&other.m_random );
453 return insert( val.release(), kval );
491template <
class DATATYPE,
class MAPPING>
498template <
class DATATYPE,
class MAPPING>
502 for (
typename seq_type::value_type v :
m_sequential ) {
504 if ( !v->hasKey() ) {
519template <
class DATATYPE,
class MAPPING>
521 return reinterpret_cast<const std::vector<const ContainedObject*>*
>( ( 0 ==
m_cont.isDirect() ) ?
m_random
525template <
class DATATYPE,
class MAPPING>
530 if ( !val->hasKey() || (
traits::hash( val->key() ) == k0 ) ) {
544template <
class DATATYPE,
class MAPPING>
548 if ( val->hasKey() ) {
566template <
class DATATYPE,
class MAPPING>
574template <
class DATATYPE,
class MAPPING>
578 vec.reserve(
size() );
579 for (
typename seq_type::value_type v :
m_sequential ) {
587template <
class DATATYPE,
class MAPPING>
593template <
class DATATYPE,
class MAPPING>
597 return this->
erase( p1 );
612template <
class DATATYPE,
class MAPPING>
616 if ( is_start && is_stop ) {
618 }
else if ( is_start || is_stop || use_tmp ) {
619 std::vector<DATATYPE*> tmp(
m_sequential.begin(), start_pos );
628 std::vector<void*>* v =
reinterpret_cast<std::vector<void*>*
>( sptr );
629 std::vector<void*>::iterator i1 = v->begin() + std::distance(
m_sequential.begin(), start_pos );
630 std::vector<void*>::iterator i2 = v->begin() + std::distance(
m_sequential.begin(), stop_pos );
unsigned int CLID
Class ID definition.
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
void setParent(ObjectContainerBase *value)
Update parent member.
const ObjectContainerBase * parent() const
Access to parent object.
static const CLID & classID()
Retrieve reference to class definition structure (static access)
MAPPING container_type
Definition of the implementing container type.
const_iterator end() const
Retrieve terminating const iterator.
const_reverse_iterator rend() const
const reverse_iterator pointing to the end of the reversed container
void clear()
Clear the entire content and erase the objects from the container.
long erase(iterator pos)
Remove/erase object (identified by iterator) from the container.
long remove(ContainedObject *pObject) override
ObjectContainerBase overload: Remove an object from the container.
long add(ContainedObject *pObject) override
ObjectContainerBase overload: Add an object to the container.
bool empty() const
For consistency with STL: check if container is empty.
long erase(const value_type val)
Remove/erase object (identified by pointer value) from the container.
value_type operator()(const key_type &kval) const
STL algorithms support for object access.
seq_type::value_type value_type
Sequential access: definition of type stored in sequential container.
size_type numberOfObjects() const override
ObjectContainerBase overload: Number of objects in the container.
static const CLID & classID()
Retrieve class ID.
const_reverse_iterator rbegin() const
const reverse_iterator returns the beginning of the reversed container
ContainedObject * containedObject(long key_value) override
ObjectContainerBase overload: Retrieve the object by reference given the long integer representation ...
long erase(const key_type &kval)
void erase(iterator pos_start, iterator pos_stop, bool use_temp=false)
Remove/erase objects by iterator range.
size_type size() const
Number of objects in the container.
const key_type & insert(std::unique_ptr< contained_type > val, const key_type &kval)
const key_type & insert(const value_type val, const key_type &kval)
Insert entry to the container with a valid key.
seq_type::const_reverse_iterator const_reverse_iterator
Sequential access: const reverse iterator type used in sequential container.
const key_type & insert(const value_type val)
Insert entry to the container with automatic key assignment.
long index(const ContainedObject *p) const override
ObjectContainerBase overload: Retrieve the full long integer representation of the object's key from ...
DATATYPE contained_type
Definition of the contained object type.
Containers::traits< container_type, contained_type > traits
Traits class definition.
~KeyedContainer() override
Destructor.
KeyedContainer(const KeyedContainer &)=delete
KeyedContainer(void)
Standard Constructor.
virtual size_type containedObjects(std::vector< ContainedObject * > &v) const
Retrieve the full content of the object container.
seq_type::reference reference
Sequential access: reference type used in sequential container.
reverse_iterator rbegin()
reverse_iterator returns the beginning of the reversed container
const CLID & clID() const override
Retrieve class ID.
long i_erase(const_reference v, const key_type &k)
Internal function to erase an object from the container.
seq_type::const_reference const_reference
Sequential access: const reference type used in sequential container.
ContainedObject const * containedObject(long key_value) const override
Pointer to an object of a given distance.
seq_type::iterator iterator
Sequential access: iterator type used in sequential container.
const_iterator begin() const
Retrieve start const iterator.
KeyedContainer(KeyedContainer &&other)
StatusCode update() override
Reconfigure direct access to elements (Needed by POOL data loading) This function reuses the "update"...
seq_type::reverse_iterator reverse_iterator
Sequential access: reverse iterator type used in sequential container.
contained_type::key_type key_type
Definition of the key type: re-use definition of contained type.
value_type object(const key_type &kval) const
Object access by key.
value_type i_object(const key_type &k) const
virtual const std::vector< const ContainedObject * > * containedObjects() const
Retrieve the full content of the object container by reference.
reverse_iterator rend()
reverse_iterator pointing to the end of the reversed container
const key_type & insert(std::unique_ptr< contained_type > val)
seq_type::const_iterator const_iterator
Sequential access: const iterator type used in sequential container.
std::vector< contained_type * > seq_type
General container specific type definitions.
void reserve(size_type value)
Reserve place for "value" objects in the container.
ObjectContainerBase()=default
Constructor.
size_t size_type
size_type, to conform the STL container interface
This class is used for returning status codes from appropriate routines.
constexpr static const auto SUCCESS
@ OBJ_DELETED
Object was removed from the container and deleted.
@ OBJ_INSERTED
Object was inserted into the container.
@ OBJ_ERASED
Object was removed, but not deleted.
@ OBJ_NOT_FOUND
Object not present in the container.
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
static long identifier(const key_type &k)
Full unhashed key identifier.
static bool checkKey(obj_type *v, const key_type &k)
Check the validity of the object's key.
static void setKey(obj_type *v, const key_type &k)
Set object key when inserted into the container.
static long release(obj_type *v)
Release reference to object.
static long hash(const key_type &key_value)
Hash function for this key.
static key_type makeKey(long k)
Create key from its full integer representation.
static long addRef(obj_type *v)
Add reference counter to object when inserted into the container.
static bool checkBounds(const std::vector< contained_type * > *cnt, const typename contained_type::key_type &k)
Internal functor for insertion of objects.
_InsertRelease(KeyedContainer< DATATYPE, MAPPING > *p)
KeyedContainer< DATATYPE, MAPPING > * m_obj
void operator()(value_type p)
Internal functor for insertion of objects.
_RemoveRelease(ObjectContainerBase *p)
void operator()(value_type p)
ObjectContainerBase * m_obj