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

This class describes a structure that enables to store array of objects with time indexation. More...

#include <definitions.hpp>

Inheritance diagram for stateObservation::IndexedObjectArrayT< ObjectType, Allocator >:
[legend]
Collaboration diagram for stateObservation::IndexedObjectArrayT< ObjectType, Allocator >:
[legend]

Public Member Functions

 IndexedObjectArrayT ()
 Default constructor.
 IndexedObjectArrayT (TimeSize size, TimeIndex initTime=0)
 Construct a new IndexedObjectArrayT 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 ObjectType &value, TimeIndex k)
void pushBack (const ObjectType &v)
 Pushes back the object to the array, the new value will take the next time.
void popFront ()
 removes the first (oldest) element of the array
const ObjectType & operator[] (TimeIndex time) const
 gets a constant reference to the given time index
ObjectType & operator[] (TimeIndex index)
 gets the value with the given time index, non const version
const ObjectType & front () const
 gets the first value
ObjectType & front ()
 gets the first value
const ObjectType & back () const
 gets the last value
ObjectType & back ()
 gets the last value

Protected Types

typedef std::deque< ObjectType > 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 ObjectType, typename Allocator>
class stateObservation::IndexedObjectArrayT< ObjectType, Allocator >

This class describes a structure that enables to store array of objects with time indexation.

Definition at line 595 of file definitions.hpp.

Member Typedef Documentation

◆ Deque

template<typename ObjectType, typename Allocator>
typedef std::deque<ObjectType> stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::Deque
protected

Definition at line 681 of file definitions.hpp.

Constructor & Destructor Documentation

◆ IndexedObjectArrayT()

template<typename ObjectType, typename Allocator>
stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::IndexedObjectArrayT ( TimeSize size,
TimeIndex initTime = 0 )

Construct a new IndexedObjectArrayT 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 ObjectType, typename Allocator>
void stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::truncateAfter ( TimeIndex timeIndex)
overridevirtual

removes all the elements with larger indexes than timeIndex

Implements stateObservation::IndexedObjectArrayBase.

◆ truncateBefore()

template<typename ObjectType, typename Allocator>
void stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::truncateBefore ( TimeIndex timeIndex)
overridevirtual

removes all the elements with smaller indexes than timeIndex

Implements stateObservation::IndexedObjectArrayBase.

◆ getLastIndex()

template<typename ObjectType, typename Allocator>
TimeIndex stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::getLastIndex ( ) const
inlineoverridevirtual

Get the time index.

Implements stateObservation::IndexedObjectArrayBase.

◆ getNextIndex()

template<typename ObjectType, typename Allocator>
TimeIndex stateObservation::IndexedObjectArrayT< ObjectType, 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::IndexedObjectArrayBase.

◆ setLastIndex()

template<typename ObjectType, typename Allocator>
TimeIndex stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::setLastIndex ( int index)
inlineoverridevirtual

Set the time index of the last element.

Implements stateObservation::IndexedObjectArrayBase.

◆ getFirstIndex()

template<typename ObjectType, typename Allocator>
TimeIndex stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::getFirstIndex ( ) const
inlineoverridevirtual

Get the time index.

Implements stateObservation::IndexedObjectArrayBase.

◆ setFirstIndex()

template<typename ObjectType, typename Allocator>
TimeIndex stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::setFirstIndex ( int index)
inlineoverridevirtual

set the time index of the first element

Implements stateObservation::IndexedObjectArrayBase.

◆ size()

template<typename ObjectType, typename Allocator>
TimeSize stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::size ( ) const
inlineoverridevirtual

◆ reset()

template<typename ObjectType, typename Allocator>
void stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::reset ( )
inlineoverridevirtual

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

Implements stateObservation::IndexedObjectArrayBase.

◆ clear()

template<typename ObjectType, typename Allocator>
void stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::clear ( )
inlineoverridevirtual

Clears the vector but keeps the last index.

Implements stateObservation::IndexedObjectArrayBase.

◆ checkIndex()

template<typename ObjectType, typename Allocator>
bool stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::checkIndex ( TimeIndex k) const
inlineoverridevirtual

checks whether the index is present in the array

Implements stateObservation::IndexedObjectArrayBase.

◆ setValue()

template<typename ObjectType, typename Allocator>
void stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::setValue ( const ObjectType & value,
TimeIndex k )
inline

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

◆ check_() [1/2]

template<typename ObjectType, typename Allocator>
void stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::check_ ( TimeIndex time) const
inlineoverrideprotectedvirtual

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

Implements stateObservation::IndexedObjectArrayBase.

◆ check_() [2/2]

template<typename ObjectType, typename Allocator>
void stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::check_ ( ) const
inlineoverrideprotectedvirtual

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

Implements stateObservation::IndexedObjectArrayBase.

◆ checkNext_()

template<typename ObjectType, typename Allocator>
void stateObservation::IndexedObjectArrayT< ObjectType, 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::IndexedObjectArrayBase.

Member Data Documentation

◆ v_

template<typename ObjectType, typename Allocator>
Deque stateObservation::IndexedObjectArrayT< ObjectType, Allocator >::v_
protected

Definition at line 682 of file definitions.hpp.


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