|
Thunderbots Project
|
#include <threaded_observer.hpp>


Public Member Functions | |
| ThreadedObserver (size_t buffer_size=Observer< T >::DEFAULT_BUFFER_SIZE, bool log_buffer_full=true) | |
| ThreadedObserver & | operator= (const ThreadedObserver &)=delete |
| ThreadedObserver (const ThreadedObserver &)=delete | |
Public Member Functions inherited from Observer< T, Clock > | |
| Observer (size_t buffer_size=DEFAULT_BUFFER_SIZE, bool log_buffer_full=true) | |
| virtual void | receiveValue (T val) |
| virtual double | getDataReceivedPerSecond () final |
Additional Inherited Members | |
Static Public Attributes inherited from Observer< T, Clock > | |
| static constexpr size_t | TIME_BUFFER_SIZE = 5 |
Protected Member Functions inherited from Observer< T, Clock > | |
| virtual std::optional< T > | popMostRecentlyReceivedValue (Duration max_wait_time) final |
| virtual std::optional< T > | popLeastRecentlyReceivedValue (Duration max_wait_time) final |
Static Protected Attributes inherited from Observer< T, Clock > | |
| static constexpr size_t | DEFAULT_BUFFER_SIZE = 1 |
The general usage of this class should be to extend it, then override onValueReceived with whatever custom functionality should occur when a new value is received, and getNextValue with a function that returns either the first or last received value from the internal buffer.
| T | The type of object this class is observing |
|
explicit |
Creates a new ThreadedObserver
| buffer_size | size of the buffer |
| log_buffer_full | whether or not to log when the buffer is full |