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_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
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 324 of file KeyedObjectManager.cpp.

324  {
325  return CLID_ObjectVector+0x00030000;
326  }

Definition at line 328 of file KeyedObjectManager.cpp.

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

Definition at line 566 of file KeyedObjectManager.cpp.

566  {
567  return CLID_ObjectVector+0x00050000;
568 }
template<>
CLID Containers::KeyedObjectManager< __V >::classID ( )

Definition at line 669 of file KeyedObjectManager.cpp.

669  {
670  return CLID_ObjectVector+0x00060000;
671 }
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  typedef typename T::map_type MTYP;
275  switch( m_direct ) {
276  case 1:
277  m_setup.s->m.clear();
278  break;
279  case 0:
280  m_setup.s->v.clear();
281  break;
282  default:
283  break;
284  }
285  m_direct = 0;
286  m_keyCtxt = -1;
287 }
union Containers::KeyedObjectManager::@6 m_setup
template<>
void Containers::KeyedObjectManager< __A >::clearDirect ( )

Definition at line 463 of file KeyedObjectManager.cpp.

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

Definition at line 640 of file KeyedObjectManager.cpp.

640  {
641  m_setup.s->v.clear();
642  m_direct = 0;
643  m_keyCtxt = -1;
644 }
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 291 of file KeyedObjectManager.cpp.

293 {
294  typedef typename T::map_type MTYP;
295  typedef find<MTYP> FND;
296  if ( 0 == m_direct ) {
297  onDirty();
298  return erase(beg, end);
299  }
300  if ( beg == m_seq->begin() && end == m_seq->end() ) {
301  clear();
302  }
303  else {
304  for ( seq_type::iterator j=beg; j != end; ++j) {
305  typename T::map_type& m = m_setup.s->m;
306  typename T::map_type::iterator i = std::find_if(m.begin(),m.end(),FND(*j));
307  if ( i != m_setup.s->m.end() ) {
308  m_setup.s->m.erase(i);
309  continue;
310  }
312  }
313  m_seq->erase(beg, end);
314  }
315  return OBJ_ERASED;
316 }
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 472 of file KeyedObjectManager.cpp.

474 {
475  typedef std::vector<long> id_type;
476  typedef id_type::iterator id_iter;
477  typedef __A::map_type MTYP;
478  typedef find<MTYP> FND;
479  if ( 0 == m_direct ) {
480  onDirty();
481  return erase(key, obj);
482  }
483  if ( 0 != obj ) {
484  id_type& idx = m_setup.s->m_idx;
485  for ( id_iter i=idx.begin(); i != idx.end(); i++ ) {
486  seq_type::iterator j = m_setup.s->v.begin()+(*i);
487  seq_type::iterator k = std::find(m_seq->begin(),m_seq->end(),*j);
488  if ( *j == obj ) {
489  void* o = *j;
490  m_seq->erase(k);
491  m_setup.s->v.erase(j);
492  std::for_each(m_setup.s->m_idx.begin(),
493  m_setup.s->m_idx.end(),
494  array::decrement(*i));
495  *i = -1;
496  return o;
497  }
498  }
499  }
500  else if ( key >= 0 && key < long(m_setup.s->m_idx.size()) ) {
501  id_iter idx = m_setup.s->m_idx.begin()+key;
502  if ( *idx != -1 ) {
503  seq_type::iterator i = m_setup.s->v.begin()+(*idx);
504  if ( i == m_setup.s->v.end() ) {
506  }
507  void* o = *i;
508  seq_type::iterator j=std::find(m_seq->begin(),m_seq->end(),o);
509  if ( j == m_seq->end() ) {
511  }
512  m_seq->erase(j);
513  m_setup.s->v.erase(i);
514  std::for_each(m_setup.s->m_idx.begin(),
515  m_setup.s->m_idx.end(),
516  array::decrement(*idx));
517  *idx = -1;
518  return o;
519  }
520  }
522  return 0;
523 }
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 * 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 527 of file KeyedObjectManager.cpp.

529 {
530  typedef std::vector<long> id_type;
531  typedef id_type::iterator id_iter;
532  if ( beg == m_seq->begin() && end == m_seq->end() ) {
533  clear();
534  return OBJ_ERASED;
535  }
536  else if ( 0 == m_direct ) {
537  onDirty();
538  return erase(beg, end);
539  }
540  else {
541  long cnt = 0, nobj = end-beg;
542  id_type& idx = m_setup.s->m_idx;
543  for ( id_iter i=idx.begin(); i != idx.end(); i++ ) {
544  seq_type::iterator j = m_setup.s->v.begin()+(*i);
545  seq_type::iterator k = std::find(beg,end,*j);
546  if ( k != end ) {
547  m_setup.s->v.erase(j);
548  std::for_each(m_setup.s->m_idx.begin(),
549  m_setup.s->m_idx.end(),
550  array::decrement(*i));
551  *i = -1;
552  cnt++;
553  if ( cnt == nobj ) break;
554  }
555  }
556  m_seq->erase(beg, end);
557  if ( cnt != nobj ) {
559  }
560  return OBJ_ERASED;
561  }
562  // cannot reach this point
563 }
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 648 of file KeyedObjectManager.cpp.

650 {
652  return 0;
653 }
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 657 of file KeyedObjectManager.cpp.

659 {
660  if ( beg == m_seq->begin() && end == m_seq->end() ) {
661  clear();
662  return OBJ_ERASED;
663  }
665  return OBJ_ERASED;
666 }
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 378 of file KeyedObjectManager.cpp.

382 {
383  // auto key creation only possible for direct access!
384  if ( 0 == m_direct ) {
385  m_seq->push_back(o);
386  m_setup.s->v.push_back(o);
387  if ( !c->parent() ) c->setParent(b);
388  *k = ++m_keyCtxt;
389  return OBJ_INSERTED;
390  }
392  return OBJ_CANNOT_INSERT;
393 }
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 397 of file KeyedObjectManager.cpp.

401 {
402  if ( 0 == m_direct ) {
403  if ( k == m_keyCtxt+1 ) {
404  return insert(b, c, o, &k);
405  }
406  onDirty();
407  return insert(b, c, o, k);
408  }
410  if ( k > m_keyCtxt ) m_keyCtxt = k;
412  if ( k+1 > long(m_setup.s->m_idx.size()) ) {
413  m_setup.s->m_idx.resize(k+1, -1);
414  }
415  std::vector<long>::iterator idx = m_setup.s->m_idx.begin()+k;
416  if ( *idx == -1 ) {
417  *idx = m_setup.s->v.size();
418  m_setup.s->v.push_back(o);
419  m_seq->push_back(o);
420  if ( !c->parent() ) c->setParent(b);
421  return OBJ_INSERTED;
422  }
424  return OBJ_CANNOT_INSERT;
425 }
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 596 of file KeyedObjectManager.cpp.

600 {
601  m_seq->push_back(o);
602  m_setup.s->v.push_back(o);
603  if ( !c->parent() ) c->setParent(b);
604  *k = (m_setup.s->v.size()-1);
605  return OBJ_INSERTED;
606 }
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 610 of file KeyedObjectManager.cpp.

614 {
615  if ( k == long(m_setup.s->v.size()) ) {
616  return insert(b, c, o, &k);
617  }
619  return OBJ_CANNOT_INSERT;
620 }
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 429 of file KeyedObjectManager.cpp.

433 {
434  if ( 0 == m_direct ) {
435  if ( k == m_keyCtxt+1 ) {
436  m_setup.s->v.push_back(o);
437  if ( !c->parent() ) c->setParent(b);
438  ++m_keyCtxt;
439  return OBJ_INSERTED;
440  }
441  onDirty();
442  return insertDirect(b, c, o, k);
443  }
445  if ( k > m_keyCtxt ) m_keyCtxt = k;
447  if ( k+1 > long(m_setup.s->m_idx.size()) ) {
448  m_setup.s->m_idx.resize(k+1, -1);
449  }
450  std::vector<long>::iterator idx = m_setup.s->m_idx.begin()+k;
451  if ( *idx == -1 ) {
452  *idx = m_setup.s->v.size();
453  m_setup.s->v.push_back(o);
454  if ( !c->parent() ) c->setParent(b);
455  return OBJ_INSERTED;
456  }
458  return OBJ_CANNOT_INSERT;
459 }
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 624 of file KeyedObjectManager.cpp.

628 {
629  if ( k == long(m_setup.s->v.size()) ) {
630  m_setup.s->v.push_back(o);
631  if ( !c->parent() ) c->setParent(b);
632  return OBJ_INSERTED;
633  }
635  return OBJ_CANNOT_INSERT;
636 }
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 348 of file KeyedObjectManager.cpp.

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

Definition at line 583 of file KeyedObjectManager.cpp.

584 {
586  return 0;
587 }
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 365 of file KeyedObjectManager.cpp.

365  {
366  m_direct = 1;
367  m_setup.s->m_idx.reserve(m_setup.s->v.size()+1);
368  for(int i = 0, stop = m_setup.s->v.size(); i < stop; ++i) {
369  if ( m_setup.s->v[i] == 0 ) {
371  }
372  m_setup.s->m_idx.push_back(i);
373  }
374 }
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 590 of file KeyedObjectManager.cpp.

590  {
592 }
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: