61 typedef typename CONT::value_type
v_type;
63 find(
const void* o) : m_obj(o) {}
68 return (*
this)(cmp.second);
73 throw GaudiException(
"Cannot assign key to keyed object! Object already has a key.",
84 throw GaudiException(
"Keyed Container structures are inconsistent - severe problem!",
90 throw GaudiException(
"Keyed Container cannot satisfy request - severe problem!",
97 : m_seq(nullptr), m_direct(0)
99 if (
sizeof(
typename T::map_type) >
sizeof(
m_setup.buffer) ) {
116 other.m_keyCtxt = -1;
117 other.m_seq =
nullptr;
128 template <
class T>
void 140 for(
auto p:
s.v)
s.insert(p, i++);
152 return insert(pBase, pObject, obj, *key);
167 if (
m_setup.s->insert(obj, key) ) {
168 if ( !pObject->
parent() ) {
175 else if ( key ==
long(
m_setup.s->v.size()) ) {
177 if ( !pObject->
parent() ) {
187 return insert(pBase, pObject, obj, key);
205 if (
m_setup.s->insert(obj, key) ) {
206 if ( !pObject->
parent() ) {
212 else if ( key ==
long(
m_setup.s->v.size()) ) {
214 if ( !pObject->
parent() ) {
233 typedef typename T::map_type MTYP;
239 if ( i !=
m_setup.s->m.end() ) {
251 return erase(key, obj);
258 auto i =
m_setup.s->m.find(key);
259 if ( i !=
m_setup.s->m.end() )
return (*i).second;
305 seq_type::iterator
end)
307 typedef typename T::map_type MTYP;
311 return erase(beg, end);
317 for (
auto j=beg; j !=
end; ++j) {
320 if ( i !=
m_setup.s->m.end() ) {
338 return CLID_ObjectVector+0x00030000;
342 return CLID_ObjectVector+0x00040000;
363 #ifdef CHECK_KEYED_CONTAINER 364 unsigned long siz =
m_setup.s->m_idx.size();
365 if ( value >= 0 &&
size_t(value) < siz ) {
366 long ent = *(
m_setup.s->m_idx.begin()+value);
368 return *(
m_setup.s->v.begin() + ent);
373 return *(
m_setup.s->v.begin() + (*(
m_setup.s->m_idx.begin()+value)));
381 for(
int i = 0, stop =
m_setup.s->v.size(); i < stop; ++i) {
417 return insert(b, c, o, &k);
420 return insert(b, c, o, k);
425 if ( k+1 >
long(
m_setup.s->m_idx.size()) ) {
426 m_setup.s->m_idx.resize(k+1, -1);
428 auto idx =
m_setup.s->m_idx.begin()+k;
460 if ( k+1 >
long(
m_setup.s->m_idx.size()) ) {
461 m_setup.s->m_idx.resize(k+1, -1);
463 auto idx =
m_setup.s->m_idx.begin()+k;
489 typedef id_type::iterator id_iter;
492 return erase(key, obj);
495 id_type& idx =
m_setup.s->m_idx;
496 for (
auto & elem : idx) {
497 auto j =
m_setup.s->v.begin()+(elem);
511 else if ( key >= 0 && key <
long(
m_setup.s->m_idx.size()) ) {
512 auto idx =
m_setup.s->m_idx.begin()+key;
514 auto i =
m_setup.s->v.begin()+(*idx);
515 if ( i ==
m_setup.s->v.end() ) {
539 seq_type::iterator
end)
542 typedef id_type::iterator id_iter;
549 return erase(beg, end);
552 long cnt = 0, nobj = end-beg;
553 id_type& idx =
m_setup.s->m_idx;
554 for (
auto & elem : idx) {
555 auto j =
m_setup.s->v.begin()+(elem);
564 if ( cnt == nobj )
break;
578 return CLID_ObjectVector+0x00050000;
626 if ( k ==
long(
m_setup.s->v.size()) ) {
627 return insert(b, c, o, &k);
640 if ( k ==
long(
m_setup.s->v.size()) ) {
669 seq_type::iterator
end)
681 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.
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.
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.
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.
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.