66 typedef typename CONT::value_type
v_type;
69 find(
const void* o ) : m_obj( o ) {}
70 bool operator()(
const void* cmp )
const {
return cmp == m_obj; }
71 bool operator()(
const v_type& cmp )
const {
return ( *
this )( cmp.second ); }
76 throw GaudiException(
"Cannot assign key to keyed object! Object already has a key.",
"KeyedObject", 0 );
80 throw GaudiException(
"Cannot insert element to Keyed Container!",
"KeyedContainer", 0 );
85 throw GaudiException(
"Keyed Container structures are inconsistent - severe problem!",
"KeyedContainer", 0 );
90 throw GaudiException(
"Keyed Container cannot satisfy request - severe problem!",
"KeyedContainer", 0 );
96 if (
sizeof(
typename T::map_type ) >
sizeof(
m_setup.buffer ) ) {
97 throw GaudiException(
"Basic STL contaier sizes are incompatible",
"KeyedContainer", 0 );
109 other.m_keyCtxt = -1;
110 other.m_seq =
nullptr;
134 for (
auto p :
s.v )
s.insert( p, i++ );
143 return insert( pBase, pObject, obj, *key );
155 if (
m_setup.s->insert( obj, key ) ) {
156 if ( !pObject->
parent() ) {
162 }
else if ( key ==
long(
m_setup.s->v.size() ) ) {
164 if ( !pObject->
parent() ) {
173 return insert( pBase, pObject, obj, key );
188 if (
m_setup.s->insert( obj, key ) ) {
189 if ( !pObject->
parent() ) {
194 }
else if ( key ==
long(
m_setup.s->v.size() ) ) {
196 if ( !pObject->
parent() ) {
214 typedef typename T::map_type MTYP;
219 if ( i !=
m_setup.s->m.end() ) {
231 return erase( key, obj );
238 auto i =
m_setup.s->m.find( key );
239 if ( i !=
m_setup.s->m.end() )
return ( *i ).second;
286 typedef typename T::map_type MTYP;
290 return erase( beg, end );
295 for (
auto j = beg; j !=
end; ++j ) {
298 if ( i !=
m_setup.s->m.end() ) {
318 return CLID_ObjectVector + 0x00030000;
323 return CLID_ObjectVector + 0x00040000;
345 #ifdef CHECK_KEYED_CONTAINER 346 unsigned long siz =
m_setup.s->m_idx.size();
347 if ( value >= 0 &&
size_t( value ) < siz ) {
348 long ent = *(
m_setup.s->m_idx.begin() + value );
350 return *(
m_setup.s->v.begin() + ent );
355 return *(
m_setup.s->v.begin() + ( *(
m_setup.s->m_idx.begin() + value ) ) );
364 for (
int i = 0, stop =
m_setup.s->v.size(); i < stop; ++i ) {
368 m_setup.s->m_idx.push_back( i );
394 return insert( b, c, o, &k );
397 return insert( b, c, o, k );
402 if ( k + 1 >
long(
m_setup.s->m_idx.size() ) ) {
403 m_setup.s->m_idx.resize( k + 1, -1 );
405 auto idx =
m_setup.s->m_idx.begin() + k;
434 if ( k + 1 >
long(
m_setup.s->m_idx.size() ) ) {
435 m_setup.s->m_idx.resize( k + 1, -1 );
437 auto idx =
m_setup.s->m_idx.begin() + k;
465 return erase( key, obj );
468 id_type& idx =
m_setup.s->m_idx;
469 for (
auto& elem : idx ) {
470 auto j =
m_setup.s->v.begin() + ( elem );
481 }
else if ( key >= 0 && key <
long(
m_setup.s->m_idx.size() ) ) {
482 auto idx =
m_setup.s->m_idx.begin() + key;
484 auto i =
m_setup.s->v.begin() + ( *idx );
485 if ( i ==
m_setup.s->v.end() ) {
514 return erase( beg, end );
516 long cnt = 0, nobj = end - beg;
517 id_type& idx =
m_setup.s->m_idx;
518 for (
auto& elem : idx ) {
519 auto j =
m_setup.s->v.begin() + ( elem );
526 if ( cnt == nobj )
break;
541 return CLID_ObjectVector + 0x00050000;
577 *k = (
m_setup.s->v.size() - 1 );
585 if ( k ==
long(
m_setup.s->v.size() ) ) {
586 return insert( b, c, o, &k );
596 if ( k ==
long(
m_setup.s->v.size() ) ) {
637 return CLID_ObjectVector + 0x00060000;
Object was inserted into the container.
bool operator()(long &j) const
Define general base for Gaudi exception.
std::vector< void * > map_type
virtual ~KeyedObjectManager()
Standard Destructor.
void clear()
Clear content of the vector.
std::vector< long > map_type
union Containers::KeyedObjectManager::@6 m_setup
GAUDI_API void containerIsInconsistent()
Function to be called to indicate that the container is found to be inconsistent. ...
struct GAUDI_API vector
Parametrisation class for vector-like implementation.
void clearDirect()
Clear all direct access fields.
std::vector< long > m_idx
Indirection array.
void * object(long key) const
Retrieve object identified by a key from the container.
void * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
std::map< long, void * > map_type
const ObjectContainerBase * parent() const
Access to parent object.
bool insert(void *obj, long key)
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
std::vector< void * > v
Direct access array.
std::pair< iterator, bool > insert(ValueType &&val)
void reserve(long size)
Reserve buffer space.
Cannot insert object into container.
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
struct GAUDI_API map
Parametrisation class for map-like implementation.
GaudiUtils::HashMap< long, void * > map_type
void onDirty() const
Callback when the container becomes dirty.
auto end(reverse_wrapper< T > &w)
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
unsigned int CLID
Class ID definition.
bool operator()(const v_type &cmp) const
Object was removed, but not deleted.
All classes that their objects may be contained in an LHCb ObjectContainer (e.g.
struct GAUDI_API array
Parametrisation class for redirection array - like implementation.
GAUDI_API void cannotAssignObjectKey()
Function to be called when an object key cannot be assigned.
std::pair< const long, void * > value_type
KeyedObjectManager Class to manage keyed objects.
std::vector< void * > v
Direct access array.
void setParent(ObjectContainerBase *value)
Update parent member.
static CLID classID()
Access CLID for this type of container.
void setup(void *seq, void **rndm)
Setup of the Map and the parent object.
ObjectContainerBase is the base class for Gaudi container classes.
KeyedObjectManager()
Standard Constructor.
bool operator()(const void *cmp) const
bool insert(void *obj, long key)
seq_type * m_seq
Container holding array like container.
long insertDirect(ObjectContainerBase *b, ContainedObject *c, void *o, long k)
Insert element into direct access map.