|
MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
|
History buffer for difference equations and recursive relations. More...
#include <RingBuffer.hpp>
Inheritance diagram for MayaFlux::Memory::HistoryBuffer< T >:
Collaboration diagram for MayaFlux::Memory::HistoryBuffer< T >:Public Types | |
| using | value_type = T |
| using | reference = T & |
| using | const_reference = const T & |
Public Member Functions | |
| HistoryBuffer (size_t capacity) | |
| Construct history buffer with specified capacity. | |
| void | push (const T &value) |
| Push new value to front of history. | |
| reference | operator[] (size_t index) |
| Access element by temporal offset. | |
| const_reference | operator[] (size_t index) const |
| reference | newest () |
| Get newest element (same as [0]) | |
| const_reference | newest () const |
| reference | oldest () |
| Get oldest element (same as [capacity-1]) | |
| const_reference | oldest () const |
| void | overwrite_newest (const T &value) |
| Overwrite the newest element without advancing position. | |
| std::span< T > | linearized_view () |
| Get mutable linearized view of entire history. | |
| std::span< const T > | linearized_view () const |
| Get const linearized view. | |
| void | update (size_t index, const T &value) |
| Update element at specific index. | |
| void | reset () |
| Reset buffer to initial state (all zeros) | |
| void | set_initial_conditions (const std::vector< T > &values) |
| Set initial conditions. | |
| void | resize (size_t new_capacity) |
| Resize buffer capacity. | |
| size_t | capacity () const |
| Get buffer capacity. | |
| size_t | size () const |
| Get current count (always equals capacity for HistoryBuffer) | |
| bool | empty () const |
| Check if buffer is empty (always false for HistoryBuffer) | |
| std::vector< T > | save_state () const |
| Save current state for later restoration. | |
| void | restore_state (const std::vector< T > &state) |
| Restore previously saved state. | |
Private Attributes | |
| size_t | m_capacity |
| std::vector< T > | m_data |
| std::vector< T > | m_linear_view |
| size_t | m_head {} |
| size_t | m_count |
History buffer for difference equations and recursive relations.
Specialized ring buffer for maintaining temporal history in mathematical computations. Pre-initialized to full capacity with zeros to match standard mathematical notation where y[n-k] is defined for all k < N from the start (initial conditions = 0).
Key Differences from Generic RingBuffer:
| T | Element type |
Definition at line 344 of file RingBuffer.hpp.