Template Class Ordered

Inheritance Relationships

Derived Types

Class Documentation

template<typename Data, typename Container, typename Compare, typename SortIterator, typename SortCompare>
class Ordered

Ordered is a type of sequence container adaptor designed to keep elements in order.

Elements are ordered in the container on insertion. Ordered is optimized for insertion at the back of the container (similar to a queue). Ordered can be instantiated with different underlying containers. The underlying container may be any of the standard container class templates or some other specifically designed container class. The container shall be accessible through random access iterators and support the following operations: empty() size() front() back() pop_back() erase()

Subclassed by navtk::utils::OrderedRing< aspn_xtensor::MeasurementImu, aspn_xtensor::TypeTimestamp >, navtk::utils::OrderedRing< navtk::inertial::ImuErrors, aspn_xtensor::TypeTimestamp >, navtk::utils::OrderedRing< aspn_xtensor::MeasurementPositionVelocityAttitude, aspn_xtensor::TypeTimestamp >, navtk::utils::OrderedDeque< Data, Compare, SortIterator, SortCompare >, navtk::utils::OrderedRing< Data, Compare, SortIterator, SortCompare >

Public Types

using value_type = Data

Type of elements stored in the container.

using iterator = typename Container::iterator

Type of container iterator

using const_iterator = typename Container::const_iterator

Type of container const_iterator

using reverse_iterator = std::reverse_iterator<iterator>

Type of container reverse_iterator

using const_reverse_iterator = std::reverse_iterator<const_iterator>

Type of container const_reverse_iterator

using const_iterator_pair = std::pair<const_iterator, const_iterator>

Type of pair of container const_iterator

using const_reverse_iterator_pair = std::pair<const_reverse_iterator, const_reverse_iterator>

Type of pair of container const_reverse_iterator

Public Functions

inline std::size_t size() const
Returns

Number of elements in the container

inline bool empty() const
Returns

true if the container is empty

inline bool full() const
Returns

true if the container is full

inline void pop_front()

Pops an element from the front of the container.

inline void pop_back()

Pops an element from the back of the container.

inline const Data &front() const
Returns

The element at the front of the container (by const reference)

inline const Data &back() const
Returns

The element at the back of the container (by const reference)

inline iterator erase(const_iterator first, const_iterator last)

Erases elements in the range [first, last)

Parameters
  • first – the first element to erase

  • last – one past the last element to erase

Returns

The element after the last element erased

inline iterator begin()
Returns

Iterator to the element at the beginning of the container

inline iterator end()
Returns

Iterator to the element at the end of the container

inline reverse_iterator rbegin()
Returns

Reverse iterator to the element at the reverse beginning of the container

inline reverse_iterator rend()
Returns

Reverse iterator to the element at the reverse end of the container

inline const_iterator begin() const
Returns

Constant iterator to the element at the beginning of the container

inline const_iterator end() const
Returns

Constant iterator to the element at the end of the container

inline const_reverse_iterator rbegin() const
Returns

Constant reverse iterator to the element at the reverse beginning of the container

inline const_reverse_iterator rend() const
Returns

Constant reverse iterator to the element at the reverse end of the container

inline const_iterator cbegin() const
Returns

Constant iterator to the element at the beginning of the container

inline const_iterator cend() const
Returns

Constant iterator to the element at the end of the container

inline const_reverse_iterator crbegin() const
Returns

Constant reverse iterator to the element at the reverse beginning of the container

inline const_reverse_iterator crend() const
Returns

Constant reverse iterator to the element at the reverse end of the container

inline void insert(const Data &data)

Inserts data in the container.

Parameters

data – to insert

inline const_iterator_pair get_in_range(typename SortIterator::value_type t0, typename SortIterator::value_type t1) const

Gets elements in the range [t0, t1].

Parameters
  • t0 – beginning of range

  • t1 – end of range

Returns

Pair of constant iterators representing the first element in the specified range and one past the last element in the range, [first,last).

inline const_iterator_pair get_nearest_neighbors(const typename SortIterator::value_type &t) const

Gets the nearest elements to t.

Parameters

t – element

Returns

Pair of iterators representing the nearest elements to t. If t is before all elements then return will be {end, begin}; if t is after all elements return will be {end - 1, end}. If t is exactly matched, both iterators will be to the last such element that matched t. Finally, if t is between two elements then the return will be the elements before and after t.

Protected Functions

inline Ordered(std::size_t capacity, std::size_t initial_capacity)

Protected constructor can only be called from derived classes.

Parameters
  • capacity – size (number of elements) limit of underlying storage

  • initial_capacity – size (number of elements) to pre-allocate

virtual ~Ordered() = default
Ordered(const Ordered&) = default

Copy constructor.

Defaulted.

Ordered &operator=(const Ordered&) = default

Copy assignment.

Defaulted.

Returns

*this

Ordered(Ordered&&) = default

Move constructor.

Defaulted.

Ordered &operator=(Ordered&&) = default

Move assignment.

Defaulted.

Returns

*this