![]() |
The Gaudi Framework
master (50869dff)
|
A bit modified version of 'Loki::AssocVector' associative vector from Loki library by Andrei Alexandrescu. More...
#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/VectorMap.h>


Classes | |
| struct | _compare_type |
| The actual structure used to compare the elements Only "key" is important for comparison. More... | |
Public Types | |
| typedef KEY | key_type |
| the actual type of key | |
| typedef VALUE | mapped_type |
| the actual type of value | |
| typedef KEYCOMPARE | key_compare |
| comparison of keys | |
| typedef std::pair< key_type, mapped_type > | value_type |
| the actual storage item | |
| typedef ALLOCATOR | allocator_type |
| allocator (could be useful for optimizations) | |
| using | reference = typename ALLOCATOR::value_type const& |
| the types to conform STL | |
| using | const_reference = typename ALLOCATOR::value_type const& |
| the types to conform STL | |
| using | size_type = typename ALLOCATOR::size_type |
| the types to conform STL | |
| using | difference_type = typename ALLOCATOR::difference_type |
| the types to conform STL | |
| typedef std::vector< value_type, allocator_type > | _vector |
| the actual storage container (no export) | |
| using | iterator = typename _vector::const_iterator |
| visible const_iterator (exported) | |
| using | const_iterator = typename _vector::const_iterator |
| visible const_iterator (exported) | |
| typedef std::reverse_iterator< iterator > | reverse_iterator |
| visible reverse const_iterator (exported) | |
| typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
| visible reverse const_iterator (exported) | |
| typedef std::pair< iterator, iterator > | iterators |
| visible iterator pait | |
| typedef std::pair< iterator, bool > | result_type |
| visible iterator pait | |
| typedef _compare_type | compare_type |
| the actual comparison criteria for valye_type objects | |
Public Member Functions | |
| iterator | begin () const |
| "begin" iterator for sequential access (const-only version!) | |
| iterator | end () const |
| "end" iterator for sequential access (const-only version!) | |
| reverse_iterator | rbegin () const |
| "rbegin" iterator for sequential access (const-only version!) | |
| reverse_iterator | rend () const |
| "rend" iterator for sequential access (const-only version!) | |
| void | erase (iterator pos) |
| erase the element using the iterator | |
| size_type | erase (const key_type &key) |
| erase the element using the key | |
| template<detail::key_comparable< key_type, key_compare > K> | |
| size_type | erase (const K &key) |
| size_type | erase (iterator first, iterator last) |
| erase the sequence of elements using the iterators | |
| template<class TYPE> | |
| size_type | erase (TYPE first, TYPE last) |
| erase the sequence of elements using the sequence of keys | |
| result_type | insert (const key_type &key, const mapped_type &mapped) |
| insert the (key,value) pair into the container | |
| result_type | insert (const value_type &value) |
| insert the (key,value) pair into the container | |
| result_type | insert (iterator pos, const value_type &value) |
| insert the element with some guess about its new position With the right guess the method could be more efficient | |
| result_type | insert (iterator pos, key_type key, mapped_type mapped) |
| insert the (key,value) pair into the container With the right guess the method could be more efficient | |
| template<class PAIRS> | |
| void | insert (PAIRS first, PAIRS last) |
| insert the sequence of elements into the container | |
| template<class KEYS, class VALUES> | |
| void | insert (KEYS kf, KEYS kl, VALUES vf) |
| insert into the container the elements from 2 "parallel" sequences | |
| iterator | find (const key_type &key) const |
| find the element by key | |
| template<detail::key_comparable< key_type, key_compare > K> | |
| iterator | find (const K &key) const |
| size_type | count (const key_type &key) const |
| count number of elements with the certain key | |
| template<detail::key_comparable< key_type, key_compare > K> | |
| size_type | count (const K &key) const |
| iterator | lower_bound (const key_type &key) const |
| template<detail::key_comparable< key_type, key_compare > K> | |
| iterator | lower_bound (const K &key) const |
| iterator | upper_bound (const key_type &key) const |
| template<detail::key_comparable< key_type, key_compare > K> | |
| iterator | upper_bound (const K &key) const |
| iterators | equal_range (const key_type &key) const |
| template<detail::key_comparable< key_type, key_compare > K> | |
| iterators | equal_range (const K &key) const |
| bool | empty () const |
| empty container ? | |
| size_type | size () const |
| number of elements | |
| size_type | max_size () const |
| maximal allowed size | |
| void | clear () |
| clear the container | |
| void | reserve (size_type num) |
| reserve the space in the container for at least 'num' elements | |
| void | swap (VectorMap &other) |
| swap function, which 'swaps' the content of two containers | |
| bool | operator== (const VectorMap &other) const |
| comparison criteria for containers | |
| auto | operator<=> (const VectorMap &other) const |
| comparison criteria for containers | |
| bool | update (const key_type &key, const mapped_type &mapped) |
| forced insertion of the key/mapped pair The method acts like "insert" but it DOES overwrite the existing mapped value. | |
| template<detail::key_comparable< key_type, key_compare > K> | |
| bool | update (const K &key, const mapped_type &mapped) |
| bool | update (const value_type &val) |
| forced insertion of the key/mapped pair The method acts like "insert" but it DOES overwrite the mapped value. | |
| const mapped_type & | operator() (const key_type &key) const |
| access to element by key (const version) there is no container increment for missing keys | |
| template<detail::key_comparable< key_type, key_compare > K> | |
| const mapped_type & | operator() (const K &key) const |
| const mapped_type & | operator[] (const key_type &key) const |
| access to element by key (const version) there is no container increment for missing keys | |
| template<detail::key_comparable< key_type, key_compare > K> | |
| const mapped_type & | operator[] (const K &key) const |
| const mapped_type & | at (const key_type &key) const |
| checked access to elements by key throw std::out_of_range exception for non-existing keys | |
| template<detail::key_comparable< key_type, key_compare > K> | |
| const mapped_type & | at (const K &key) const |
| VectorMap (const allocator_type &alloc=allocator_type()) | |
| default constructor from the the allocator | |
| template<class INPUT> | |
| VectorMap (INPUT first, INPUT last, const allocator_type &alloc=allocator_type()) | |
| templated constructor from "convertible" sequence | |
| VectorMap (std::initializer_list< value_type > first, const allocator_type &alloc=allocator_type()) | |
| tconstructor from initializer list | |
| const compare_type & | compare () const |
| get the comparison criteria itself | |
| const key_compare & | compare_key () const |
| get the comparison criteria for keys | |
| VectorMap & | merge (const VectorMap &right) |
| merge two maps | |
| template<class K1, class K2, class K3, class K4> | |
| VectorMap & | merge (const VectorMap< K1, K2, K3, K4 > &right) |
| merge two maps | |
| const key_type & | key_at (const size_t index) const |
| useful method for python decoration: | |
| const mapped_type & | value_at (const size_t index) const |
| useful method for python decoration: | |
| Public Member Functions inherited from Gaudi::Utils::MapBase | |
| virtual | ~MapBase () |
Protected Types | |
| using | _iterator = typename _vector::iterator |
| the regular iterator (no export) | |
Protected Member Functions | |
| template<class TYPE1, class TYPE2> | |
| bool | compare (const TYPE1 &obj1, const TYPE2 &obj2) const |
| compare the objects using the comaprison criteria | |
| _iterator | lower_bound (const key_type &key) |
| 'lower-bound' - non-const version | |
| template<detail::key_comparable< key_type, key_compare > K> | |
| _iterator | lower_bound (const K &key) |
| _iterator | iter (iterator p) |
| the conversion from 'const' to 'non-const' iterator | |
| iterator | iter (_iterator p) |
| the conversion from 'non-const' to 'const' iterator | |
| Protected Member Functions inherited from Gaudi::Utils::MapBase | |
| void | throw_out_of_range_exception () const |
| throw std::out_of_range exception | |
Private Attributes | |
| _vector | m_vct |
| the underlying sorted vector of (key,mapped) pairs | |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const VectorMap &) |
| printout to ostream - not implemented | |
A bit modified version of 'Loki::AssocVector' associative vector from Loki library by Andrei Alexandrescu.
The number of "non-const" operations is reduced, e.g. all non-const iterators are not exported, therefore it is almost impossible e.g. externally re-sort the underlying sorted container.
Container insertion: O(N) Container look-up: O(log(N)) (a'la std::map, but a bit faster)
It could be used as a "light" and good alternative for std::map associative container, in the case of relatively rare insertion and frequent look-up.
Due to helper base class Gaudi::Utils::MapBase, this class is "python-friendly", and one can perform all python manipulaitons in intuitive way:
In a similar way getitem and delitem methods can be redefind
To avoid the unnesessary expansion of dictionaries it is highly recommended to exclude from dictionary the following methods:
Definition at line 112 of file VectorMap.h.
|
protected |
the regular iterator (no export)
Definition at line 141 of file VectorMap.h.
| typedef std::vector<value_type, allocator_type> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::_vector |
the actual storage container (no export)
Definition at line 137 of file VectorMap.h.
| typedef ALLOCATOR GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::allocator_type |
allocator (could be useful for optimizations)
Definition at line 125 of file VectorMap.h.
| typedef _compare_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::compare_type |
the actual comparison criteria for valye_type objects
Definition at line 181 of file VectorMap.h.
| using GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_iterator = typename _vector::const_iterator |
visible const_iterator (exported)
Definition at line 147 of file VectorMap.h.
| using GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_reference = typename ALLOCATOR::value_type const& |
the types to conform STL
Definition at line 129 of file VectorMap.h.
| typedef std::reverse_iterator<const_iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_reverse_iterator |
visible reverse const_iterator (exported)
Definition at line 151 of file VectorMap.h.
| using GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::difference_type = typename ALLOCATOR::difference_type |
the types to conform STL
Definition at line 133 of file VectorMap.h.
| using GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterator = typename _vector::const_iterator |
visible const_iterator (exported)
Definition at line 145 of file VectorMap.h.
| typedef std::pair<iterator, iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterators |
visible iterator pait
Definition at line 153 of file VectorMap.h.
| typedef KEYCOMPARE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_compare |
comparison of keys
Definition at line 119 of file VectorMap.h.
| typedef KEY GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_type |
the actual type of key
Definition at line 115 of file VectorMap.h.
| typedef VALUE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::mapped_type |
the actual type of value
Definition at line 117 of file VectorMap.h.
| using GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reference = typename ALLOCATOR::value_type const& |
the types to conform STL
Definition at line 127 of file VectorMap.h.
| typedef std::pair<iterator, bool> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::result_type |
visible iterator pait
Definition at line 155 of file VectorMap.h.
| typedef std::reverse_iterator<iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reverse_iterator |
visible reverse const_iterator (exported)
Definition at line 149 of file VectorMap.h.
| using GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size_type = typename ALLOCATOR::size_type |
the types to conform STL
Definition at line 131 of file VectorMap.h.
| typedef std::pair<key_type, mapped_type> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::value_type |
the actual storage item
Definition at line 121 of file VectorMap.h.
|
inline |
default constructor from the the allocator
| cmp | comparison criteria for the key |
| alloc | allocator to be used |
Definition at line 656 of file VectorMap.h.
|
inline |
templated constructor from "convertible" sequence
| first | 'begin'-iterator for the convertible sequence |
| last | 'end'-iterator for the convertible sequence |
| cmp | comparison criteria for the key |
| alloc | allocator to be used |
Definition at line 664 of file VectorMap.h.
|
inline |
|
inline |
Definition at line 644 of file VectorMap.h.
|
inline |
checked access to elements by key throw std::out_of_range exception for non-existing keys
| std::out_of_range | for non-existing keys |
| key | key value |
Definition at line 642 of file VectorMap.h.
|
inline |
"begin" iterator for sequential access (const-only version!)
Definition at line 186 of file VectorMap.h.
|
inline |
|
inline |
get the comparison criteria itself
Definition at line 680 of file VectorMap.h.
|
inlineprotected |
compare the objects using the comaprison criteria
| obj | the first object |
| obj | the second object |
Definition at line 734 of file VectorMap.h.
|
inline |
|
inline |
Definition at line 444 of file VectorMap.h.
|
inline |
count number of elements with the certain key
| key | key to be searched |
Definition at line 442 of file VectorMap.h.
|
inline |
|
inline |
"end" iterator for sequential access (const-only version!)
Definition at line 188 of file VectorMap.h.
|
inline |
Definition at line 459 of file VectorMap.h.
|
inline |
Definition at line 457 of file VectorMap.h.
|
inline |
|
inline |
erase the element using the key
| key | key for the element to be erased |
Definition at line 214 of file VectorMap.h.
|
inline |
erase the sequence of elements using the iterators
| first | begin iterator of sub-sequence to be erased |
| end | end iterator of the sub_sequence to be erased |
Definition at line 227 of file VectorMap.h.
|
inline |
erase the element using the iterator
| pos | position of the element to be erased |
Definition at line 197 of file VectorMap.h.
|
inline |
erase the sequence of elements using the sequence of keys
| first | begin-iterator for the sequence of keys |
| last | end-iterator for the sequence of keys |
Definition at line 252 of file VectorMap.h.
|
inline |
Definition at line 421 of file VectorMap.h.
|
inline |
find the element by key
| key | key to be searched |
Definition at line 419 of file VectorMap.h.
|
inline |
insert the (key,value) pair into the container
It is STL-compliant behavior for associative containers.
| key | key value to be inserted |
| mapped | value to be associated with the key |
Definition at line 298 of file VectorMap.h.
|
inline |
insert the (key,value) pair into the container
It is STL-compliant behavior for associative containers.
| value | value to be inserted |
Definition at line 339 of file VectorMap.h.
|
inline |
insert the element with some guess about its new position With the right guess the method could be more efficient
| pos | the guess about position where to insert the element |
| value | value to be inserted |
Definition at line 356 of file VectorMap.h.
|
inline |
insert the (key,value) pair into the container With the right guess the method could be more efficient
| pos | the guess about position where to insert the element |
| key | key value to be inserted |
| mapped | value to be associated with the key |
Definition at line 372 of file VectorMap.h.
|
inline |
insert into the container the elements from 2 "parallel" sequences
| kf | the begin iterator of the sequence of keys |
| kl | the end iterator of the sequence of keys |
| vf | the begin iterator of the sequence of values |
Definition at line 392 of file VectorMap.h.
|
inline |
insert the sequence of elements into the container
| first | the begin iterator of the sequence |
| last | the end iterator of the sequence |
Definition at line 381 of file VectorMap.h.
|
inlineprotected |
the conversion from 'non-const' to 'const' iterator
Definition at line 750 of file VectorMap.h.
|
inlineprotected |
the conversion from 'const' to 'non-const' iterator
Definition at line 744 of file VectorMap.h.
|
inline |
useful method for python decoration:
| index | (INPUT) the index |
| std::out_of_range | for invalid index |
Definition at line 708 of file VectorMap.h.
|
inlineprotected |
Definition at line 740 of file VectorMap.h.
|
inline |
Definition at line 449 of file VectorMap.h.
|
inlineprotected |
|
inline |
Definition at line 447 of file VectorMap.h.
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 584 of file VectorMap.h.
|
inline |
access to element by key (const version) there is no container increment for missing keys
The method is added on request from ATLAS (see Savannah report #21395 and #21394) For typical usage of this class in LHCb context as "ExtraInfo" field I would like to recommend to AVOID this method
| key | key value |
Definition at line 582 of file VectorMap.h.
|
inline |
comparison criteria for containers
Definition at line 479 of file VectorMap.h.
|
inline |
comparison criteria for containers
Definition at line 477 of file VectorMap.h.
|
inline |
Definition at line 622 of file VectorMap.h.
|
inline |
access to element by key (const version) there is no container increment for missing keys
The method is added on request from ATLAS (see Savannah report #21395 and #21394) For typical usage of this class in LHCb context as "ExtraInfo" field I would like to recommend to AVOID this method
| key | key value |
Definition at line 620 of file VectorMap.h.
|
inline |
"rbegin" iterator for sequential access (const-only version!)
Definition at line 190 of file VectorMap.h.
|
inline |
"rend" iterator for sequential access (const-only version!)
Definition at line 192 of file VectorMap.h.
|
inline |
reserve the space in the container for at least 'num' elements
Definition at line 472 of file VectorMap.h.
|
inline |
|
inline |
swap function, which 'swaps' the content of two containers
Definition at line 474 of file VectorMap.h.
|
inline |
Definition at line 511 of file VectorMap.h.
|
inline |
forced insertion of the key/mapped pair The method acts like "insert" but it DOES overwrite the existing mapped value.
The method is added on request from ATLAS (see Savannah report #21395 and #21394)
| key | key value |
| mapped | mapped value |
Definition at line 509 of file VectorMap.h.
|
inline |
forced insertion of the key/mapped pair The method acts like "insert" but it DOES overwrite the mapped value.
The method is added on request from ATLAS (see Savannah report #21395 and #21394)
| val | a pair of (key,value) |
Definition at line 550 of file VectorMap.h.
|
inline |
Definition at line 454 of file VectorMap.h.
|
inline |
Definition at line 452 of file VectorMap.h.
|
inline |
useful method for python decoration:
| index | (INPUT) the index |
| std::out_of_range | for invalid index |
Definition at line 719 of file VectorMap.h.
|
friend |
|
private |
the underlying sorted vector of (key,mapped) pairs
Definition at line 758 of file VectorMap.h.