| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
Containers::KeyedObjectManager< SETUP > Class Template Reference

KeyedObjectManager Class to manage keyed objects. More...

`#include <GaudiKernel/KeyedObjectManager.h>`

Collaboration diagram for Containers::KeyedObjectManager< SETUP >:
[legend]

## 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_type * | m_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 45 of file KeyedObjectManager.h.

## Member Typedef Documentation

template<class SETUP >

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

Definition at line 47 of file KeyedObjectManager.h.

## Constructor & Destructor Documentation

template<class T >

Containers::KeyedObjectManager< T >::KeyedObjectManager | ( |  | ) |

Standard Constructor.

Definition at line 88 of file KeyedObjectManager.cpp.

89 : m_seq(nullptr), m_direct(0)
90 {
91 if ( sizeof(typename T::map_type) > sizeof(m_setup.buffer) ) {
92 throw GaudiException("Basic STL contaier sizes are incompatible",
93 "KeyedContainer",
94 0);
95 }
96 m_setup.s = ::new(m_setup.buffer+sizeof(m_setup.s)) T();
97 m_keyCtxt = -1;
98 }
GaudiException
Define general base for Gaudi exception.
Definition: GaudiException.h:23
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::KeyedObjectManager::m_keyCtxt
long m_keyCtxt
Definition: KeyedObjectManager.h:52
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<class T >

Containers::KeyedObjectManager< T >::~KeyedObjectManager | ( |  | ) |
| virtual

Standard Destructor.

Definition at line 101 of file KeyedObjectManager.cpp.

102 {
103 m_setup.s->~T();
104 }
Containers::KeyedObjectManager::m_setup
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.

template<>

CLID Containers::KeyedObjectManager< Containers::map >::classID | ( |  | ) |

Definition at line 316 of file KeyedObjectManager.cpp.

316 {
317 return CLID_ObjectVector+0x00030000;
318 }
template<>

CLID Containers::KeyedObjectManager< Containers::hashmap >::classID | ( |  | ) |

Definition at line 320 of file KeyedObjectManager.cpp.

320 {
321 return CLID_ObjectVector+0x00040000;
322 }
template<>

CLID Containers::KeyedObjectManager< __A >::classID | ( |  | ) |

Definition at line 556 of file KeyedObjectManager.cpp.

556 {
557 return CLID_ObjectVector+0x00050000;
558 }
template<>

CLID Containers::KeyedObjectManager< __V >::classID | ( |  | ) |

Definition at line 659 of file KeyedObjectManager.cpp.

659 {
660 return CLID_ObjectVector+0x00060000;
661 }
template<class T >

void Containers::KeyedObjectManager< T >::clear | ( |  | ) |

Clear content of the vector.

Definition at line 258 of file KeyedObjectManager.cpp.

259 {
260 clearDirect();
261 m_seq->clear();
262 }
Containers::KeyedObjectManager::clearDirect
void clearDirect()
Clear all direct access fields.
Definition: KeyedObjectManager.cpp:265
std::vector::clear
T clear(T...args)
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<class T >

void Containers::KeyedObjectManager< T >::clearDirect | ( |  | ) |

Clear all direct access fields.

Definition at line 265 of file KeyedObjectManager.cpp.

266 {
267 switch( m_direct ) {
268 case 1:
269 m_setup.s->m.clear();
270 break;
271 case 0:
272 m_setup.s->v.clear();
273 break;
274 default:
275 break;
276 }
277 m_direct = 0;
278 m_keyCtxt = -1;
279 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::KeyedObjectManager::m_keyCtxt
long m_keyCtxt
Definition: KeyedObjectManager.h:52
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
template<>

void Containers::KeyedObjectManager< __A >::clearDirect | ( |  | ) |

Definition at line 455 of file KeyedObjectManager.cpp.

455 {
456 m_setup.s->v.clear();
457 m_setup.s->m_idx.clear();
458 m_direct = 0;
459 m_keyCtxt = -1;
460 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::KeyedObjectManager::m_keyCtxt
long m_keyCtxt
Definition: KeyedObjectManager.h:52
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
template<>

void Containers::KeyedObjectManager< __V >::clearDirect | ( |  | ) |

Definition at line 630 of file KeyedObjectManager.cpp.

630 {
631 m_setup.s->v.clear();
632 m_direct = 0;
633 m_keyCtxt = -1;
634 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::KeyedObjectManager::m_keyCtxt
long m_keyCtxt
Definition: KeyedObjectManager.h:52
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
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 210 of file KeyedObjectManager.cpp.

211 {
212 typedef typename T::map_type MTYP;
213 typedef find<MTYP> FND;
214 if ( 1 == m_direct ) {
215 auto& m = m_setup.s->m;
216 auto i = (obj ? std::find_if(m.begin(),m.end(),FND(obj))
217 : m_setup.s->m.find(key) );
218 if ( i != m_setup.s->m.end() ) {
219 void* o = i->second;
220 auto j = std::find(m_seq->begin(),m_seq->end(),o);
221 if ( j != m_seq->end() ) {
222 m_seq->erase(j);
223 m_setup.s->m.erase(i);
224 return o;
225 }
226 }
227 containerIsInconsistent();
228 }
229 onDirty();
230 return erase(key, obj);
231 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::containerIsInconsistent
GAUDI_API void containerIsInconsistent()
Function to be called to indicate that the container is found to be inconsistent. ...
Definition: KeyedObjectManager.cpp:75
std::vector::end
T end(T...args)
Containers::KeyedObjectManager::erase
void * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
Definition: KeyedObjectManager.cpp:210
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:93
std::vector::erase
T erase(T...args)
Containers::KeyedObjectManager::onDirty
void onDirty() const
Callback when the container becomes dirty.
Definition: KeyedObjectManager.cpp:115
std::find_if
T find_if(T...args)
std::vector::begin
T begin(T...args)
ana.i
list i
Definition: ana.py:128
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<class T >

long Containers::KeyedObjectManager< T >::erase | ( | seq_type::iterator | beg,
|  | seq_type::iterator | end
| ) |  |

Remove object by sequential iterators.

Definition at line 283 of file KeyedObjectManager.cpp.

285 {
286 typedef typename T::map_type MTYP;
287 typedef find<MTYP> FND;
288 if ( 0 == m_direct ) {
289 onDirty();
290 return erase(beg, end);
291 }
292 if ( beg == m_seq->begin() && end == m_seq->end() ) {
293 clear();
294 }
295 else {
296 for ( auto j=beg; j != end; ++j) {
297 auto& m = m_setup.s->m;
298 auto i = std::find_if(m.begin(),m.end(),FND(*j));
299 if ( i != m_setup.s->m.end() ) {
300 m_setup.s->m.erase(i);
301 continue;
302 }
303 containerIsInconsistent();
304 }
305 m_seq->erase(beg, end);
306 }
307 return OBJ_ERASED;
308 }
Containers::KeyedObjectManager::clear
void clear()
Clear content of the vector.
Definition: KeyedObjectManager.cpp:258
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::containerIsInconsistent
GAUDI_API void containerIsInconsistent()
Function to be called to indicate that the container is found to be inconsistent. ...
Definition: KeyedObjectManager.cpp:75
std::vector::end
T end(T...args)
Containers::KeyedObjectManager::erase
void * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
Definition: KeyedObjectManager.cpp:210
Gaudi::Units::m
constexpr double m
Definition: SystemOfUnits.h:93
std::vector::erase
T erase(T...args)
Containers::KeyedObjectManager::onDirty
void onDirty() const
Callback when the container becomes dirty.
Definition: KeyedObjectManager.cpp:115
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
Containers::OBJ_ERASED
Object was removed, but not deleted.
Definition: KeyedTraits.h:22
std::find_if
T find_if(T...args)
std::vector::begin
T begin(T...args)
ana.i
list i
Definition: ana.py:128
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<>

void * Containers::KeyedObjectManager< __A >::erase | ( | long | key,
|  | const void * | obj
| ) |  |

Definition at line 464 of file KeyedObjectManager.cpp.

466 {
467 typedef std::vector<long> id_type;
468 typedef id_type::iterator id_iter;
469 if ( 0 == m_direct ) {
470 onDirty();
471 return erase(key, obj);
472 }
473 if ( obj ) {
474 id_type& idx = m_setup.s->m_idx;
475 for (auto & elem : idx) {
476 auto j = m_setup.s->v.begin()+(elem);
477 auto k = std::find(m_seq->begin(),m_seq->end(),*j);
478 if ( *j == obj ) {
479 void* o = *j;
480 m_seq->erase(k);
481 m_setup.s->v.erase(j);
482 std::for_each(m_setup.s->m_idx.begin(),
483 m_setup.s->m_idx.end(),
484 array::decrement(elem));
485 elem = -1;
486 return o;
487 }
488 }
489 }
490 else if ( key >= 0 && key < long(m_setup.s->m_idx.size()) ) {
491 auto idx = m_setup.s->m_idx.begin()+key;
492 if ( *idx != -1 ) {
493 auto i = m_setup.s->v.begin()+(*idx);
494 if ( i == m_setup.s->v.end() ) {
495 containerIsInconsistent();
496 }
497 void* o = *i;
498 auto j=std::find(m_seq->begin(),m_seq->end(),o);
499 if ( j == m_seq->end() ) {
500 containerIsInconsistent();
501 }
502 m_seq->erase(j);
503 m_setup.s->v.erase(i);
504 std::for_each(m_setup.s->m_idx.begin(),
505 m_setup.s->m_idx.end(),
506 array::decrement(*idx));
507 *idx = -1;
508 return o;
509 }
510 }
511 containerIsInconsistent();
512 return nullptr;
513 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::containerIsInconsistent
GAUDI_API void containerIsInconsistent()
Function to be called to indicate that the container is found to be inconsistent. ...
Definition: KeyedObjectManager.cpp:75
std::vector::end
T end(T...args)
Containers::KeyedObjectManager::erase
void * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
Definition: KeyedObjectManager.cpp:210
std::vector::erase
T erase(T...args)
Containers::KeyedObjectManager::onDirty
void onDirty() const
Callback when the container becomes dirty.
Definition: KeyedObjectManager.cpp:115
std::find
T find(T...args)
std::vector< long >
std::vector::begin
T begin(T...args)
std::for_each
T for_each(T...args)
ana.i
list i
Definition: ana.py:128
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<>

long Containers::KeyedObjectManager< __A >::erase | ( | seq_type::iterator | beg,
|  | seq_type::iterator | end
| ) |  |

Definition at line 517 of file KeyedObjectManager.cpp.

519 {
520 typedef std::vector<long> id_type;
521 typedef id_type::iterator id_iter;
522 if ( beg == m_seq->begin() && end == m_seq->end() ) {
523 clear();
524 return OBJ_ERASED;
525 }
526 else if ( 0 == m_direct ) {
527 onDirty();
528 return erase(beg, end);
529 }
530 else {
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);
535 auto k = std::find(beg,end,*j);
536 if ( k != end ) {
537 m_setup.s->v.erase(j);
538 std::for_each(m_setup.s->m_idx.begin(),
539 m_setup.s->m_idx.end(),
540 array::decrement(elem));
541 elem = -1;
542 cnt++;
543 if ( cnt == nobj ) break;
544 }
545 }
546 m_seq->erase(beg, end);
547 if ( cnt != nobj ) {
548 containerIsInconsistent();
549 }
550 return OBJ_ERASED;
551 }
552 // cannot reach this point
553 }
Containers::KeyedObjectManager::clear
void clear()
Clear content of the vector.
Definition: KeyedObjectManager.cpp:258
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::containerIsInconsistent
GAUDI_API void containerIsInconsistent()
Function to be called to indicate that the container is found to be inconsistent. ...
Definition: KeyedObjectManager.cpp:75
std::vector::end
T end(T...args)
Containers::KeyedObjectManager::erase
void * erase(long key, const void *obj)
Remove object from container (very inefficient if key is invalid)
Definition: KeyedObjectManager.cpp:210
std::vector::erase
T erase(T...args)
Containers::KeyedObjectManager::onDirty
void onDirty() const
Callback when the container becomes dirty.
Definition: KeyedObjectManager.cpp:115
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
Containers::OBJ_ERASED
Object was removed, but not deleted.
Definition: KeyedTraits.h:22
std::find
T find(T...args)
std::vector< long >
std::vector::begin
T begin(T...args)
std::for_each
T for_each(T...args)
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<>

void * Containers::KeyedObjectManager< __V >::erase | ( | long | ,
|  | const void * |
| ) |  |

Definition at line 638 of file KeyedObjectManager.cpp.

640 {
641 invalidContainerOperation();
642 return nullptr;
643 }
Containers::invalidContainerOperation
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
Definition: KeyedObjectManager.cpp:81
template<>

long Containers::KeyedObjectManager< __V >::erase | ( | seq_type::iterator | beg,
|  | seq_type::iterator | end
| ) |  |

Definition at line 647 of file KeyedObjectManager.cpp.

649 {
650 if ( beg == m_seq->begin() && end == m_seq->end() ) {
651 clear();
652 return OBJ_ERASED;
653 }
654 invalidContainerOperation();
655 return OBJ_ERASED;
656 }
Containers::KeyedObjectManager::clear
void clear()
Clear content of the vector.
Definition: KeyedObjectManager.cpp:258
std::vector::end
T end(T...args)
Containers::invalidContainerOperation
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
Definition: KeyedObjectManager.cpp:81
end
auto end(reverse_wrapper< T > &w)
Definition: reverse.h:47
Containers::OBJ_ERASED
Object was removed, but not deleted.
Definition: KeyedTraits.h:22
std::vector::begin
T begin(T...args)
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<class T >

long Containers::KeyedObjectManager< T >::insert | ( | ObjectContainerBase * | b,
|  | ContainedObject * | c,
|  | void * | o,
|  | long * | k
| ) |  |

Insert new object into container.

Definition at line 124 of file KeyedObjectManager.cpp.

129 {
130 *key = ++m_keyCtxt;
131 return insert(pBase, pObject, obj, *key);
132 }
Containers::KeyedObjectManager::m_keyCtxt
long m_keyCtxt
Definition: KeyedObjectManager.h:52
Containers::KeyedObjectManager::insert
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
Definition: KeyedObjectManager.cpp:124
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 135 of file KeyedObjectManager.cpp.

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

long Containers::KeyedObjectManager< __A >::insert | ( | ObjectContainerBase * | b,
|  | ContainedObject * | c,
|  | void * | o,
|  | long * | k
| ) |  |

Definition at line 370 of file KeyedObjectManager.cpp.

374 {
375 // auto key creation only possible for direct access!
376 if ( 0 == m_direct ) {
377 m_seq->push_back(o);
378 m_setup.s->v.push_back(o);
379 if ( !c->parent() ) c->setParent(b);
380 *k = ++m_keyCtxt;
381 return OBJ_INSERTED;
382 }
383 cannotInsertToContainer();
384 return OBJ_CANNOT_INSERT;
385 }
Containers::OBJ_INSERTED
Object was inserted into the container.
Definition: KeyedTraits.h:23
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:49
Containers::cannotInsertToContainer
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Definition: KeyedObjectManager.cpp:69
std::vector::push_back
T push_back(T...args)
Containers::OBJ_CANNOT_INSERT
Cannot insert object into container.
Definition: KeyedTraits.h:24
Containers::KeyedObjectManager::m_keyCtxt
long m_keyCtxt
Definition: KeyedObjectManager.h:52
ContainedObject::setParent
void setParent(ObjectContainerBase *value)
Update parent member.
Definition: ContainedObject.h:51
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
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 389 of file KeyedObjectManager.cpp.

393 {
394 if ( 0 == m_direct ) {
395 if ( k == m_keyCtxt+1 ) {
396 return insert(b, c, o, &k);
397 }
398 onDirty();
399 return insert(b, c, o, k);
400 }
402 if ( k > m_keyCtxt ) m_keyCtxt = k;
404 if ( k+1 > long(m_setup.s->m_idx.size()) ) {
405 m_setup.s->m_idx.resize(k+1, -1);
406 }
407 auto idx = m_setup.s->m_idx.begin()+k;
408 if ( *idx == -1 ) {
409 *idx = m_setup.s->v.size();
410 m_setup.s->v.push_back(o);
411 m_seq->push_back(o);
412 if ( !c->parent() ) c->setParent(b);
413 return OBJ_INSERTED;
414 }
415 cannotInsertToContainer();
416 return OBJ_CANNOT_INSERT;
417 }
Containers::OBJ_INSERTED
Object was inserted into the container.
Definition: KeyedTraits.h:23
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:49
Containers::cannotInsertToContainer
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Definition: KeyedObjectManager.cpp:69
std::vector::push_back
T push_back(T...args)
Containers::OBJ_CANNOT_INSERT
Cannot insert object into container.
Definition: KeyedTraits.h:24
Containers::KeyedObjectManager::m_keyCtxt
long m_keyCtxt
Definition: KeyedObjectManager.h:52
Containers::KeyedObjectManager::onDirty
void onDirty() const
Callback when the container becomes dirty.
Definition: KeyedObjectManager.cpp:115
Containers::KeyedObjectManager::insert
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
Definition: KeyedObjectManager.cpp:124
ContainedObject::setParent
void setParent(ObjectContainerBase *value)
Update parent member.
Definition: ContainedObject.h:51
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<>

long Containers::KeyedObjectManager< __V >::insert | ( | ObjectContainerBase * | b,
|  | ContainedObject * | c,
|  | void * | o,
|  | long * | k
| ) |  |

Definition at line 586 of file KeyedObjectManager.cpp.

590 {
591 m_seq->push_back(o);
592 m_setup.s->v.push_back(o);
593 if ( !c->parent() ) c->setParent(b);
594 *k = (m_setup.s->v.size()-1);
595 return OBJ_INSERTED;
596 }
Containers::OBJ_INSERTED
Object was inserted into the container.
Definition: KeyedTraits.h:23
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:49
std::vector::push_back
T push_back(T...args)
ContainedObject::setParent
void setParent(ObjectContainerBase *value)
Update parent member.
Definition: ContainedObject.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
template<>

long Containers::KeyedObjectManager< __V >::insert | ( | ObjectContainerBase * | b,
|  | ContainedObject * | c,
|  | void * | o,
|  | long | k
| ) |  |

Definition at line 600 of file KeyedObjectManager.cpp.

604 {
605 if ( k == long(m_setup.s->v.size()) ) {
606 return insert(b, c, o, &k);
607 }
608 cannotInsertToContainer();
609 return OBJ_CANNOT_INSERT;
610 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::cannotInsertToContainer
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Definition: KeyedObjectManager.cpp:69
Containers::OBJ_CANNOT_INSERT
Cannot insert object into container.
Definition: KeyedTraits.h:24
Containers::KeyedObjectManager::insert
long insert(ObjectContainerBase *b, ContainedObject *c, void *o, long *k)
Insert new object into container.
Definition: KeyedObjectManager.cpp:124
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 173 of file KeyedObjectManager.cpp.

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

425 {
426 if ( 0 == m_direct ) {
427 if ( k == m_keyCtxt+1 ) {
428 m_setup.s->v.push_back(o);
429 if ( !c->parent() ) c->setParent(b);
430 ++m_keyCtxt;
431 return OBJ_INSERTED;
432 }
433 onDirty();
434 return insertDirect(b, c, o, k);
435 }
437 if ( k > m_keyCtxt ) m_keyCtxt = k;
439 if ( k+1 > long(m_setup.s->m_idx.size()) ) {
440 m_setup.s->m_idx.resize(k+1, -1);
441 }
442 auto idx = m_setup.s->m_idx.begin()+k;
443 if ( *idx == -1 ) {
444 *idx = m_setup.s->v.size();
445 m_setup.s->v.push_back(o);
446 if ( !c->parent() ) c->setParent(b);
447 return OBJ_INSERTED;
448 }
449 cannotInsertToContainer();
450 return OBJ_CANNOT_INSERT;
451 }
Containers::OBJ_INSERTED
Object was inserted into the container.
Definition: KeyedTraits.h:23
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:49
Containers::cannotInsertToContainer
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Definition: KeyedObjectManager.cpp:69
Containers::OBJ_CANNOT_INSERT
Cannot insert object into container.
Definition: KeyedTraits.h:24
Containers::KeyedObjectManager::m_keyCtxt
long m_keyCtxt
Definition: KeyedObjectManager.h:52
Containers::KeyedObjectManager::onDirty
void onDirty() const
Callback when the container becomes dirty.
Definition: KeyedObjectManager.cpp:115
ContainedObject::setParent
void setParent(ObjectContainerBase *value)
Update parent member.
Definition: ContainedObject.h:51
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::insertDirect
long insertDirect(ObjectContainerBase *b, ContainedObject *c, void *o, long k)
Insert element into direct access map.
Definition: KeyedObjectManager.cpp:173
template<>

long Containers::KeyedObjectManager< __V >::insertDirect | ( | ObjectContainerBase * | b,
|  | ContainedObject * | c,
|  | void * | o,
|  | long | k
| ) |  |

Definition at line 614 of file KeyedObjectManager.cpp.

618 {
619 if ( k == long(m_setup.s->v.size()) ) {
620 m_setup.s->v.push_back(o);
621 if ( !c->parent() ) c->setParent(b);
622 return OBJ_INSERTED;
623 }
624 cannotInsertToContainer();
625 return OBJ_CANNOT_INSERT;
626 }
Containers::OBJ_INSERTED
Object was inserted into the container.
Definition: KeyedTraits.h:23
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
ContainedObject::parent
const ObjectContainerBase * parent() const
Access to parent object.
Definition: ContainedObject.h:49
Containers::cannotInsertToContainer
GAUDI_API void cannotInsertToContainer()
Function to be called to indicate that an object cannot be inserted to the container.
Definition: KeyedObjectManager.cpp:69
Containers::OBJ_CANNOT_INSERT
Cannot insert object into container.
Definition: KeyedTraits.h:24
ContainedObject::setParent
void setParent(ObjectContainerBase *value)
Update parent member.
Definition: ContainedObject.h:51
template<class SETUP >

long Containers::KeyedObjectManager< SETUP >::isDirect | ( |  | ) | const
| inline

Check if the container is dirty.

Definition at line 72 of file KeyedObjectManager.h.

72 { return m_direct; }
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
template<class T >

void * Containers::KeyedObjectManager< T >::object | ( | long | key | ) | const

Retrieve object identified by a key from the container.

Definition at line 234 of file KeyedObjectManager.cpp.

235 {
236 if ( 0 == m_direct ) onDirty();
237 auto i = m_setup.s->m.find(key);
238 if ( i != m_setup.s->m.end() ) return (*i).second;
239 return nullptr;
240 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::KeyedObjectManager::onDirty
void onDirty() const
Callback when the container becomes dirty.
Definition: KeyedObjectManager.cpp:115
ana.i
list i
Definition: ana.py:128
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
template<>

void * Containers::KeyedObjectManager< __A >::object | ( | long | value | ) | const

Definition at line 340 of file KeyedObjectManager.cpp.

341 {
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);
346 if ( ent >= 0 ) {
347 return *(m_setup.s->v.begin() + ent);
348 }
349 }
350 return nullptr;
351 #else
352 return *(m_setup.s->v.begin() + (*(m_setup.s->m_idx.begin()+value)));
353 #endif
354 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
dump_component_properties.value
list value
Definition: dump_component_properties.py:12
template<>

void * Containers::KeyedObjectManager< __V >::object | ( | long |  | ) | const

Definition at line 573 of file KeyedObjectManager.cpp.

574 {
575 invalidContainerOperation();
576 return nullptr;
577 }
Containers::invalidContainerOperation
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
Definition: KeyedObjectManager.cpp:81
template<class T >

void Containers::KeyedObjectManager< T >::onDirty | ( |  | ) | const
| private

Callback when the container becomes dirty.

Definition at line 115 of file KeyedObjectManager.cpp.

115 {
116 m_direct = 1;
117 for(int i = 0, stop = m_setup.s->v.size(); i < stop; i++ ) {
118 m_setup.s->insert(*(m_setup.s->v.begin()+i), i);
119 }
120 m_setup.s->v.clear();
121 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
ana.i
list i
Definition: ana.py:128
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
template<>

void Containers::KeyedObjectManager< __A >::onDirty | ( |  | ) | const
| private

Definition at line 357 of file KeyedObjectManager.cpp.

357 {
358 m_direct = 1;
359 m_setup.s->m_idx.reserve(m_setup.s->v.size()+1);
360 for(int i = 0, stop = m_setup.s->v.size(); i < stop; ++i) {
361 if ( !m_setup.s->v[i] ) {
362 containerIsInconsistent();
363 }
364 m_setup.s->m_idx.push_back(i);
365 }
366 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::containerIsInconsistent
GAUDI_API void containerIsInconsistent()
Function to be called to indicate that the container is found to be inconsistent. ...
Definition: KeyedObjectManager.cpp:75
ana.i
list i
Definition: ana.py:128
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
template<>

void Containers::KeyedObjectManager< __V >::onDirty | ( |  | ) | const
| private

Definition at line 580 of file KeyedObjectManager.cpp.

580 {
581 invalidContainerOperation();
582 }
Containers::invalidContainerOperation
GAUDI_API void invalidContainerOperation()
Function to be called to indicate that an operation should be performed on the container or it's cont...
Definition: KeyedObjectManager.cpp:81
template<class T >

void Containers::KeyedObjectManager< T >::reserve | ( | long | size | ) |

Reserve buffer space.

Definition at line 243 of file KeyedObjectManager.cpp.

244 {
245 switch( m_direct ) {
246 case 1:
247 break;
248 case 0:
249 m_setup.s->v.reserve(len);
250 break;
251 default:
252 break;
253 }
254 m_seq->reserve(len);
255 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::KeyedObjectManager::m_direct
long m_direct
Dirty flag.
Definition: KeyedObjectManager.h:51
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49
std::vector::reserve
T reserve(T...args)
template<class T >

void Containers::KeyedObjectManager< T >::setup | ( | void * | seq,
|  | void ** | rndm
| ) |  |

Setup of the Map and the parent object.

Definition at line 108 of file KeyedObjectManager.cpp.

109 {
110 m_seq = (seq_type*)seq;
111 *rndm = &m_setup.s->v;
112 }
Containers::KeyedObjectManager::m_setup
union Containers::KeyedObjectManager::@6 m_setup
Containers::KeyedObjectManager::seq_type
std::vector< void * > seq_type
Definition: KeyedObjectManager.h:47
AtomicAlgSequencerTest.seq
tuple seq
Definition: AtomicAlgSequencerTest.py:78
Containers::KeyedObjectManager::m_seq
seq_type * m_seq
Container holding array like container.
Definition: KeyedObjectManager.h:49

## Member Data Documentation

template<class SETUP >

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

Buffer space to hold keyed container.

Definition at line 55 of file KeyedObjectManager.h.

template<class SETUP >

long Containers::KeyedObjectManager< SETUP >::m_direct
| mutable private

Dirty flag.

Definition at line 51 of file KeyedObjectManager.h.

template<class SETUP >

long Containers::KeyedObjectManager< SETUP >::m_keyCtxt
| mutable private

Definition at line 52 of file KeyedObjectManager.h.

template<class SETUP >

seq_type* Containers::KeyedObjectManager< SETUP >::m_seq
| private

Container holding array like container.

Definition at line 49 of file KeyedObjectManager.h.

union { ... } Containers::KeyedObjectManager< SETUP >::m_setup

template<class SETUP >

SETUP* Containers::KeyedObjectManager< SETUP >::s

Definition at line 56 of file KeyedObjectManager.h.

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

- GaudiKernel/GaudiKernel/KeyedObjectManager.h
- GaudiKernel/src/Lib/KeyedObjectManager.cpp