ProteoWizard
|
a wrapper for std::map that will behave properly with polymorphism More...
#include <virtual_map.hpp>
Public Types | |
typedef std::map< keyT, valueT, _Pr, _Alloc > | BaseType |
typedef BaseType::allocator_type | allocator_type |
typedef BaseType::key_type | key_type |
typedef BaseType::value_type | value_type |
typedef BaseType::key_compare | key_compare |
typedef BaseType::value_compare | value_compare |
typedef BaseType::size_type | size_type |
typedef BaseType::mapped_type | mapped_type |
typedef BaseType::difference_type | difference_type |
typedef BaseType::pointer | pointer |
typedef BaseType::const_pointer | const_pointer |
typedef BaseType::reference | reference |
typedef BaseType::const_reference | const_reference |
typedef BaseType::iterator | iterator |
typedef BaseType::const_iterator | const_iterator |
typedef BaseType::reverse_iterator | reverse_iterator |
typedef BaseType::const_reverse_iterator | const_reverse_iterator |
Public Member Functions | |
virtual_map (const key_compare &predicate=key_compare(), const allocator_type &allocator=allocator_type()) | |
Constructs an empty map that uses the predicate _Pred to order keys, if it is supplied. The map uses the allocator _Alloc for all storage management, if it is supplied. | |
template<class _Iter > | |
virtual_map (_Iter _First, _Iter _Last) | |
Constructs a map containing values in the range [_First, _Last). Creation of the new map is only guaranteed to succeed if the iterators start and finish return values of type pair<class Key, class Value> and all values of Key in the range [_First, _Last) are unique. The map uses the predicate _Pred to order keys, and the allocator _Alloc for all storage management. | |
template<class _Iter > | |
virtual_map (_Iter _First, _Iter _Last, const key_compare &_Pred) | |
Constructs a map containing values in the range [_First, _Last). Creation of the new map is only guaranteed to succeed if the iterators start and finish return values of type pair<class Key, class Value> and all values of Key in the range [_First, _Last) are unique. The map uses the predicate _Pred to order keys, and the allocator _Alloc for all storage management. | |
template<class _Iter > | |
virtual_map (_Iter _First, _Iter _Last, const key_compare &_Pred, const allocator_type &_Al) | |
Constructs a map containing values in the range [_First, _Last). Creation of the new map is only guaranteed to succeed if the iterators start and finish return values of type pair<class Key, class Value> and all values of Key in the range [_First, _Last) are unique. The map uses the predicate _Pred to order keys, and the allocator _Alloc for all storage management. | |
virtual | ~virtual_map () |
virtual allocator_type | get_allocator () const |
Returns a copy of the allocator used by self for storage management. | |
virtual iterator | begin () |
Returns an iterator pointing to the first element stored in the map. First is defined by the map's comparison operator, Compare. | |
virtual const_iterator | begin () const |
Returns a const_iterator pointing to the first element stored in the map. | |
virtual iterator | end () |
Returns an iterator pointing to the last element stored in the map; in other words, to the off-the-end value. | |
virtual const_iterator | end () const |
Returns a const_iterator pointing to the last element stored in the map. | |
virtual reverse_iterator | rbegin () |
Returns a reverse_iterator pointing to the first element stored in the map. First is defined by the map's comparison operator, Compare. | |
virtual const_reverse_iterator | rbegin () const |
Returns a const_reverse_iterator pointing to the first element stored in the map. | |
virtual reverse_iterator | rend () |
Returns a reverse_iterator pointing to the last element stored in the map; in other words, to the off-the-end value). | |
virtual const_reverse_iterator | rend () const |
Returns a const_reverse_iterator pointing to the last element stored in the map. | |
virtual virtual_map< keyT, valueT, key_compare, allocator_type > & | operator= (const virtual_map< keyT, valueT, key_compare, allocator_type > &x) |
Replaces the contents of *this with a copy of the map x. | |
virtual mapped_type & | operator[] (const key_type &x) |
If an element with the key x exists in the map, then a reference to its associated value is returned. Otherwise the pair x,T() is inserted into the map and a reference to the default object T() is returned. | |
virtual void | clear () |
Erases all elements from the self. | |
virtual size_type | count (const key_type &x) const |
Returns a 1 if a value with the key x exists in the map. Otherwise returns a 0. | |
virtual bool | empty () const |
Returns true if the map is empty, false otherwise. | |
virtual std::pair< iterator, iterator > | equal_range (const key_type &x) |
Returns the pair (lower_bound(x), upper_bound(x)). | |
virtual std::pair < const_iterator, const_iterator > | equal_range (const key_type &x) const |
Returns the pair (lower_bound(x), upper_bound(x)). | |
virtual void | erase (iterator position) |
Deletes the map element pointed to by the iterator position. | |
virtual void | erase (iterator start, iterator finish) |
If the iterators start and finish point to the same map and last is reachable from first, all elements in the range [start, finish) are deleted from the map. | |
virtual size_type | erase (const key_type &x) |
Deletes the element with the key value x from the map, if one exists. Returns 1 if x existed in the map, 0 otherwise. | |
virtual iterator | find (const key_type &x) |
Searches the map for a pair with the key value x and returns an iterator to that pair if it is found. If such a pair is not found the value end() is returned. | |
virtual const_iterator | find (const key_type &x) const |
Same as find above but returns a const_iterator. | |
virtual std::pair< iterator, bool > | insert (const value_type &x) |
If a value_type with the same key as x is not present in the map, then x is inserted into the map. Otherwise, the pair is not inserted. A position may be supplied as a hint regarding where to do the insertion. If the insertion is done right after position, then it takes amortized constant time. Otherwise it takes O(log N) time. | |
virtual iterator | insert (iterator position, const value_type &x) |
If a value_type with the same key as x is not present in the map, then x is inserted into the map. Otherwise, the pair is not inserted. A position may be supplied as a hint regarding where to do the insertion. If the insertion is done right after position, then it takes amortized constant time. Otherwise it takes O(log N) time. | |
template<class InputIterator > | |
void | insert (InputIterator start, InputIterator finish) |
Copies of each element in the range [start, finish) that possess a unique key (one not already in the map) are inserted into the map. The iterators start and finish must return values of type pair<T1,T2>. This operation takes approximately O(N*log(size()+N)) time. | |
virtual key_compare | key_comp () const |
Returns a function object capable of comparing key values using the comparison operation, Compare, of the current map. | |
virtual iterator | lower_bound (const key_type &x) |
Returns a reference to the first entry with a key greater than or equal to x. | |
virtual const_iterator | lower_bound (const key_type &x) const |
Same as lower_bound above but returns a const_iterator. | |
virtual size_type | max_size () const |
Returns the maximum possible size of the map. This size is only constrained by the number of unique keys that can be represented by the type Key. | |
virtual size_type | size () const |
Returns the number of elements in the map. | |
virtual void | swap (virtual_map< keyT, valueT, key_compare, allocator_type > &x) |
Swaps the contents of the map x with the current map, *this. | |
virtual iterator | upper_bound (const key_type &x) |
Returns an iterator for the first entry with a key greater than x. | |
virtual const_iterator | upper_bound (const key_type &x) const |
Same as upper_bound above, but returns a const_iterator. | |
virtual value_compare | value_comp () const |
Returns a function object capable of comparing pair<const Key, T> values using the comparison operation, Compare, of the current map. This function is identical to key_comp for sets. |
Private Attributes | |
BaseType | _base |
a wrapper for std::map that will behave properly with polymorphism
Definition at line 38 of file virtual_map.hpp.
typedef std::map<keyT, valueT, _Pr, _Alloc> pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::BaseType |
Definition at line 42 of file virtual_map.hpp.
typedef BaseType::allocator_type pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::allocator_type |
Definition at line 43 of file virtual_map.hpp.
typedef BaseType::key_type pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::key_type |
Definition at line 44 of file virtual_map.hpp.
typedef BaseType::value_type pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::value_type |
Definition at line 45 of file virtual_map.hpp.
typedef BaseType::key_compare pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::key_compare |
Definition at line 46 of file virtual_map.hpp.
typedef BaseType::value_compare pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::value_compare |
Definition at line 47 of file virtual_map.hpp.
typedef BaseType::size_type pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::size_type |
Definition at line 48 of file virtual_map.hpp.
typedef BaseType::mapped_type pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::mapped_type |
Definition at line 49 of file virtual_map.hpp.
typedef BaseType::difference_type pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::difference_type |
Definition at line 50 of file virtual_map.hpp.
typedef BaseType::pointer pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::pointer |
Definition at line 51 of file virtual_map.hpp.
typedef BaseType::const_pointer pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::const_pointer |
Definition at line 52 of file virtual_map.hpp.
typedef BaseType::reference pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::reference |
Definition at line 53 of file virtual_map.hpp.
typedef BaseType::const_reference pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::const_reference |
Definition at line 54 of file virtual_map.hpp.
typedef BaseType::iterator pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::iterator |
Definition at line 55 of file virtual_map.hpp.
typedef BaseType::const_iterator pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::const_iterator |
Definition at line 56 of file virtual_map.hpp.
typedef BaseType::reverse_iterator pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::reverse_iterator |
Definition at line 57 of file virtual_map.hpp.
typedef BaseType::const_reverse_iterator pwiz::util::virtual_map< keyT, valueT, _Pr, _Alloc >::const_reverse_iterator |
Definition at line 58 of file virtual_map.hpp.
|
inlineexplicit |
Constructs an empty map that uses the predicate _Pred to order keys, if it is supplied. The map uses the allocator _Alloc for all storage management, if it is supplied.
Definition at line 66 of file virtual_map.hpp.
|
inline |
Constructs a map containing values in the range [_First, _Last). Creation of the new map is only guaranteed to succeed if the iterators start and finish return values of type pair<class Key, class Value> and all values of Key in the range [_First, _Last) are unique. The map uses the predicate _Pred to order keys, and the allocator _Alloc for all storage management.
Definition at line 73 of file virtual_map.hpp.
|
inline |
Constructs a map containing values in the range [_First, _Last). Creation of the new map is only guaranteed to succeed if the iterators start and finish return values of type pair<class Key, class Value> and all values of Key in the range [_First, _Last) are unique. The map uses the predicate _Pred to order keys, and the allocator _Alloc for all storage management.
Definition at line 82 of file virtual_map.hpp.
|
inline |
Constructs a map containing values in the range [_First, _Last). Creation of the new map is only guaranteed to succeed if the iterators start and finish return values of type pair<class Key, class Value> and all values of Key in the range [_First, _Last) are unique. The map uses the predicate _Pred to order keys, and the allocator _Alloc for all storage management.
Definition at line 91 of file virtual_map.hpp.
|
inlinevirtual |
Definition at line 98 of file virtual_map.hpp.
|
inlinevirtual |
Returns a copy of the allocator used by self for storage management.
Definition at line 101 of file virtual_map.hpp.
|
inlinevirtual |
Returns an iterator pointing to the first element stored in the map. First is defined by the map's comparison operator, Compare.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 105 of file virtual_map.hpp.
|
inlinevirtual |
Returns a const_iterator pointing to the first element stored in the map.
Definition at line 109 of file virtual_map.hpp.
|
inlinevirtual |
Returns an iterator pointing to the last element stored in the map; in other words, to the off-the-end value.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 113 of file virtual_map.hpp.
|
inlinevirtual |
Returns a const_iterator pointing to the last element stored in the map.
Definition at line 117 of file virtual_map.hpp.
|
inlinevirtual |
Returns a reverse_iterator pointing to the first element stored in the map. First is defined by the map's comparison operator, Compare.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 121 of file virtual_map.hpp.
|
inlinevirtual |
Returns a const_reverse_iterator pointing to the first element stored in the map.
Definition at line 125 of file virtual_map.hpp.
|
inlinevirtual |
Returns a reverse_iterator pointing to the last element stored in the map; in other words, to the off-the-end value).
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 129 of file virtual_map.hpp.
|
inlinevirtual |
Returns a const_reverse_iterator pointing to the last element stored in the map.
Definition at line 133 of file virtual_map.hpp.
|
inlinevirtual |
Replaces the contents of *this with a copy of the map x.
Definition at line 137 of file virtual_map.hpp.
|
inlinevirtual |
If an element with the key x exists in the map, then a reference to its associated value is returned. Otherwise the pair x,T() is inserted into the map and a reference to the default object T() is returned.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 141 of file virtual_map.hpp.
|
inlinevirtual |
Erases all elements from the self.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 145 of file virtual_map.hpp.
|
inlinevirtual |
Returns a 1 if a value with the key x exists in the map. Otherwise returns a 0.
Definition at line 149 of file virtual_map.hpp.
Referenced by testConversion().
|
inlinevirtual |
Returns true if the map is empty, false otherwise.
Definition at line 153 of file virtual_map.hpp.
Referenced by pwiz::tradata::TextWriter::operator()(), and operatorTest().
|
inlinevirtual |
Returns the pair (lower_bound(x), upper_bound(x)).
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 157 of file virtual_map.hpp.
|
inlinevirtual |
Returns the pair (lower_bound(x), upper_bound(x)).
Definition at line 161 of file virtual_map.hpp.
|
inlinevirtual |
Deletes the map element pointed to by the iterator position.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 165 of file virtual_map.hpp.
|
inlinevirtual |
If the iterators start and finish point to the same map and last is reachable from first, all elements in the range [start, finish) are deleted from the map.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 169 of file virtual_map.hpp.
|
inlinevirtual |
Deletes the element with the key value x from the map, if one exists. Returns 1 if x existed in the map, 0 otherwise.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 173 of file virtual_map.hpp.
|
inlinevirtual |
Searches the map for a pair with the key value x and returns an iterator to that pair if it is found. If such a pair is not found the value end() is returned.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 177 of file virtual_map.hpp.
|
inlinevirtual |
Same as find above but returns a const_iterator.
Definition at line 181 of file virtual_map.hpp.
|
inlinevirtual |
If a value_type with the same key as x is not present in the map, then x is inserted into the map. Otherwise, the pair is not inserted. A position may be supplied as a hint regarding where to do the insertion. If the insertion is done right after position, then it takes amortized constant time. Otherwise it takes O(log N) time.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 185 of file virtual_map.hpp.
Referenced by pwiz::util::virtual_map< int, ModificationList >::virtual_map().
|
inlinevirtual |
If a value_type with the same key as x is not present in the map, then x is inserted into the map. Otherwise, the pair is not inserted. A position may be supplied as a hint regarding where to do the insertion. If the insertion is done right after position, then it takes amortized constant time. Otherwise it takes O(log N) time.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 189 of file virtual_map.hpp.
|
inline |
Copies of each element in the range [start, finish) that possess a unique key (one not already in the map) are inserted into the map. The iterators start and finish must return values of type pair<T1,T2>. This operation takes approximately O(N*log(size()+N)) time.
Definition at line 194 of file virtual_map.hpp.
|
inlinevirtual |
Returns a function object capable of comparing key values using the comparison operation, Compare, of the current map.
Definition at line 198 of file virtual_map.hpp.
|
inlinevirtual |
Returns a reference to the first entry with a key greater than or equal to x.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 202 of file virtual_map.hpp.
|
inlinevirtual |
Same as lower_bound above but returns a const_iterator.
Definition at line 206 of file virtual_map.hpp.
|
inlinevirtual |
Returns the maximum possible size of the map. This size is only constrained by the number of unique keys that can be represented by the type Key.
Definition at line 210 of file virtual_map.hpp.
|
inlinevirtual |
Returns the number of elements in the map.
Definition at line 214 of file virtual_map.hpp.
Referenced by testConversion().
|
inlinevirtual |
Swaps the contents of the map x with the current map, *this.
Definition at line 218 of file virtual_map.hpp.
|
inlinevirtual |
Returns an iterator for the first entry with a key greater than x.
Reimplemented in pwiz::proteome::ModificationMap.
Definition at line 222 of file virtual_map.hpp.
|
inlinevirtual |
Same as upper_bound above, but returns a const_iterator.
Definition at line 226 of file virtual_map.hpp.
|
inlinevirtual |
Returns a function object capable of comparing pair<const Key, T> values using the comparison operation, Compare, of the current map. This function is identical to key_comp for sets.
Definition at line 230 of file virtual_map.hpp.
|
private |
Definition at line 61 of file virtual_map.hpp.
Referenced by pwiz::util::virtual_map< int, ModificationList >::begin(), pwiz::util::virtual_map< int, ModificationList >::clear(), pwiz::util::virtual_map< int, ModificationList >::count(), pwiz::util::virtual_map< int, ModificationList >::empty(), pwiz::util::virtual_map< int, ModificationList >::end(), pwiz::util::virtual_map< int, ModificationList >::equal_range(), pwiz::util::virtual_map< int, ModificationList >::erase(), pwiz::util::virtual_map< int, ModificationList >::find(), pwiz::util::virtual_map< int, ModificationList >::get_allocator(), pwiz::util::virtual_map< int, ModificationList >::insert(), pwiz::util::virtual_map< int, ModificationList >::key_comp(), pwiz::util::virtual_map< int, ModificationList >::lower_bound(), pwiz::util::virtual_map< int, ModificationList >::max_size(), pwiz::util::virtual_map< int, ModificationList >::operator=(), pwiz::util::virtual_map< int, ModificationList >::operator[](), pwiz::util::virtual_map< int, ModificationList >::rbegin(), pwiz::util::virtual_map< int, ModificationList >::rend(), pwiz::util::virtual_map< int, ModificationList >::size(), pwiz::util::virtual_map< int, ModificationList >::swap(), pwiz::util::virtual_map< int, ModificationList >::upper_bound(), and pwiz::util::virtual_map< int, ModificationList >::value_comp().