![]() |
The Gaudi Framework
master (ff829712)
|
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) | |
typedef ALLOCATOR::value_type const & | reference |
the types to conform STL | |
typedef ALLOCATOR::value_type const & | const_reference |
the types to conform STL | |
typedef ALLOCATOR::size_type | size_type |
the types to conform STL | |
typedef ALLOCATOR::difference_type | difference_type |
the types to conform STL | |
typedef std::vector< value_type, allocator_type > | _vector |
the actual storage container (no export) | |
typedef _vector::const_iterator | iterator |
visible const_iterator (exported) | |
typedef _vector::const_iterator | 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 | |
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, const key_type &key, const 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 | |
size_type | count (const key_type &key) const |
count number of elements with the certain key | |
iterator | lower_bound (const key_type &key) const |
iterator | upper_bound (const key_type &key) const |
iterators | equal_range (const key_type &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 | |
bool | 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. | |
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 | |
const mapped_type & | operator[] (const key_type &key) const |
access to element by key (const version) there is no container increment for missing keys | |
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 | |
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: | |
![]() | |
virtual | ~MapBase () |
Protected Types | |
typedef _vector::iterator | _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 | |
_iterator | iter (iterator p) |
the conversion from 'const' to 'non-const' iterator | |
iterator | iter (_iterator p) |
the conversion from 'non-const' to 'const' iterator | |
![]() | |
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 | |
bool | operator> (const VectorMap &left, const VectorMap &right) |
bool | operator!= (const VectorMap &left, const VectorMap &right) |
bool | operator>= (const VectorMap &left, const VectorMap &right) |
bool | operator<= (const VectorMap &left, const VectorMap &right) |
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 100 of file VectorMap.h.
|
protected |
the regular iterator (no export)
Definition at line 129 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 125 of file VectorMap.h.
typedef ALLOCATOR GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::allocator_type |
allocator (could be useful for optimizations)
Definition at line 113 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 168 of file VectorMap.h.
typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_iterator |
visible const_iterator (exported)
Definition at line 135 of file VectorMap.h.
typedef ALLOCATOR::value_type const& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_reference |
the types to conform STL
Definition at line 117 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 139 of file VectorMap.h.
typedef ALLOCATOR::difference_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::difference_type |
the types to conform STL
Definition at line 121 of file VectorMap.h.
typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterator |
visible const_iterator (exported)
Definition at line 133 of file VectorMap.h.
typedef std::pair<iterator, iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterators |
visible iterator pait
Definition at line 141 of file VectorMap.h.
typedef KEYCOMPARE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_compare |
comparison of keys
Definition at line 107 of file VectorMap.h.
typedef KEY GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_type |
the actual type of key
Definition at line 103 of file VectorMap.h.
typedef VALUE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::mapped_type |
the actual type of value
Definition at line 105 of file VectorMap.h.
typedef ALLOCATOR::value_type const& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reference |
the types to conform STL
Definition at line 115 of file VectorMap.h.
typedef std::pair<iterator, bool> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::result_type |
visible iterator pait
Definition at line 143 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 137 of file VectorMap.h.
typedef ALLOCATOR::size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size_type |
the types to conform STL
Definition at line 119 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 109 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 617 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 625 of file VectorMap.h.
|
inline |
|
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 605 of file VectorMap.h.
|
inline |
"begin" iterator for sequential access (const-only version!)
Definition at line 173 of file VectorMap.h.
|
inline |
|
inline |
get the comparison criteria itself
Definition at line 641 of file VectorMap.h.
|
inlineprotected |
compare the objects using the comaprison criteria
obj | the first object |
obj | the second object |
Definition at line 695 of file VectorMap.h.
|
inline |
|
inline |
count number of elements with the certain key
key | key to be searched |
Definition at line 424 of file VectorMap.h.
|
inline |
|
inline |
"end" iterator for sequential access (const-only version!)
Definition at line 175 of file VectorMap.h.
|
inline |
Definition at line 427 of file VectorMap.h.
|
inline |
erase the element using the key
key | key for the element to be erased |
Definition at line 201 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 212 of file VectorMap.h.
|
inline |
erase the element using the iterator
pos | position of the element to be erased |
Definition at line 184 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 237 of file VectorMap.h.
|
inline |
find the element by key
key | key to be searched |
Definition at line 404 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 283 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 324 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 357 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 341 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 377 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 366 of file VectorMap.h.
|
inlineprotected |
the conversion from 'non-const' to 'const' iterator
Definition at line 709 of file VectorMap.h.
|
inlineprotected |
the conversion from 'const' to 'non-const' iterator
Definition at line 703 of file VectorMap.h.
|
inline |
useful method for python decoration:
index | (INPUT) the index |
std::out_of_range | for invalid index |
Definition at line 669 of file VectorMap.h.
|
inlineprotected |
'lower-bound' - non-const version
Definition at line 699 of file VectorMap.h.
|
inline |
Definition at line 425 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 551 of file VectorMap.h.
|
inline |
comparison criteria for containers
Definition at line 445 of file VectorMap.h.
|
inline |
comparison criteria for containers
Definition at line 443 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 587 of file VectorMap.h.
|
inline |
"rbegin" iterator for sequential access (const-only version!)
Definition at line 177 of file VectorMap.h.
|
inline |
"rend" iterator for sequential access (const-only version!)
Definition at line 179 of file VectorMap.h.
|
inline |
reserve the space in the container for at least 'num' elements
Definition at line 438 of file VectorMap.h.
|
inline |
swap function, which 'swaps' the content of two containers
Definition at line 440 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 480 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 519 of file VectorMap.h.
|
inline |
Definition at line 426 of file VectorMap.h.
|
inline |
useful method for python decoration:
index | (INPUT) the index |
std::out_of_range | for invalid index |
Definition at line 680 of file VectorMap.h.
|
friend |
Definition at line 448 of file VectorMap.h.
|
friend |
|
friend |
Definition at line 450 of file VectorMap.h.
|
friend |
Definition at line 447 of file VectorMap.h.
|
friend |
Definition at line 449 of file VectorMap.h.
|
private |
the underlying sorted vector of (key,mapped) pairs
Definition at line 717 of file VectorMap.h.