This vector holds pointer to the elements of another container. More...
#include <OpenMS/DATASTRUCTURES/ConstRefVector.h>
Classes | |
| class | ConstRefVectorConstIterator |
| ConstIterator for the ConstRefVector. More... | |
| class | ConstRefVectorIterator |
| Mutable iterator for the ConstRefVector. More... | |
Public Types | |
| typedef ContainerT | ContainerType |
| Type definitions. | |
| typedef ContainerType::value_type | ValueType |
| typedef ConstRefVectorIterator < const ValueType > | Iterator |
| typedef ConstRefVectorConstIterator < const ValueType > | ConstIterator |
| typedef std::reverse_iterator < Iterator > | ReverseIterator |
| typedef std::reverse_iterator < ConstIterator > | ConstReverseIterator |
| typedef ValueType | value_type |
| STL-compliance type definitions. | |
| typedef ContainerType::size_type | size_type |
| typedef ContainerType::difference_type | difference_type |
| typedef ContainerType::reference | reference |
| typedef ContainerType::const_reference | const_reference |
| typedef ContainerType::pointer | pointer |
| typedef Iterator | iterator |
| typedef ConstIterator | const_iterator |
| typedef ReverseIterator | reverse_iterator |
| typedef ConstReverseIterator | const_reverse_iterator |
Public Member Functions | |
| void | push_back (const ValueType &x) |
| See std::vector documentation. | |
| void | pop_back () |
| See std::vector documentation. | |
| size_type | size () const |
| See std::vector documentation. | |
| size_type | capacity () const |
| See std::vector documentation. | |
| void | reserve (size_type n) |
| See std::vector documentation. | |
| size_type | max_size () const |
| See std::vector documentation. | |
| Iterator | begin () |
| See std::vector documentation. | |
| Iterator | end () |
| See std::vector documentation. | |
| ConstIterator | begin () const |
| See std::vector documentation. | |
| ConstIterator | end () const |
| See std::vector documentation. | |
| ReverseIterator | rbegin () |
| See std::vector documentation. | |
| ReverseIterator | rend () |
| See std::vector documentation. | |
| ConstReverseIterator | rbegin () const |
| See std::vector documentation. | |
| ConstReverseIterator | rend () const |
| See std::vector documentation. | |
| void | resize (size_type new_size) |
| See std::vector documentation. | |
| void | resize (size_type new_size, const ValueType &t) |
| See std::vector documentation. | |
| const_reference | front () const |
| See std::vector documentation. | |
| const_reference | back () const |
| See std::vector documentation. | |
| void | clear () |
| See std::vector documentation. | |
| bool | empty () const |
| See std::vector documentation. | |
| const_reference | operator[] (size_type n) const |
| See std::vector documentation. | |
| bool | operator== (const ConstRefVector &array) const |
| See std::vector documentation. | |
| bool | operator!= (const ConstRefVector &array) const |
| See std::vector documentation. | |
| bool | operator< (const ConstRefVector &array) const |
| Comparison of container sizes. | |
| bool | operator> (const ConstRefVector &array) const |
| Comparison of container sizes. | |
| bool | operator<= (const ConstRefVector &array) const |
| Comparison of container sizes. | |
| bool | operator>= (const ConstRefVector &array) const |
| Comparison of container sizes. | |
| void | swap (ConstRefVector &array) |
| See std::vector documentation. | |
| Iterator | insert (Iterator pos, const ValueType &element) |
| See std::vector documentation. | |
| void | insert (Iterator pos, size_type n, const ValueType &element) |
| See std::vector documentation. | |
| template<class InputIterator > | |
| void | insert (Iterator pos, InputIterator f, InputIterator l) |
| See std::vector documentation. | |
| Iterator | erase (Iterator pos) |
| See std::vector documentation. | |
| Iterator | erase (Iterator first, Iterator last) |
| See std::vector documentation. | |
| ConstRefVector & | operator= (const ConstRefVector &rhs) |
| See std::vector documentation. | |
| template<class InputIterator > | |
| void | assign (InputIterator f, InputIterator l) |
| See std::vector documentation. | |
| void | assign (size_type n, const ValueType &x) |
| See std::vector documentation. | |
Constructors and Destructor | |
| ConstRefVector () | |
| See std::vector documentation. | |
| ConstRefVector (size_type n) | |
| See std::vector documentation. | |
| ConstRefVector (size_type n, const ValueType &element) | |
| See std::vector documentation. | |
| ConstRefVector (const ConstRefVector &p) | |
| See std::vector documentation. | |
| template<class InputIterator > | |
| ConstRefVector (InputIterator f, InputIterator l) | |
| See std::vector documentation. | |
| ConstRefVector (ContainerType &p) | |
| See std::vector documentation. | |
| ~ConstRefVector () | |
| See std::vector documentation. | |
| void | sortByIntensity (bool reverse=false) |
| Sorting. | |
| void | sortByPosition () |
| Lexicographically sorts the elements by their position. | |
Generic sorting function templates. | |
Any element comparator can be given as template argument. You can also give the comparator as an argument to the function template (this is useful if the comparator is not default constructed, but keep in mind that STL copies comparators a lot). Thus your can e.g. write | |
| template<typename ComparatorType > | |
| void | sortByComparator (ComparatorType const &comparator=ComparatorType()) |
Protected Attributes | |
| std::vector< const ValueType * > | vector_ |
| the internal vector of ValueType pointers | |
| size_type | capacity_ |
| the current capacity | |
| const ContainerType * | base_container_ptr_ |
| Pointer to the base container. | |
Friends | |
| void | swap (ConstRefVector &a1, ConstRefVector &a2) |
| See std::vector documentation. | |
This vector holds pointer to the elements of another container.
If you for example want to sort the elements of a constant container, you would have to copy the whole container.
To avoid copy actions this class only holds pointer to the constant elements of a container.
You can insert new elements, but it is not possible to change existing ones.
The following code demonstrates the use of this class:
FeatureMap<> map; map.resize(10); //...fill map with data //Create pointer vector to the map ConstRefVector<FeatureMap<> > ref_vector(map); //Sort the pointer vector without changing the original data ref_vector.sortByIntensity();
| typedef ConstIterator const_iterator |
| typedef ContainerType::const_reference const_reference |
| typedef ConstRefVectorConstIterator<const ValueType> ConstIterator |
| typedef std::reverse_iterator<ConstIterator> ConstReverseIterator |
| typedef ContainerT ContainerType |
Type definitions.
Wrapped container type
| typedef ContainerType::difference_type difference_type |
| typedef ConstRefVectorIterator<const ValueType> Iterator |
| typedef ContainerType::pointer pointer |
| typedef ContainerType::reference reference |
| typedef ReverseIterator reverse_iterator |
| typedef std::reverse_iterator<Iterator> ReverseIterator |
| typedef ContainerType::size_type size_type |
| typedef ValueType value_type |
STL-compliance type definitions.
| typedef ContainerType::value_type ValueType |
| ConstRefVector | ( | ) | [inline] |
See std::vector documentation.
| ConstRefVector | ( | size_type | n | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| ConstRefVector | ( | size_type | n, | |
| const ValueType & | element | |||
| ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| ConstRefVector | ( | const ConstRefVector< ContainerT > & | p | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::begin(), ConstRefVector< ContainerT >::end(), and ConstRefVector< ContainerT >::vector_.
| ConstRefVector | ( | InputIterator | f, | |
| InputIterator | l | |||
| ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| ConstRefVector | ( | ContainerType & | p | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| ~ConstRefVector | ( | ) | [inline] |
See std::vector documentation.
| void assign | ( | InputIterator | f, | |
| InputIterator | l | |||
| ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::clear(), ConstRefVector< ContainerT >::end(), and ConstRefVector< ContainerT >::insert().
See std::vector documentation.
References ConstRefVector< ContainerT >::clear(), ConstRefVector< ContainerT >::end(), and ConstRefVector< ContainerT >::insert().
| const_reference back | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::end().
| ConstIterator begin | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| Iterator begin | ( | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
Referenced by ConstRefVector< ContainerT >::ConstRefVector(), ConstRefVector< ContainerT >::front(), ConstRefVector< ContainerT >::operator=(), and ConstRefVector< ContainerT >::rend().
| size_type capacity | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::capacity_, and ConstRefVector< ContainerT >::vector_.
Referenced by ConstRefVector< ContainerT >::reserve().
| void clear | ( | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
Referenced by ConstRefVector< ContainerT >::assign(), and ConstRefVector< ContainerT >::operator=().
| bool empty | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| Iterator end | ( | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
Referenced by ConstRefVector< ContainerT >::assign(), ConstRefVector< ContainerT >::back(), ConstRefVector< ContainerT >::ConstRefVector(), ConstRefVector< ContainerT >::operator=(), and ConstRefVector< ContainerT >::rbegin().
| ConstIterator end | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
See std::vector documentation.
References ConstRefVector< ContainerT >::ConstRefVectorConstIterator< ValueT >::position_, and ConstRefVector< ContainerT >::vector_.
See std::vector documentation.
References ConstRefVector< ContainerT >::ConstRefVectorConstIterator< ValueT >::position_, and ConstRefVector< ContainerT >::vector_.
| const_reference front | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::begin().
See std::vector documentation.
References ConstRefVector< ContainerT >::ConstRefVectorConstIterator< ValueT >::position_, and ConstRefVector< ContainerT >::vector_.
Referenced by ConstRefVector< ContainerT >::assign().
See std::vector documentation.
References ConstRefVector< ContainerT >::ConstRefVectorConstIterator< ValueT >::position_, and ConstRefVector< ContainerT >::vector_.
| void insert | ( | Iterator | pos, | |
| InputIterator | f, | |||
| InputIterator | l | |||
| ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::ConstRefVectorConstIterator< ValueT >::position_, and ConstRefVector< ContainerT >::vector_.
| size_type max_size | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| bool operator!= | ( | const ConstRefVector< ContainerT > & | array | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::operator==().
| bool operator< | ( | const ConstRefVector< ContainerT > & | array | ) | const [inline] |
Comparison of container sizes.
References ConstRefVector< ContainerT >::size().
Referenced by ConstRefVector< ContainerT >::operator<=().
| bool operator<= | ( | const ConstRefVector< ContainerT > & | array | ) | const [inline] |
Comparison of container sizes.
References ConstRefVector< ContainerT >::operator<(), and ConstRefVector< ContainerT >::operator==().
| ConstRefVector& operator= | ( | const ConstRefVector< ContainerT > & | rhs | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::base_container_ptr_, ConstRefVector< ContainerT >::begin(), ConstRefVector< ContainerT >::clear(), ConstRefVector< ContainerT >::end(), ConstRefVector< ContainerT >::reserve(), ConstRefVector< ContainerT >::size(), and ConstRefVector< ContainerT >::vector_.
| bool operator== | ( | const ConstRefVector< ContainerT > & | array | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::base_container_ptr_, ConstRefVector< ContainerT >::size(), and ConstRefVector< ContainerT >::vector_.
Referenced by ConstRefVector< ContainerT >::operator!=(), ConstRefVector< ContainerT >::operator<=(), and ConstRefVector< ContainerT >::operator>=().
| bool operator> | ( | const ConstRefVector< ContainerT > & | array | ) | const [inline] |
Comparison of container sizes.
References ConstRefVector< ContainerT >::size().
Referenced by ConstRefVector< ContainerT >::operator>=().
| bool operator>= | ( | const ConstRefVector< ContainerT > & | array | ) | const [inline] |
Comparison of container sizes.
References ConstRefVector< ContainerT >::operator==(), and ConstRefVector< ContainerT >::operator>().
| const_reference operator[] | ( | size_type | n | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| void pop_back | ( | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| void push_back | ( | const ValueType & | x | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| ReverseIterator rbegin | ( | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::end().
| ConstReverseIterator rbegin | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::end().
| ConstReverseIterator rend | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::begin().
| ReverseIterator rend | ( | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::begin().
| void reserve | ( | size_type | n | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::capacity(), ConstRefVector< ContainerT >::capacity_, and ConstRefVector< ContainerT >::vector_.
Referenced by ConstRefVector< ContainerT >::operator=().
See std::vector documentation.
References ConstRefVector< ContainerT >::capacity_, and ConstRefVector< ContainerT >::vector_.
| void resize | ( | size_type | new_size | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::capacity_, and ConstRefVector< ContainerT >::vector_.
| size_type size | ( | ) | const [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
Referenced by ConstRefVector< ContainerT >::operator<(), ConstRefVector< ContainerT >::operator=(), ConstRefVector< ContainerT >::operator==(), and ConstRefVector< ContainerT >::operator>().
| void sortByComparator | ( | ComparatorType const & | comparator = ComparatorType() |
) | [inline] |
References OpenMS::pointerComparator(), and ConstRefVector< ContainerT >::vector_.
| void sortByIntensity | ( | bool | reverse = false |
) | [inline] |
Sorting.
These simplified sorting methods are supported for convenience.
References OpenMS::pointerComparator(), OpenMS::reverseComparator(), and ConstRefVector< ContainerT >::vector_.
| void sortByPosition | ( | ) | [inline] |
Lexicographically sorts the elements by their position.
References OpenMS::pointerComparator(), and ConstRefVector< ContainerT >::vector_.
| void swap | ( | ConstRefVector< ContainerT > & | array | ) | [inline] |
See std::vector documentation.
References ConstRefVector< ContainerT >::vector_.
| void swap | ( | ConstRefVector< ContainerT > & | a1, | |
| ConstRefVector< ContainerT > & | a2 | |||
| ) | [friend] |
See std::vector documentation.
const ContainerType* base_container_ptr_ [protected] |
Pointer to the base container.
Referenced by ConstRefVector< ContainerT >::operator=(), and ConstRefVector< ContainerT >::operator==().
the current capacity
Referenced by ConstRefVector< ContainerT >::capacity(), ConstRefVector< ContainerT >::reserve(), and ConstRefVector< ContainerT >::resize().
the internal vector of ValueType pointers
Referenced by ConstRefVector< ContainerT >::begin(), ConstRefVector< ContainerT >::capacity(), ConstRefVector< ContainerT >::clear(), ConstRefVector< ContainerT >::ConstRefVector(), ConstRefVector< ContainerT >::empty(), ConstRefVector< ContainerT >::end(), ConstRefVector< ContainerT >::erase(), ConstRefVector< ContainerT >::insert(), ConstRefVector< ContainerT >::max_size(), ConstRefVector< ContainerT >::operator=(), ConstRefVector< ContainerT >::operator==(), ConstRefVector< ContainerT >::operator[](), ConstRefVector< ContainerT >::pop_back(), ConstRefVector< ContainerT >::push_back(), ConstRefVector< ContainerT >::reserve(), ConstRefVector< ContainerT >::resize(), ConstRefVector< ContainerT >::size(), ConstRefVector< ContainerT >::sortByComparator(), ConstRefVector< ContainerT >::sortByIntensity(), ConstRefVector< ContainerT >::sortByPosition(), and ConstRefVector< ContainerT >::swap().
| OpenMS / TOPP release 1.10.0 | Documentation generated on Thu Mar 7 2013 09:42:51 using doxygen 1.7.1 |