state-observation 1.8.0
General implementation of observers.
Loading...
Searching...
No Matches
stateObservation::IndexedInputArrayT< InputType, Allocator > Class Template Reference

Array of type-specified indexed input objects. Uses polymorphism to manage the list for any input type. More...

#include <definitions.hpp>

Inheritance diagram for stateObservation::IndexedInputArrayT< InputType, Allocator >:
[legend]
Collaboration diagram for stateObservation::IndexedInputArrayT< InputType, Allocator >:
[legend]

Public Member Functions

 IndexedInputArrayT ()
 Default constructor.
 IndexedInputArrayT (TimeIndex initTime)
 Construct a new IndexedInputArrayT with a predifined size.
void truncateAfter (TimeIndex timeIndex) override
 removes all the elements with larger indexes than timeIndex
void truncateBefore (TimeIndex timeIndex) override
 removes all the elements with smaller indexes than timeIndex
TimeIndex getLastIndex () const override
 Get the time index.
TimeIndex getNextIndex () const override
TimeIndex setLastIndex (int index) override
 Set the time index of the last element.
TimeIndex getFirstIndex () const override
 Get the time index.
TimeIndex setFirstIndex (int index) override
 set the time index of the first element
TimeSize size () const override
void reset () override
void clear () override
 Clears the vector but keeps the last index.
bool checkIndex (TimeIndex k) const override
 checks whether the index is present in the array
void setValue (const InputBase &value, TimeIndex k) override
void pushBack (const InputBase &v) override
 Pushes back the object to the array, the new value will take the next time.
void popFront () override
 removes the first (oldest) element of the array
const InputType & operator[] (TimeIndex time) const override
 gets a constant reference to the given time index
InputType & operator[] (TimeIndex index) override
 gets the value with the given time index, non const version
const InputType & front () const override
 gets the first value
InputType & front () override
 gets the first value
const InputType & back () const override
 gets the last value
InputType & back () override
 gets the last value
Public Member Functions inherited from stateObservation::IndexedInputArrayInterface
 IndexedInputArrayInterface ()
 Default constructor.
 IndexedInputArrayInterface (TimeIndex initTime)
 Construct a new IndexedInputArrayInterface with a predifined size.

Protected Types

typedef std::deque< InputType > Deque

Protected Member Functions

void check_ (TimeIndex time) const override
void check_ () const override
void checkNext_ (TimeIndex time) const override
Protected Member Functions inherited from stateObservation::IndexedObjectArrayBase
 IndexedObjectArrayBase ()
 Default constructor.
 IndexedObjectArrayBase (TimeIndex initTime)
 Construct a new IndexedObjectArrayT with a predifined size.

Protected Attributes

Deque v_
Protected Attributes inherited from stateObservation::IndexedObjectArrayBase
TimeIndex k_

Detailed Description

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
class stateObservation::IndexedInputArrayT< InputType, Allocator >

Array of type-specified indexed input objects. Uses polymorphism to manage the list for any input type.

Uses polymorphism to manage the list for any input type.

Definition at line 824 of file definitions.hpp.

Member Typedef Documentation

◆ Deque

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
typedef std::deque<InputType> stateObservation::IndexedInputArrayT< InputType, Allocator >::Deque
protected

Definition at line 913 of file definitions.hpp.

Constructor & Destructor Documentation

◆ IndexedInputArrayT()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
stateObservation::IndexedInputArrayT< InputType, Allocator >::IndexedInputArrayT ( TimeIndex initTime)

Construct a new IndexedInputArrayT with a predifined size.

Parameters
sizeis the size of the array
initTimeis the index of the initial time. It is zero by default

Member Function Documentation

◆ truncateAfter()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::truncateAfter ( TimeIndex timeIndex)
overridevirtual

removes all the elements with larger indexes than timeIndex

Implements stateObservation::IndexedInputArrayInterface.

◆ truncateBefore()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::truncateBefore ( TimeIndex timeIndex)
overridevirtual

removes all the elements with smaller indexes than timeIndex

Implements stateObservation::IndexedInputArrayInterface.

◆ getLastIndex()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
TimeIndex stateObservation::IndexedInputArrayT< InputType, Allocator >::getLastIndex ( ) const
inlineoverridevirtual

Get the time index.

Implements stateObservation::IndexedInputArrayInterface.

◆ getNextIndex()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
TimeIndex stateObservation::IndexedInputArrayT< InputType, Allocator >::getNextIndex ( ) const
inlineoverridevirtual

Get the time index of the next value that will be pushed back Can be used in for loops

Implements stateObservation::IndexedInputArrayInterface.

◆ setLastIndex()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
TimeIndex stateObservation::IndexedInputArrayT< InputType, Allocator >::setLastIndex ( int index)
inlineoverridevirtual

Set the time index of the last element.

Implements stateObservation::IndexedInputArrayInterface.

◆ getFirstIndex()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
TimeIndex stateObservation::IndexedInputArrayT< InputType, Allocator >::getFirstIndex ( ) const
inlineoverridevirtual

Get the time index.

Implements stateObservation::IndexedInputArrayInterface.

◆ setFirstIndex()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
TimeIndex stateObservation::IndexedInputArrayT< InputType, Allocator >::setFirstIndex ( int index)
inlineoverridevirtual

set the time index of the first element

Implements stateObservation::IndexedInputArrayInterface.

◆ size()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
TimeSize stateObservation::IndexedInputArrayT< InputType, Allocator >::size ( ) const
inlineoverridevirtual

◆ reset()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::reset ( )
inlineoverridevirtual

Resets the array to initial state the value is no longer accessible

Implements stateObservation::IndexedInputArrayInterface.

◆ clear()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::clear ( )
inlineoverridevirtual

Clears the vector but keeps the last index.

Implements stateObservation::IndexedInputArrayInterface.

◆ checkIndex()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
bool stateObservation::IndexedInputArrayT< InputType, Allocator >::checkIndex ( TimeIndex k) const
inlineoverridevirtual

checks whether the index is present in the array

Implements stateObservation::IndexedInputArrayInterface.

◆ setValue()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::setValue ( const InputBase & value,
TimeIndex k )
inlineoverridevirtual

Sets the value v at the time index k It can be used to push a value into the back of the array

Implements stateObservation::IndexedInputArrayInterface.

◆ pushBack()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::pushBack ( const InputBase & v)
inlineoverridevirtual

Pushes back the object to the array, the new value will take the next time.

Implements stateObservation::IndexedInputArrayInterface.

◆ popFront()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::popFront ( )
inlineoverridevirtual

removes the first (oldest) element of the array

Implements stateObservation::IndexedInputArrayInterface.

◆ operator[]() [1/2]

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
const InputType & stateObservation::IndexedInputArrayT< InputType, Allocator >::operator[] ( TimeIndex time) const
inlineoverridevirtual

gets a constant reference to the given time index

Implements stateObservation::IndexedInputArrayInterface.

◆ operator[]() [2/2]

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
InputType & stateObservation::IndexedInputArrayT< InputType, Allocator >::operator[] ( TimeIndex index)
inlineoverridevirtual

gets the value with the given time index, non const version

Implements stateObservation::IndexedInputArrayInterface.

◆ front() [1/2]

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
const InputType & stateObservation::IndexedInputArrayT< InputType, Allocator >::front ( ) const
inlineoverridevirtual

gets the first value

Implements stateObservation::IndexedInputArrayInterface.

◆ front() [2/2]

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
InputType & stateObservation::IndexedInputArrayT< InputType, Allocator >::front ( )
inlineoverridevirtual

gets the first value

Implements stateObservation::IndexedInputArrayInterface.

◆ back() [1/2]

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
const InputType & stateObservation::IndexedInputArrayT< InputType, Allocator >::back ( ) const
inlineoverridevirtual

gets the last value

Implements stateObservation::IndexedInputArrayInterface.

◆ back() [2/2]

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
InputType & stateObservation::IndexedInputArrayT< InputType, Allocator >::back ( )
inlineoverridevirtual

gets the last value

Implements stateObservation::IndexedInputArrayInterface.

◆ check_() [1/2]

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::check_ ( TimeIndex time) const
inlineoverrideprotectedvirtual

Asserts that the index is present in the array does nothing in release mode

Implements stateObservation::IndexedInputArrayInterface.

◆ check_() [2/2]

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::check_ ( ) const
inlineoverrideprotectedvirtual

Asserts that the array is not empty does nothing in release mode

Implements stateObservation::IndexedInputArrayInterface.

◆ checkNext_()

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
void stateObservation::IndexedInputArrayT< InputType, Allocator >::checkNext_ ( TimeIndex time) const
inlineoverrideprotectedvirtual

Asserts that the given time can be pushed at the back of the vector does nothing in release mode

Implements stateObservation::IndexedInputArrayInterface.

Member Data Documentation

◆ v_

template<typename InputType = InputT<>, typename Allocator = std::allocator<InputT<>>>
Deque stateObservation::IndexedInputArrayT< InputType, Allocator >::v_
protected

Definition at line 914 of file definitions.hpp.


The documentation for this class was generated from the following file: