Bayes Filters Library
HistoryBuffer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2016-2019 Istituto Italiano di Tecnologia (IIT)
3  *
4  * This software may be modified and distributed under the terms of the
5  * BSD 3-Clause license. See the accompanying LICENSE file for details.
6  */
7 
8 #ifndef HISTORYBUFFER_H
9 #define HISTORYBUFFER_H
10 
11 #include <deque>
12 
13 #include <Eigen/Core>
14 
15 namespace bfl {
16  class HistoryBuffer;
17 }
18 
19 
21 {
22 public:
23  HistoryBuffer(const std::size_t state_size) noexcept;
24 
25  HistoryBuffer(HistoryBuffer&& history_buffer) noexcept;
26 
27  HistoryBuffer& operator=(HistoryBuffer&& history_buffer) noexcept;
28 
29  ~HistoryBuffer() noexcept = default;
30 
31  void addElement(const Eigen::Ref<const Eigen::VectorXd>& element);
32 
33  Eigen::MatrixXd getHistoryBuffer() const;
34 
35  bool setHistorySize(const unsigned int window);
36 
37  inline unsigned int getHistorySize() const { return window_; };
38 
39  bool decreaseHistorySize();
40 
41  bool increaseHistorySize();
42 
43  bool clear();
44 
45 
46 private:
47  unsigned int window_ = 5;
48 
49  const unsigned int max_window_ = 30;
50 
51  std::deque<Eigen::VectorXd> history_buffer_;
52 
53  std::size_t state_size_;
54 };
55 
56 #endif /* HISTORYBUFFER_H */
bfl::HistoryBuffer::HistoryBuffer
HistoryBuffer(const std::size_t state_size) noexcept
Definition: HistoryBuffer.cpp:14
bfl::HistoryBuffer::history_buffer_
std::deque< Eigen::VectorXd > history_buffer_
Definition: HistoryBuffer.h:51
bfl::HistoryBuffer::window_
unsigned int window_
Definition: HistoryBuffer.h:47
bfl::HistoryBuffer::decreaseHistorySize
bool decreaseHistorySize()
Definition: HistoryBuffer.cpp:87
bfl
Port of boost::any for C++11 compilers.
Definition: AdditiveMeasurementModel.h:13
bfl::HistoryBuffer::increaseHistorySize
bool increaseHistorySize()
Definition: HistoryBuffer.cpp:93
bfl::HistoryBuffer::getHistorySize
unsigned int getHistorySize() const
Definition: HistoryBuffer.h:37
bfl::HistoryBuffer::setHistorySize
bool setHistorySize(const unsigned int window)
Definition: HistoryBuffer.cpp:67
bfl::HistoryBuffer
Definition: HistoryBuffer.h:20
bfl::HistoryBuffer::clear
bool clear()
Definition: HistoryBuffer.cpp:99
bfl::HistoryBuffer::max_window_
const unsigned int max_window_
Definition: HistoryBuffer.h:49
bfl::HistoryBuffer::state_size_
std::size_t state_size_
Definition: HistoryBuffer.h:53
bfl::HistoryBuffer::operator=
HistoryBuffer & operator=(HistoryBuffer &&history_buffer) noexcept
Definition: HistoryBuffer.cpp:29
bfl::HistoryBuffer::getHistoryBuffer
Eigen::MatrixXd getHistoryBuffer() const
Definition: HistoryBuffer.cpp:55
bfl::HistoryBuffer::addElement
void addElement(const Eigen::Ref< const Eigen::VectorXd > &element)
Definition: HistoryBuffer.cpp:46
bfl::HistoryBuffer::~HistoryBuffer
~HistoryBuffer() noexcept=default