The Gaudi Framework
master (37c0b60a)
|
#include </builds/gaudi/Gaudi/GaudiKernel/include/GaudiKernel/VectorMap.h>
Classes | |
struct | _compare_type |
Public Types | |
typedef KEY | key_type |
the actual type of key More... | |
typedef VALUE | mapped_type |
the actual type of value More... | |
typedef KEYCOMPARE | key_compare |
comparison of keys More... | |
typedef std::pair< key_type, mapped_type > | value_type |
the actual storage item More... | |
typedef ALLOCATOR | allocator_type |
allocator (could be useful for optimizations) More... | |
typedef ALLOCATOR::value_type const & | reference |
the types to conform STL More... | |
typedef ALLOCATOR::value_type const & | const_reference |
the types to conform STL More... | |
typedef ALLOCATOR::size_type | size_type |
the types to conform STL More... | |
typedef ALLOCATOR::difference_type | difference_type |
the types to conform STL More... | |
typedef std::vector< value_type, allocator_type > | _vector |
the actual storage container (no export) More... | |
typedef _vector::const_iterator | iterator |
visible const_iterator (exported) More... | |
typedef _vector::const_iterator | const_iterator |
visible const_iterator (exported) More... | |
typedef std::reverse_iterator< iterator > | reverse_iterator |
visible reverse const_iterator (exported) More... | |
typedef std::reverse_iterator< const_iterator > | const_reverse_iterator |
visible reverse const_iterator (exported) More... | |
typedef std::pair< iterator, iterator > | iterators |
visible iterator pait More... | |
typedef std::pair< iterator, bool > | result_type |
visible iterator pait More... | |
typedef _compare_type | compare_type |
the actual comparison criteria for valye_type objects More... | |
Public Member Functions | |
iterator | begin () const |
"begin" iterator for sequential access (const-only version!) More... | |
iterator | end () const |
"end" iterator for sequential access (const-only version!) More... | |
reverse_iterator | rbegin () const |
"rbegin" iterator for sequential access (const-only version!) More... | |
reverse_iterator | rend () const |
"rend" iterator for sequential access (const-only version!) More... | |
void | erase (iterator pos) |
erase the element using the iterator More... | |
size_type | erase (const key_type &key) |
erase the element using the key More... | |
size_type | erase (iterator first, iterator last) |
erase the sequence of elements using the iterators More... | |
template<class TYPE > | |
size_type | erase (TYPE first, TYPE last) |
erase the sequence of elements using the sequence of keys More... | |
result_type | insert (const key_type &key, const mapped_type &mapped) |
insert the (key,value) pair into the container More... | |
result_type | insert (const value_type &value) |
insert the (key,value) pair into the container More... | |
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 More... | |
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 More... | |
template<class PAIRS > | |
void | insert (PAIRS first, PAIRS last) |
insert the sequence of elements into the container More... | |
template<class KEYS , class VALUES > | |
void | insert (KEYS kf, KEYS kl, VALUES vf) |
insert into the container the elements from 2 "parallel" sequences More... | |
iterator | find (const key_type &key) const |
find the element by key More... | |
size_type | count (const key_type &key) const |
count number of elements with the certain key More... | |
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 ? More... | |
size_type | size () const |
number of elements More... | |
size_type | max_size () const |
maximal allowed size More... | |
void | clear () |
clear the container More... | |
void | reserve (size_type num) |
reserve the space in the container for at least 'num' elements More... | |
void | swap (VectorMap &other) |
swap function, which 'swaps' the content of two containers More... | |
bool | operator== (const VectorMap &other) const |
comparison criteria for containers More... | |
bool | operator< (const VectorMap &other) const |
comparison criteria for containers More... | |
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. More... | |
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. More... | |
const mapped_type & | operator() (const key_type &key) const |
access to element by key (const version) there is no container increment for missing keys More... | |
const mapped_type & | operator[] (const key_type &key) const |
access to element by key (const version) there is no container increment for missing keys More... | |
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 More... | |
VectorMap (const allocator_type &alloc=allocator_type()) | |
default constructor from the the allocator More... | |
template<class INPUT > | |
VectorMap (INPUT first, INPUT last, const allocator_type &alloc=allocator_type()) | |
templated constructor from "convertible" sequence More... | |
VectorMap (std::initializer_list< value_type > first, const allocator_type &alloc=allocator_type()) | |
tconstructor from initializer list More... | |
const compare_type & | compare () const |
get the comparison criteria itself More... | |
const key_compare & | compare_key () const |
get the comparison criteria for keys More... | |
VectorMap & | merge (const VectorMap &right) |
merge two maps More... | |
template<class K1 , class K2 , class K3 , class K4 > | |
VectorMap & | merge (const VectorMap< K1, K2, K3, K4 > &right) |
merge two maps More... | |
const key_type & | key_at (const size_t index) const |
useful method for python decoration: More... | |
const mapped_type & | value_at (const size_t index) const |
useful method for python decoration: More... | |
Public Member Functions inherited from Gaudi::Utils::MapBase | |
virtual | ~MapBase () |
virtual destructor More... | |
Protected Types | |
typedef _vector::iterator | _iterator |
the regular iterator (no export) More... | |
Protected Member Functions | |
template<class TYPE1 , class TYPE2 > | |
bool | compare (const TYPE1 &obj1, const TYPE2 &obj2) const |
compare the objects using the comaprison criteria More... | |
_iterator | lower_bound (const key_type &key) |
'lower-bound' - non-const version More... | |
_iterator | iter (iterator p) |
the conversion from 'const' to 'non-const' iterator More... | |
iterator | iter (_iterator p) |
the conversion from 'non-const' to 'const' iterator More... | |
Protected Member Functions inherited from Gaudi::Utils::MapBase | |
void | throw_out_of_range_exception () const |
throw std::out_of_range exception More... | |
Private Attributes | |
_vector | m_vct |
the underlying sorted vector of (key,mapped) pairs More... | |
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 More... | |
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 145 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 140 of file VectorMap.h.
typedef ALLOCATOR GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::allocator_type |
allocator (could be useful for optimizations)
Definition at line 127 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 189 of file VectorMap.h.
typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_iterator |
visible const_iterator (exported)
Definition at line 152 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 131 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 156 of file VectorMap.h.
typedef ALLOCATOR::difference_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::difference_type |
the types to conform STL
Definition at line 135 of file VectorMap.h.
typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterator |
visible const_iterator (exported)
Definition at line 150 of file VectorMap.h.
typedef std::pair<iterator, iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterators |
visible iterator pait
Definition at line 158 of file VectorMap.h.
typedef KEYCOMPARE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_compare |
comparison of keys
Definition at line 120 of file VectorMap.h.
typedef KEY GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_type |
the actual type of key
Definition at line 116 of file VectorMap.h.
typedef VALUE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::mapped_type |
the actual type of value
Definition at line 118 of file VectorMap.h.
typedef ALLOCATOR::value_type const& GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reference |
the types to conform STL
Definition at line 129 of file VectorMap.h.
typedef std::pair<iterator, bool> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::result_type |
visible iterator pait
Definition at line 160 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 154 of file VectorMap.h.
typedef ALLOCATOR::size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size_type |
the types to conform STL
Definition at line 133 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 122 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 669 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 678 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 655 of file VectorMap.h.
|
inline |
"begin" iterator for sequential access (const-only version!)
Definition at line 196 of file VectorMap.h.
|
inline |
|
inline |
get the comparison criteria itself
Definition at line 697 of file VectorMap.h.
|
inlineprotected |
compare the objects using the comaprison criteria
obj | the first object |
obj | the second object |
Definition at line 755 of file VectorMap.h.
|
inline |
|
inline |
count number of elements with the certain key
key | key to be searched |
Definition at line 461 of file VectorMap.h.
|
inline |
|
inline |
"end" iterator for sequential access (const-only version!)
Definition at line 198 of file VectorMap.h.
|
inline |
Definition at line 465 of file VectorMap.h.
|
inline |
erase the element using the key
key | key for the element to be erased |
Definition at line 227 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 239 of file VectorMap.h.
|
inline |
erase the element using the iterator
pos | position of the element to be erased |
Definition at line 209 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 265 of file VectorMap.h.
|
inline |
find the element by key
key | key to be searched |
Definition at line 440 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 312 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 354 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 389 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 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 411 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 399 of file VectorMap.h.
|
inlineprotected |
|
inlineprotected |
|
inline |
useful method for python decoration:
index | (INPUT) the index |
std::out_of_range | for invalid index |
Definition at line 727 of file VectorMap.h.
|
inlineprotected |
'lower-bound' - non-const version
Definition at line 760 of file VectorMap.h.
|
inline |
Definition at line 463 of file VectorMap.h.
|
inline |
|
inline |
merge two maps
Definition at line 709 of file VectorMap.h.
|
inline |
merge two maps
Definition at line 715 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 599 of file VectorMap.h.
|
inline |
|
inline |
|
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 636 of file VectorMap.h.
|
inline |
"rbegin" iterator for sequential access (const-only version!)
Definition at line 200 of file VectorMap.h.
|
inline |
"rend" iterator for sequential access (const-only version!)
Definition at line 202 of file VectorMap.h.
|
inline |
reserve the space in the container for at least 'num' elements
Definition at line 478 of file VectorMap.h.
|
inline |
|
inline |
swap function, which 'swaps' the content of two containers
Definition at line 481 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 526 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 566 of file VectorMap.h.
|
inline |
Definition at line 464 of file VectorMap.h.
|
inline |
useful method for python decoration:
index | (INPUT) the index |
std::out_of_range | for invalid index |
Definition at line 738 of file VectorMap.h.
|
friend |
Definition at line 493 of file VectorMap.h.
|
friend |
printout to ostream - not implemented
Definition at line 704 of file VectorMap.h.
|
friend |
Definition at line 495 of file VectorMap.h.
|
friend |
Definition at line 492 of file VectorMap.h.
|
friend |
Definition at line 494 of file VectorMap.h.
|
private |
the underlying sorted vector of (key,mapped) pairs
Definition at line 781 of file VectorMap.h.