The Gaudi Framework
v30r3 (a5ef0a68)
|
A bit modified version of 'Loki::AssocVector' associative vector from Loki library by Andrei Alexandrescu. More...
#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 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::const_reference | reference |
the types to conform STL More... | |
typedef ALLOCATOR::const_reference | 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... | |
VectorMap (const VectorMap &right) | |
copy constructor 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... | |
~VectorMap () | |
destructor (non-virtual!) More... | |
VectorMap & | operator= (const VectorMap &right) |
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 103 of file VectorMap.h.
|
protected |
the regular iterator (no export)
Definition at line 137 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 132 of file VectorMap.h.
typedef ALLOCATOR GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::allocator_type |
allocator (could be useful for optimizations)
Definition at line 119 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 182 of file VectorMap.h.
typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_iterator |
visible const_iterator (exported)
Definition at line 144 of file VectorMap.h.
typedef ALLOCATOR::const_reference GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::const_reference |
the types to conform STL
Definition at line 123 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 148 of file VectorMap.h.
typedef ALLOCATOR::difference_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::difference_type |
the types to conform STL
Definition at line 127 of file VectorMap.h.
typedef _vector::const_iterator GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterator |
visible const_iterator (exported)
Definition at line 142 of file VectorMap.h.
typedef std::pair<iterator, iterator> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::iterators |
visible iterator pait
Definition at line 150 of file VectorMap.h.
typedef KEYCOMPARE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_compare |
comparison of keys
Definition at line 112 of file VectorMap.h.
typedef KEY GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::key_type |
the actual type of key
Definition at line 108 of file VectorMap.h.
typedef VALUE GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::mapped_type |
the actual type of value
Definition at line 110 of file VectorMap.h.
typedef ALLOCATOR::const_reference GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::reference |
the types to conform STL
Definition at line 121 of file VectorMap.h.
typedef std::pair<iterator, bool> GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::result_type |
visible iterator pait
Definition at line 152 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 146 of file VectorMap.h.
typedef ALLOCATOR::size_type GaudiUtils::VectorMap< KEY, VALUE, KEYCOMPARE, ALLOCATOR >::size_type |
the types to conform STL
Definition at line 125 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 114 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 688 of file VectorMap.h.
|
inline |
copy constructor
right | object to be copied |
Definition at line 693 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 702 of file VectorMap.h.
|
inline |
tconstructor from initializer list
list | |
cmp | comparison criteria for the key |
alloc | allocator to be used |
Definition at line 712 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 671 of file VectorMap.h.
|
inline |
"begin" iterator for sequential access (const-only version!)
Definition at line 189 of file VectorMap.h.
|
inline |
clear the container
Definition at line 488 of file VectorMap.h.
|
inline |
get the comparison criteria itself
Definition at line 739 of file VectorMap.h.
|
inlineprotected |
compare the objects using the comaprison criteria
obj | the first object |
obj | the second object |
Definition at line 810 of file VectorMap.h.
|
inline |
get the comparison criteria for keys
Definition at line 745 of file VectorMap.h.
|
inline |
count number of elements with the certain key
key | key to be searched |
Definition at line 473 of file VectorMap.h.
|
inline |
empty container ?
Definition at line 482 of file VectorMap.h.
|
inline |
"end" iterator for sequential access (const-only version!)
Definition at line 191 of file VectorMap.h.
|
inline |
Definition at line 477 of file VectorMap.h.
|
inline |
erase the element using the iterator
pos | position of the element to be erased |
Definition at line 202 of file VectorMap.h.
|
inline |
erase the element using the key
key | key for the element to be erased |
Definition at line 220 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 235 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 262 of file VectorMap.h.
|
inline |
find the element by key
key | key to be searched |
Definition at line 449 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 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 373 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 391 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 402 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 417 of file VectorMap.h.
|
inlineprotected |
the conversion from 'const' to 'non-const' iterator
Definition at line 822 of file VectorMap.h.
|
inlineprotected |
the conversion from 'non-const' to 'const' iterator
Definition at line 830 of file VectorMap.h.
|
inline |
useful method for python decoration:
index | (INPUT) the index |
std::out_of_range | for invalid index |
Definition at line 776 of file VectorMap.h.
|
inline |
Definition at line 475 of file VectorMap.h.
|
inlineprotected |
'lower-bound' - non-const version
Definition at line 816 of file VectorMap.h.
|
inline |
maximal allowed size
Definition at line 486 of file VectorMap.h.
|
inline |
merge two maps
Definition at line 752 of file VectorMap.h.
|
inline |
merge two maps
Definition at line 761 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 612 of file VectorMap.h.
|
inline |
comparison criteria for containers
Definition at line 500 of file VectorMap.h.
|
inline |
Definition at line 725 of file VectorMap.h.
|
inline |
comparison criteria for containers
Definition at line 498 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 652 of file VectorMap.h.
|
inline |
"rbegin" iterator for sequential access (const-only version!)
Definition at line 193 of file VectorMap.h.
|
inline |
"rend" iterator for sequential access (const-only version!)
Definition at line 195 of file VectorMap.h.
|
inline |
reserve the space in the container for at least 'num' elements
Definition at line 490 of file VectorMap.h.
|
inline |
number of elements
Definition at line 484 of file VectorMap.h.
|
inline |
swap function, which 'swaps' the content of two containers
Definition at line 493 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 538 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 579 of file VectorMap.h.
|
inline |
Definition at line 476 of file VectorMap.h.
|
inline |
useful method for python decoration:
index | (INPUT) the index |
std::out_of_range | for invalid index |
Definition at line 790 of file VectorMap.h.
|
friend |
Definition at line 505 of file VectorMap.h.
|
friend |
printout to ostream - not implemented
Definition at line 747 of file VectorMap.h.
|
friend |
Definition at line 507 of file VectorMap.h.
|
friend |
Definition at line 504 of file VectorMap.h.
|
friend |
Definition at line 506 of file VectorMap.h.
|
private |
the underlying sorted vector of (key,mapped) pairs
Definition at line 840 of file VectorMap.h.