53 typedef typename CONT::value_type
v_type;
55 find(
const void* o) : m_obj(o) {}
60 return (*
this)(cmp.second);
65 throw GaudiException(
"Cannot assign key to keyed object! Object already has a key.",
76 throw GaudiException(
"Keyed Container structures are inconsistent - severe problem!",
82 throw GaudiException(
"Keyed Container cannot satisfy request - severe problem!",
89 : m_seq(nullptr), m_direct(0)
91 if (
sizeof(
typename T::map_type) >
sizeof(
m_setup.buffer) ) {
107 template <
class T>
void 117 for(
int i = 0, stop =
m_setup.s->v.size(); i < stop; i++ ) {
131 return insert(pBase, pObject, obj, *key);
146 if (
m_setup.s->insert(obj, key) ) {
147 if ( !pObject->
parent() ) {
154 else if ( key ==
long(
m_setup.s->v.size()) ) {
156 if ( !pObject->
parent() ) {
166 return insert(pBase, pObject, obj, key);
184 if (
m_setup.s->insert(obj, key) ) {
185 if ( !pObject->
parent() ) {
191 else if ( key ==
long(
m_setup.s->v.size()) ) {
193 if ( !pObject->
parent() ) {
212 typedef typename T::map_type MTYP;
218 if ( i !=
m_setup.s->m.end() ) {
230 return erase(key, obj);
237 auto i =
m_setup.s->m.find(key);
238 if ( i !=
m_setup.s->m.end() )
return (*i).second;
284 seq_type::iterator
end)
286 typedef typename T::map_type MTYP;
290 return erase(beg, end);
296 for (
auto j=beg; j !=
end; ++j) {
299 if ( i !=
m_setup.s->m.end() ) {
317 return CLID_ObjectVector+0x00030000;
321 return CLID_ObjectVector+0x00040000;
342 #ifdef CHECK_KEYED_CONTAINER 343 unsigned long siz =
m_setup.s->m_idx.size();
344 if ( value >= 0 &&
size_t(value) < siz ) {
345 long ent = *(
m_setup.s->m_idx.begin()+value);
347 return *(
m_setup.s->v.begin() + ent);
352 return *(
m_setup.s->v.begin() + (*(
m_setup.s->m_idx.begin()+value)));
360 for(
int i = 0, stop =
m_setup.s->v.size(); i < stop; ++i) {
396 return insert(b, c, o, &k);
399 return insert(b, c, o, k);
404 if ( k+1 >
long(
m_setup.s->m_idx.size()) ) {
405 m_setup.s->m_idx.resize(k+1, -1);
407 auto idx =
m_setup.s->m_idx.begin()+k;
439 if ( k+1 >
long(
m_setup.s->m_idx.size()) ) {
440 m_setup.s->m_idx.resize(k+1, -1);
442 auto idx =
m_setup.s->m_idx.begin()+k;
468 typedef id_type::iterator id_iter;
471 return erase(key, obj);
474 id_type& idx =
m_setup.s->m_idx;
475 for (
auto & elem : idx) {
476 auto j =
m_setup.s->v.begin()+(elem);
490 else if ( key >= 0 && key <
long(
m_setup.s->m_idx.size()) ) {
491 auto idx =
m_setup.s->m_idx.begin()+key;
493 auto i =
m_setup.s->v.begin()+(*idx);
494 if ( i ==
m_setup.s->v.end() ) {
518 seq_type::iterator
end)
521 typedef id_type::iterator id_iter;
528 return erase(beg, end);
531 long cnt = 0, nobj = end-beg;
532 id_type& idx =
m_setup.s->m_idx;
533 for (
auto & elem : idx) {
534 auto j =
m_setup.s->v.begin()+(elem);
543 if ( cnt == nobj )
break;
557 return CLID_ObjectVector+0x00050000;
605 if ( k ==
long(
m_setup.s->v.size()) ) {
606 return insert(b, c, o, &k);
619 if ( k ==
long(
m_setup.s->v.size()) ) {
648 seq_type::iterator
end)
660 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. ...
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.
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...
std::pair< const K, T > value_type
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.
GAUDI_API void cannotAssignObjectKey()
Function to be called when an object key cannot be assigned.
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.
std::pair< iterator, bool > insert(ValueType &&val)
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.