All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Containers::KeyedObjectManager< SETUP > Class Template Reference

KeyedObjectManager Class to manage keyed objects. More...

#include <GaudiKernel/KeyedObjectManager.h>

Collaboration diagram for Containers::KeyedObjectManager< SETUP >:

Public Member Functions

 KeyedObjectManager ()
 Standard Constructor. More...
 
virtual ~KeyedObjectManager ()
 Standard Destructor. More...
 
void clearDirect ()
 Clear all direct access fields. More...
 
long insertDirect (ObjectContainerBase *b, ContainedObject *c, void *o, long k)
 Insert element into direct access map. More...
 
long isDirect () const
 Check if the container is dirty. More...
 
void * object (long key) const
 Retrieve object identified by a key from the container. More...
 
long insert (ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
 Insert new object into container. More...
 
long insert (ObjectContainerBase *b, ContainedObject *c, void *o, long k)
 Insert new object into container. More...
 
void * erase (long key, const void *obj)
 Remove object from container (very inefficient if key is invalid) More...
 
long erase (seq_type::iterator beg, seq_type::iterator end)
 Remove object by sequential iterators. More...
 
void reserve (long size)
 Reserve buffer space. More...
 
void clear ()
 Clear content of the vector. More...
 
void setup (void *seq, void **rndm)
 Setup of the Map and the parent object. More...
 
template<>
CLID classID ()
 
template<>
CLID classID ()
 
template<>
void * object (long value) const
 
template<>
long insert (ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
 
template<>
long insert (ObjectContainerBase *b, ContainedObject *c, void *o, long k)
 
template<>
long insertDirect (ObjectContainerBase *b, ContainedObject *c, void *o, long k)
 
template<>
void clearDirect ()
 
template<>
void * erase (long key, const void *obj)
 
template<>
long erase (seq_type::iterator beg, seq_type::iterator end)
 
template<>
CLID classID ()
 
template<>
void * object (long) const
 
template<>
long insert (ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
 
template<>
long insert (ObjectContainerBase *b, ContainedObject *c, void *o, long k)
 
template<>
long insertDirect (ObjectContainerBase *b, ContainedObject *c, void *o, long k)
 
template<>
void clearDirect ()
 
template<>
void * erase (long, const void *)
 
template<>
long erase (seq_type::iterator beg, seq_type::iterator end)
 
template<>
CLID classID ()
 

Static Public Member Functions

static CLID classID ()
 Access CLID for this type of container. More...
 

Private Types

typedef std::vector< void * > seq_type
 

Private Member Functions

void onDirty () const
 Callback when the container becomes dirty. More...
 
template<>
void onDirty () const
 
template<>
void onDirty () const
 

Private Attributes

seq_typem_seq
 Container holding array like container. More...
 
long m_direct
 Dirty flag. More...
 
long m_keyCtxt
 
union {
   char   buffer [128]
 Buffer space to hold keyed container. More...
 
   SETUP *   s
 
m_setup
 

Detailed Description

template<class SETUP>
class Containers::KeyedObjectManager< SETUP >

KeyedObjectManager Class to manage keyed objects.

Object manager class.

This class is instantiated for two container types: map and hashmap. Other types are possible, but currently not supported. Other implementations may be achieved by specializing the SETUP class.

As an example below the specialization for a vector like implementation is shown.

Author
M.Frank CERN/LHCb
Version
1.0

Definition at line 46 of file KeyedObjectManager.h.

Member Typedef Documentation

template<class SETUP >
typedef std::vector<void*> Containers::KeyedObjectManager< SETUP >::seq_type
private

Definition at line 48 of file KeyedObjectManager.h.

Constructor & Destructor Documentation

template<class T >
Containers::KeyedObjectManager< T >::KeyedObjectManager ( )

Standard Constructor.

Definition at line 91 of file KeyedObjectManager.cpp.

92 : m_seq(nullptr), m_direct(0)
93 {
94  if ( sizeof(typename T::map_type) > sizeof(m_setup.buffer) ) {
95  throw GaudiException("Basic STL contaier sizes are incompatible",
96  "KeyedContainer",
97  0);
98  }
99  m_setup.s = ::new(m_setup.buffer+sizeof(m_setup.s)) T();
100  m_keyCtxt = -1;
101 }
Define general base for Gaudi exception.
union Containers::KeyedObjectManager::@6 m_setup
seq_type * m_seq
Container holding array like container.
template<class T >
Containers::KeyedObjectManager< T >::~KeyedObjectManager ( )
virtual

Standard Destructor.

Definition at line 104 of file KeyedObjectManager.cpp.

105 {
106  m_setup.s->~T();
107 }
union Containers::KeyedObjectManager::@6 m_setup

Member Function Documentation

template<class SETUP >
static CLID Containers::KeyedObjectManager< SETUP >::classID ( )
static

Access CLID for this type of container.

Definition at line 323 of file KeyedObjectManager.cpp.

323  {
324  return CLID_ObjectVector+0x00030000;
325  }

Definition at line 327 of file KeyedObjectManager.cpp.

327  {
328  return CLID_ObjectVector+0x00040000;
329  }
template<>
CLID Containers::KeyedObjectManager< __A >::classID ( )

Definition at line 563 of file KeyedObjectManager.cpp.

563  {
564  return CLID_ObjectVector+0x00050000;
565 }
template<>
CLID Containers::KeyedObjectManager< __V >::classID ( )

Definition at line 666 of file KeyedObjectManager.cpp.

666  {
667  return CLID_ObjectVector+0x00060000;
668 }
template<class T >
void Containers::KeyedObjectManager< T >::clear ( )

Clear content of the vector.

Definition at line 265 of file KeyedObjectManager.cpp.

266 {
267  clearDirect();
268  m_seq->clear();
269 }
void clearDirect()
Clear all direct access fields.
seq_type * m_seq
Container holding array like container.
template<class T >
void Containers::KeyedObjectManager< T >::clearDirect ( )

Clear all direct access fields.

Definition at line 272 of file KeyedObjectManager.cpp.

273 {
274  switch( m_direct ) {
275  case 1:
276  m_setup.s->m.clear();
277  break;
278  case 0:
279  m_setup.s->v.clear();
280  break;
281  default:
282  break;
283  }
284  m_direct = 0;
285  m_keyCtxt = -1;
286 }
union Containers::KeyedObjectManager::@6 m_setup
template<>
void Containers::KeyedObjectManager< __A >::clearDirect ( )

Definition at line 462 of file KeyedObjectManager.cpp.

462  {
463  m_setup.s->v.clear();
464  m_setup.s->m_idx.clear();
465  m_direct = 0;
466  m_keyCtxt = -1;
467 }
union Containers::KeyedObjectManager::@6 m_setup
template<>
void Containers::KeyedObjectManager< __V >::clearDirect ( )

Definition at line 637 of file KeyedObjectManager.cpp.

637  {
638  m_setup.s->v.clear();
639  m_direct = 0;
640  m_keyCtxt = -1;
641 }
union Containers::KeyedObjectManager::@6 m_setup
template<class T >
void * Containers::KeyedObjectManager< T >::erase ( long  key,
const void *  obj 
)

Remove object from container (very inefficient if key is invalid)

Definition at line 213 of file KeyedObjectManager.cpp.

214  {
215  typedef typename T::map_type MTYP;
216  typedef find<MTYP> FND;
217  if ( 1 == m_direct ) {
218  typename T::map_type& m = m_setup.s->m;
219  typename T::map_type::iterator i = (0==obj) ? m_setup.s->m.find(key)
220  : std::find_if(m.begin(),m.end(),FND(obj));
221  if ( i != m_setup.s->m.end() ) {
222  void* o = (*i).second;
223  seq_type::iterator j = std::find(m_seq->begin(),m_seq->end(),o);
224  if ( j != m_seq->end() ) {
225  m_seq->erase(j);
226  m_setup.s->m.erase(i);
227  return o;
228  }
229  }
231  }
232  onDirty();
233  return erase(key, obj);
234 }
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 * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
void onDirty() const
Callback when the container becomes dirty.
list i
Definition: ana.py:128
seq_type * m_seq
Container holding array like container.
template<class T >
long Containers::KeyedObjectManager< T >::erase ( seq_type::iterator  beg,
seq_type::iterator  end 
)

Remove object by sequential iterators.

Definition at line 290 of file KeyedObjectManager.cpp.

292 {
293  typedef typename T::map_type MTYP;
294  typedef find<MTYP> FND;
295  if ( 0 == m_direct ) {
296  onDirty();
297  return erase(beg, end);
298  }
299  if ( beg == m_seq->begin() && end == m_seq->end() ) {
300  clear();
301  }
302  else {
303  for ( seq_type::iterator j=beg; j != end; ++j) {
304  typename T::map_type& m = m_setup.s->m;
305  typename T::map_type::iterator i = std::find_if(m.begin(),m.end(),FND(*j));
306  if ( i != m_setup.s->m.end() ) {
307  m_setup.s->m.erase(i);
308  continue;
309  }
311  }
312  m_seq->erase(beg, end);
313  }
314  return OBJ_ERASED;
315 }
void clear()
Clear content of the vector.
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 * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
void onDirty() const
Callback when the container becomes dirty.
tuple end
Definition: IOTest.py:101
Object was removed, but not deleted.
Definition: KeyedTraits.h:23
list i
Definition: ana.py:128
seq_type * m_seq
Container holding array like container.
template<>
void * Containers::KeyedObjectManager< __A >::erase ( long  key,
const void *  obj 
)

Definition at line 471 of file KeyedObjectManager.cpp.

473 {
474  typedef std::vector<long> id_type;
475  typedef id_type::iterator id_iter;
476  if ( 0 == m_direct ) {
477  onDirty();
478  return erase(key, obj);
479  }
480  if ( 0 != obj ) {
481  id_type& idx = m_setup.s->m_idx;
482  for ( id_iter i=idx.begin(); i != idx.end(); i++ ) {
483  seq_type::iterator j = m_setup.s->v.begin()+(*i);
484  seq_type::iterator k = std::find(m_seq->begin(),m_seq->end(),*j);
485  if ( *j == obj ) {
486  void* o = *j;
487  m_seq->erase(k);
488  m_setup.s->v.erase(j);
489  std::for_each(m_setup.s->m_idx.begin(),
490  m_setup.s->m_idx.end(),
491  array::decrement(*i));
492  *i = -1;
493  return o;
494  }
495  }
496  }
497  else if ( key >= 0 && key < long(m_setup.s->m_idx.size()) ) {
498  id_iter idx = m_setup.s->m_idx.begin()+key;
499  if ( *idx != -1 ) {
500  seq_type::iterator i = m_setup.s->v.begin()+(*idx);
501  if ( i == m_setup.s->v.end() ) {
503  }
504  void* o = *i;
505  seq_type::iterator j=std::find(m_seq->begin(),m_seq->end(),o);
506  if ( j == m_seq->end() ) {
508  }
509  m_seq->erase(j);
510  m_setup.s->v.erase(i);
511  std::for_each(m_setup.s->m_idx.begin(),
512  m_setup.s->m_idx.end(),
513  array::decrement(*idx));
514  *idx = -1;
515  return o;
516  }
517  }
519  return 0;
520 }
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 * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
void onDirty() const
Callback when the container becomes dirty.
list i
Definition: ana.py:128
seq_type * m_seq
Container holding array like container.
template<>
long Containers::KeyedObjectManager< __A >::erase ( seq_type::iterator  beg,
seq_type::iterator  end 
)

Definition at line 524 of file KeyedObjectManager.cpp.

526 {
527  typedef std::vector<long> id_type;
528  typedef id_type::iterator id_iter;
529  if ( beg == m_seq->begin() && end == m_seq->end() ) {
530  clear();
531  return OBJ_ERASED;
532  }
533  else if ( 0 == m_direct ) {
534  onDirty();
535  return erase(beg, end);
536  }
537  else {
538  long cnt = 0, nobj = end-beg;
539  id_type& idx = m_setup.s->m_idx;
540  for ( id_iter i=idx.begin(); i != idx.end(); i++ ) {
541  seq_type::iterator j = m_setup.s->v.begin()+(*i);
542  seq_type::iterator k = std::find(beg,end,*j);
543  if ( k != end ) {
544  m_setup.s->v.erase(j);
545  std::for_each(m_setup.s->m_idx.begin(),
546  m_setup.s->m_idx.end(),
547  array::decrement(*i));
548  *i = -1;
549  cnt++;
550  if ( cnt == nobj ) break;
551  }
552  }
553  m_seq->erase(beg, end);
554  if ( cnt != nobj ) {
556  }
557  return OBJ_ERASED;
558  }
559  // cannot reach this point
560 }
void clear()
Clear content of the vector.
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 * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
void onDirty() const
Callback when the container becomes dirty.
tuple end
Definition: IOTest.py:101
Object was removed, but not deleted.
Definition: KeyedTraits.h:23
list i
Definition: ana.py:128
seq_type * m_seq
Container holding array like container.
template<>
void * Containers::KeyedObjectManager< __V >::erase ( long  ,
const void *   
)

Definition at line 645 of file KeyedObjectManager.cpp.

647 {
649  return 0;
650 }
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
template<>
long Containers::KeyedObjectManager< __V >::erase ( seq_type::iterator  beg,
seq_type::iterator  end 
)

Definition at line 654 of file KeyedObjectManager.cpp.

656 {
657  if ( beg == m_seq->begin() && end == m_seq->end() ) {
658  clear();
659  return OBJ_ERASED;
660  }
662  return OBJ_ERASED;
663 }
void clear()
Clear content of the vector.
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
tuple end
Definition: IOTest.py:101
Object was removed, but not deleted.
Definition: KeyedTraits.h:23
seq_type * m_seq
Container holding array like container.
template<class T >
long Containers::KeyedObjectManager< T >::insert ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long *  k 
)

Insert new object into container.

Definition at line 127 of file KeyedObjectManager.cpp.

132 {
133  *key = ++m_keyCtxt;
134  return insert(pBase, pObject, obj, *key);
135 }
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
template<class T >
long Containers::KeyedObjectManager< T >::insert ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long  k 
)

Insert new object into container.

Keep major key value

Definition at line 138 of file KeyedObjectManager.cpp.

143 {
145  if ( key > m_keyCtxt ) {
146  m_keyCtxt = key;
147  }
148  if ( 1==m_direct ) {
149  if ( m_setup.s->insert(obj, key) ) {
150  if ( !pObject->parent() ) {
151  pObject->setParent(pBase);
152  }
153  m_seq->push_back(obj);
154  return OBJ_INSERTED;
155  }
156  }
157  else if ( key == long(m_setup.s->v.size()) ) {
158  m_setup.s->v.push_back(obj);
159  if ( !pObject->parent() ) {
160  pObject->setParent(pBase);
161  }
162  m_seq->push_back(obj);
163  return OBJ_INSERTED;
164  }
165  else {
166  // Document is dirty now...
167  // need to copy all pointers from the vector to the map
168  onDirty();
169  return insert(pBase, pObject, obj, key);
170  }
172  return OBJ_CANNOT_INSERT;
173 }
Object was inserted into the container.
Definition: KeyedTraits.h:24
union Containers::KeyedObjectManager::@6 m_setup
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Cannot insert object into container.
Definition: KeyedTraits.h:25
void onDirty() const
Callback when the container becomes dirty.
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
seq_type * m_seq
Container holding array like container.
template<>
long Containers::KeyedObjectManager< __A >::insert ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long *  k 
)

Definition at line 377 of file KeyedObjectManager.cpp.

381 {
382  // auto key creation only possible for direct access!
383  if ( 0 == m_direct ) {
384  m_seq->push_back(o);
385  m_setup.s->v.push_back(o);
386  if ( !c->parent() ) c->setParent(b);
387  *k = ++m_keyCtxt;
388  return OBJ_INSERTED;
389  }
391  return OBJ_CANNOT_INSERT;
392 }
Object was inserted into the container.
Definition: KeyedTraits.h:24
union Containers::KeyedObjectManager::@6 m_setup
const ObjectContainerBase * parent() const
Access to parent object.
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Cannot insert object into container.
Definition: KeyedTraits.h:25
void setParent(ObjectContainerBase *value)
Update parent member.
seq_type * m_seq
Container holding array like container.
template<>
long Containers::KeyedObjectManager< __A >::insert ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long  k 
)

Keep major key value

Extend redirection array and insert

Definition at line 396 of file KeyedObjectManager.cpp.

400 {
401  if ( 0 == m_direct ) {
402  if ( k == m_keyCtxt+1 ) {
403  return insert(b, c, o, &k);
404  }
405  onDirty();
406  return insert(b, c, o, k);
407  }
409  if ( k > m_keyCtxt ) m_keyCtxt = k;
411  if ( k+1 > long(m_setup.s->m_idx.size()) ) {
412  m_setup.s->m_idx.resize(k+1, -1);
413  }
414  std::vector<long>::iterator idx = m_setup.s->m_idx.begin()+k;
415  if ( *idx == -1 ) {
416  *idx = m_setup.s->v.size();
417  m_setup.s->v.push_back(o);
418  m_seq->push_back(o);
419  if ( !c->parent() ) c->setParent(b);
420  return OBJ_INSERTED;
421  }
423  return OBJ_CANNOT_INSERT;
424 }
Object was inserted into the container.
Definition: KeyedTraits.h:24
union Containers::KeyedObjectManager::@6 m_setup
const ObjectContainerBase * parent() const
Access to parent object.
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Cannot insert object into container.
Definition: KeyedTraits.h:25
void onDirty() const
Callback when the container becomes dirty.
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
void setParent(ObjectContainerBase *value)
Update parent member.
seq_type * m_seq
Container holding array like container.
template<>
long Containers::KeyedObjectManager< __V >::insert ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long *  k 
)

Definition at line 593 of file KeyedObjectManager.cpp.

597 {
598  m_seq->push_back(o);
599  m_setup.s->v.push_back(o);
600  if ( !c->parent() ) c->setParent(b);
601  *k = (m_setup.s->v.size()-1);
602  return OBJ_INSERTED;
603 }
Object was inserted into the container.
Definition: KeyedTraits.h:24
union Containers::KeyedObjectManager::@6 m_setup
const ObjectContainerBase * parent() const
Access to parent object.
void setParent(ObjectContainerBase *value)
Update parent member.
seq_type * m_seq
Container holding array like container.
template<>
long Containers::KeyedObjectManager< __V >::insert ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long  k 
)

Definition at line 607 of file KeyedObjectManager.cpp.

611 {
612  if ( k == long(m_setup.s->v.size()) ) {
613  return insert(b, c, o, &k);
614  }
616  return OBJ_CANNOT_INSERT;
617 }
union Containers::KeyedObjectManager::@6 m_setup
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Cannot insert object into container.
Definition: KeyedTraits.h:25
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
template<class T >
long Containers::KeyedObjectManager< T >::insertDirect ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long  k 
)

Insert element into direct access map.

Keep major key value

Definition at line 176 of file KeyedObjectManager.cpp.

181 {
183  if ( key > m_keyCtxt ) {
184  m_keyCtxt = key;
185  }
186  if ( 1==m_direct ) {
187  if ( m_setup.s->insert(obj, key) ) {
188  if ( !pObject->parent() ) {
189  pObject->setParent(pBase);
190  }
191  return OBJ_INSERTED;
192  }
193  }
194  else if ( key == long(m_setup.s->v.size()) ) {
195  m_setup.s->v.push_back(obj);
196  if ( !pObject->parent() ) {
197  pObject->setParent(pBase);
198  }
199  return OBJ_INSERTED;
200  }
201  else {
202  // Document is dirty now...
203  // need to copy all pointers from the vector to the map
204  onDirty();
205  return insertDirect(pBase, pObject, obj, key);
206  }
208  return OBJ_CANNOT_INSERT;
209 }
Object was inserted into the container.
Definition: KeyedTraits.h:24
union Containers::KeyedObjectManager::@6 m_setup
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Cannot insert object into container.
Definition: KeyedTraits.h:25
void onDirty() const
Callback when the container becomes dirty.
long insertDirect(ObjectContainerBase *b, ContainedObject *c, void *o, long k)
Insert element into direct access map.
template<>
long Containers::KeyedObjectManager< __A >::insertDirect ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long  k 
)

Keep major key value

Extend redirection array and insert

Definition at line 428 of file KeyedObjectManager.cpp.

432 {
433  if ( 0 == m_direct ) {
434  if ( k == m_keyCtxt+1 ) {
435  m_setup.s->v.push_back(o);
436  if ( !c->parent() ) c->setParent(b);
437  ++m_keyCtxt;
438  return OBJ_INSERTED;
439  }
440  onDirty();
441  return insertDirect(b, c, o, k);
442  }
444  if ( k > m_keyCtxt ) m_keyCtxt = k;
446  if ( k+1 > long(m_setup.s->m_idx.size()) ) {
447  m_setup.s->m_idx.resize(k+1, -1);
448  }
449  std::vector<long>::iterator idx = m_setup.s->m_idx.begin()+k;
450  if ( *idx == -1 ) {
451  *idx = m_setup.s->v.size();
452  m_setup.s->v.push_back(o);
453  if ( !c->parent() ) c->setParent(b);
454  return OBJ_INSERTED;
455  }
457  return OBJ_CANNOT_INSERT;
458 }
Object was inserted into the container.
Definition: KeyedTraits.h:24
union Containers::KeyedObjectManager::@6 m_setup
const ObjectContainerBase * parent() const
Access to parent object.
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Cannot insert object into container.
Definition: KeyedTraits.h:25
void onDirty() const
Callback when the container becomes dirty.
void setParent(ObjectContainerBase *value)
Update parent member.
long insertDirect(ObjectContainerBase *b, ContainedObject *c, void *o, long k)
Insert element into direct access map.
template<>
long Containers::KeyedObjectManager< __V >::insertDirect ( ObjectContainerBase b,
ContainedObject c,
void *  o,
long  k 
)

Definition at line 621 of file KeyedObjectManager.cpp.

625 {
626  if ( k == long(m_setup.s->v.size()) ) {
627  m_setup.s->v.push_back(o);
628  if ( !c->parent() ) c->setParent(b);
629  return OBJ_INSERTED;
630  }
632  return OBJ_CANNOT_INSERT;
633 }
Object was inserted into the container.
Definition: KeyedTraits.h:24
union Containers::KeyedObjectManager::@6 m_setup
const ObjectContainerBase * parent() const
Access to parent object.
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Cannot insert object into container.
Definition: KeyedTraits.h:25
void setParent(ObjectContainerBase *value)
Update parent member.
template<class SETUP >
long Containers::KeyedObjectManager< SETUP >::isDirect ( ) const
inline

Check if the container is dirty.

Definition at line 73 of file KeyedObjectManager.h.

73 { return m_direct; }
template<class T >
void * Containers::KeyedObjectManager< T >::object ( long  key) const

Retrieve object identified by a key from the container.

Definition at line 237 of file KeyedObjectManager.cpp.

238 {
239  if ( 0 == m_direct ) {
240  onDirty();
241  }
242  typename T::map_type::const_iterator i = m_setup.s->m.find(key);
243  if ( i != m_setup.s->m.end() ) {
244  return (*i).second;
245  }
246  return 0;
247 }
union Containers::KeyedObjectManager::@6 m_setup
void onDirty() const
Callback when the container becomes dirty.
list i
Definition: ana.py:128
template<>
void * Containers::KeyedObjectManager< __A >::object ( long  value) const

Definition at line 347 of file KeyedObjectManager.cpp.

348 {
349 #ifdef CHECK_KEYED_CONTAINER
350  unsigned long siz = m_setup.s->m_idx.size();
351  if ( value >= 0 && size_t(value) < siz ) {
352  long ent = *(m_setup.s->m_idx.begin()+value);
353  if ( ent >= 0 ) {
354  return *(m_setup.s->v.begin() + ent);
355  }
356  }
357  return 0;
358 #else
359  return *(m_setup.s->v.begin() + (*(m_setup.s->m_idx.begin()+value)));
360 #endif
361 }
union Containers::KeyedObjectManager::@6 m_setup
template<>
void * Containers::KeyedObjectManager< __V >::object ( long  ) const

Definition at line 580 of file KeyedObjectManager.cpp.

581 {
583  return 0;
584 }
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
template<class T >
void Containers::KeyedObjectManager< T >::onDirty ( ) const
private

Callback when the container becomes dirty.

Definition at line 118 of file KeyedObjectManager.cpp.

118  {
119  m_direct = 1;
120  for(int i = 0, stop = m_setup.s->v.size(); i < stop; i++ ) {
121  m_setup.s->insert(*(m_setup.s->v.begin()+i), i);
122  }
123  m_setup.s->v.clear();
124 }
union Containers::KeyedObjectManager::@6 m_setup
list i
Definition: ana.py:128
template<>
void Containers::KeyedObjectManager< __A >::onDirty ( ) const
private

Definition at line 364 of file KeyedObjectManager.cpp.

364  {
365  m_direct = 1;
366  m_setup.s->m_idx.reserve(m_setup.s->v.size()+1);
367  for(int i = 0, stop = m_setup.s->v.size(); i < stop; ++i) {
368  if ( m_setup.s->v[i] == 0 ) {
370  }
371  m_setup.s->m_idx.push_back(i);
372  }
373 }
union Containers::KeyedObjectManager::@6 m_setup
GAUDI_API void containerIsInconsistent()
Function to be called to indicate that the container is found to be inconsistent. ...
list i
Definition: ana.py:128
template<>
void Containers::KeyedObjectManager< __V >::onDirty ( ) const
private

Definition at line 587 of file KeyedObjectManager.cpp.

587  {
589 }
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
template<class T >
void Containers::KeyedObjectManager< T >::reserve ( long  size)

Reserve buffer space.

Definition at line 250 of file KeyedObjectManager.cpp.

251 {
252  switch( m_direct ) {
253  case 1:
254  break;
255  case 0:
256  m_setup.s->v.reserve(len);
257  break;
258  default:
259  break;
260  }
261  m_seq->reserve(len);
262 }
union Containers::KeyedObjectManager::@6 m_setup
seq_type * m_seq
Container holding array like container.
template<class T >
void Containers::KeyedObjectManager< T >::setup ( void *  seq,
void **  rndm 
)

Setup of the Map and the parent object.

Definition at line 111 of file KeyedObjectManager.cpp.

112 {
113  m_seq = (seq_type*)seq;
114  *rndm = &m_setup.s->v;
115 }
union Containers::KeyedObjectManager::@6 m_setup
std::vector< void * > seq_type
seq_type * m_seq
Container holding array like container.

Member Data Documentation

template<class SETUP >
char Containers::KeyedObjectManager< SETUP >::buffer[128]

Buffer space to hold keyed container.

Definition at line 56 of file KeyedObjectManager.h.

template<class SETUP >
long Containers::KeyedObjectManager< SETUP >::m_direct
mutableprivate

Dirty flag.

Definition at line 52 of file KeyedObjectManager.h.

template<class SETUP >
long Containers::KeyedObjectManager< SETUP >::m_keyCtxt
mutableprivate

Definition at line 53 of file KeyedObjectManager.h.

template<class SETUP >
seq_type* Containers::KeyedObjectManager< SETUP >::m_seq
private

Container holding array like container.

Definition at line 50 of file KeyedObjectManager.h.

union { ... } Containers::KeyedObjectManager< SETUP >::m_setup
template<class SETUP >
SETUP* Containers::KeyedObjectManager< SETUP >::s

Definition at line 57 of file KeyedObjectManager.h.


The documentation for this class was generated from the following files: