Go to the documentation of this file.
12 #ifndef GAUDIKERNEL_VECTORMAP_H
13 #define GAUDIKERNEL_VECTORMAP_H 1
21 #include <initializer_list>
110 template <
class KEY,
class VALUE,
class KEYCOMPARE = std::less<const KEY>,
111 class ALLOCATOR = std::allocator<std::pair<KEY, VALUE>>>
129 typedef typename ALLOCATOR::value_type
const&
reference;
177 return this->key_compare::operator()( k1, k2 );
229 if (
end() == pos ) {
return 0; }
264 template <
class TYPE>
267 for ( ; first != last; ++first ) { res +=
erase( *first ); }
357 if (
end() == result ||
compare( value.first, result->first ) ) {
373 if ( pos !=
end() &&
compare( *pos, value ) &&
374 ( pos ==
end() - 1 || ( !
compare( value, *( pos + 1 ) ) &&
compare( *( pos + 1 ), value ) ) ) ) {
398 template <
class PAIRS>
400 for ( ; first != last; ++first ) {
insert( *first ); }
410 template <
class KEYS,
class VALUES>
411 void insert( KEYS kf, KEYS kl, VALUES vf ) {
412 for ( ; kf != kl; ++kf, ++vf ) {
insert( *kf, *vf ); }
532 result->second = mapped;
602 if (
end() == res ) {
return s_default; }
677 template <
class INPUT>
688 :
m_vct( first, alloc ) {
710 for (
const auto& i : right ) {
update( i.first, i.second ); }
714 template <
class K1,
class K2,
class K3,
class K4>
716 for (
const auto& i : right ) {
update( i.first, i.second ); }
729 auto it = this->
begin();
740 auto it = this->
begin();
754 template <
class TYPE1,
class TYPE2>
755 bool compare(
const TYPE1& obj1,
const TYPE2& obj2 )
const {
756 return compare()( obj1, obj2 );
773 auto result =
begin();
793 template <
class KEY,
class VALUE,
class KEYCOMPARE,
class ALLOCATOR>
836 #endif // GAUDIKERNEL_MAPS_H
std::vector< value_type, allocator_type > _vector
the actual storage container (no export)
const mapped_type & value_at(const size_t index) const
useful method for python decoration:
ALLOCATOR::size_type size_type
the types to conform STL
size_type erase(iterator first, iterator last)
erase the sequence of elements using the iterators
std::pair< iterator, bool > result_type
visible iterator pait
const key_compare & compare_key() const
get the comparison criteria for keys
ALLOCATOR allocator_type
allocator (could be useful for optimizations)
size_type count(const key_type &key) const
count number of elements with the certain key
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 & merge(const VectorMap &right)
merge two maps
std::reverse_iterator< iterator > reverse_iterator
visible reverse const_iterator (exported)
StatusCode parse(GaudiUtils::HashMap< K, V > &result, std::string_view input)
Basic parser for the types of HashMap used in DODBasicMapper.
ALLOCATOR::difference_type difference_type
the types to conform STL
std::reverse_iterator< const_iterator > const_reverse_iterator
visible reverse const_iterator (exported)
_vector m_vct
the underlying sorted vector of (key,mapped) pairs
iterators equal_range(const key_type &key) const
size_type erase(TYPE first, TYPE last)
erase the sequence of elements using the sequence of keys
bool operator()(const key_type &k1, const key_type &k2) const
compare keys: use key_compare
friend bool operator!=(const VectorMap &left, const VectorMap &right)
reverse_iterator rbegin() const
"rbegin" iterator for sequential access (const-only version!)
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 exist...
size_type max_size() const
maximal allowed size
iterator begin() const
"begin" iterator for sequential access (const-only version!)
_iterator iter(iterator p)
the conversion from 'const' to 'non-const' iterator
_vector::const_iterator const_iterator
visible const_iterator (exported)
void clear()
clear the container
VectorMap & merge(const VectorMap< K1, K2, K3, K4 > &right)
merge two maps
KEY key_type
the actual type of key
bool operator()(const key_type &k, const value_type &v) const
compare key and pair (key,mapped): use compare by keys
friend bool operator<=(const VectorMap &left, const VectorMap &right)
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
bool operator()(const value_type &v1, const value_type &v2) const
compare pairs (key,mapped): use compare by keys
_compare_type compare_type
the actual comparison criteria for valye_type objects
void insert(KEYS kf, KEYS kl, VALUES vf)
insert into the container the elements from 2 "parallel" sequences
VALUE mapped_type
the actual type of value
iterator lower_bound(const key_type &key) const
const key_type & key_at(const size_t index) const
useful method for python decoration:
bool operator<(const VectorMap &other) const
comparison criteria for containers
std::pair< key_type, mapped_type > value_type
the actual storage item
iterator end() const
"end" iterator for sequential access (const-only version!)
iterator upper_bound(const key_type &key) const
std::pair< iterator, iterator > iterators
visible iterator pait
_compare_type()
default constructor
void insert(PAIRS first, PAIRS last)
insert the sequence of elements into the container
friend std::ostream & operator<<(std::ostream &str, const VectorMap &)
printout to ostream - not implemented
size_type size() const
number of elements
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 efficien...
result_type insert(const value_type &value)
insert the (key,value) pair into the container
friend bool operator>=(const VectorMap &left, const VectorMap &right)
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
KEYCOMPARE key_compare
comparison of keys
iterator iter(_iterator p)
the conversion from 'non-const' to 'const' iterator
bool empty() const
empty container ?
const mapped_type & operator()(const key_type &key) const
access to element by key (const version) there is no container increment for missing keys
_compare_type(const key_compare &cmp)
constructor from the key-comparison criteria
void reserve(size_type num)
reserve the space in the container for at least 'num' elements
const compare_type & compare() const
get the comparison criteria itself
friend bool operator>(const VectorMap &left, const VectorMap &right)
_vector::iterator _iterator
the regular iterator (no export)
VectorMap(std::initializer_list< value_type > first, const allocator_type &alloc=allocator_type())
tconstructor from initializer list
void swap(VectorMap &other)
swap function, which 'swaps' the content of two containers
result_type insert(const key_type &key, const mapped_type &mapped)
insert the (key,value) pair into the container
bool operator==(const VectorMap &other) const
comparison criteria for containers
bool operator()(const value_type &v, const key_type &k) const
compare pair (key,mapped) and the key: use compare by keys
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 mo...
void throw_out_of_range_exception() const
throw std::out_of_range exception
ALLOCATOR::value_type const & const_reference
the types to conform STL
ALLOCATOR::value_type const & reference
the types to conform STL
VectorMap(const allocator_type &alloc=allocator_type())
default constructor from the the allocator
_vector::const_iterator iterator
visible const_iterator (exported)
reverse_iterator rend() const
"rend" iterator for sequential access (const-only version!)
size_type erase(const key_type &key)
erase the element using the key
iterator find(const key_type &key) const
find the element by key
bool update(const value_type &val)
forced insertion of the key/mapped pair The method acts like "insert" but it DOES overwrite the mappe...
const mapped_type & operator[](const key_type &key) const
access to element by key (const version) there is no container increment for missing keys
VectorMap(INPUT first, INPUT last, const allocator_type &alloc=allocator_type())
templated constructor from "convertible" sequence
size_t index(const Gaudi::ParticleProperty *property, const Gaudi::Interfaces::IParticlePropertySvc *service)
helper utility for mapping of Gaudi::ParticleProperty object into non-negative integral sequential id...
void erase(iterator pos)
erase the element using the iterator