RTOS Wrapper
API reference
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
hf::ErrorHistory< Record, kCapacity > Class Template Referencefinal

#include <ErrorHistory.h>

Inheritance diagram for hf::ErrorHistory< Record, kCapacity >:
hf::ErrorHistoryReader< Record > hf::ErrorHistoryWriter< Record >

Public Member Functions

 ErrorHistory () noexcept=default
 
 ErrorHistory (const ErrorHistory &)=delete
 
ErrorHistory & operator= (const ErrorHistory &)=delete
 
bool Push (const Record &record) noexcept override
 Append record. Overwrites oldest entry if full.
 
bool Pop (Record &out) noexcept override
 Pop oldest record into out; returns false if empty.
 
bool Clear () noexcept override
 Drop all records.
 
std::size_t Size () const noexcept override
 Number of entries currently held (≤ Capacity()).
 
std::size_t Capacity () const noexcept override
 Maximum number of entries the ring can hold.
 
uint32_t Seq () const noexcept override
 Monotonic counter; bumps on every successful Push / Pop / Clear.
 
uint32_t OverwriteCount () const noexcept override
 Number of Push calls that overwrote an older entry.
 
std::size_t Snapshot (Record *out, std::size_t max_out) const noexcept override
 Copy up to max_out records into out, oldest first.
 
- Public Member Functions inherited from hf::ErrorHistoryReader< Record >
virtual ~ErrorHistoryReader () noexcept=default
 
- Public Member Functions inherited from hf::ErrorHistoryWriter< Record >
virtual ~ErrorHistoryWriter () noexcept=default
 

Private Attributes

RtosMutex mutex_ {}
 
Record records_ [kCapacity] {}
 
std::size_t head_ {0}
 
std::size_t tail_ {0}
 
std::size_t size_ {0}
 
uint32_t seq_ {0}
 
uint32_t overwrite_count_ {0}
 

Constructor & Destructor Documentation

◆ ErrorHistory() [1/2]

template<typename Record , std::size_t kCapacity>
hf::ErrorHistory< Record, kCapacity >::ErrorHistory ( )
defaultnoexcept

◆ ErrorHistory() [2/2]

template<typename Record , std::size_t kCapacity>
hf::ErrorHistory< Record, kCapacity >::ErrorHistory ( const ErrorHistory< Record, kCapacity > &  )
delete

Member Function Documentation

◆ Capacity()

template<typename Record , std::size_t kCapacity>
std::size_t hf::ErrorHistory< Record, kCapacity >::Capacity ( ) const
inlineoverridevirtualnoexcept

Maximum number of entries the ring can hold.

Implements hf::ErrorHistoryReader< Record >.

◆ Clear()

template<typename Record , std::size_t kCapacity>
bool hf::ErrorHistory< Record, kCapacity >::Clear ( )
inlineoverridevirtualnoexcept

Drop all records.

Implements hf::ErrorHistoryWriter< Record >.

◆ operator=()

template<typename Record , std::size_t kCapacity>
ErrorHistory & hf::ErrorHistory< Record, kCapacity >::operator= ( const ErrorHistory< Record, kCapacity > &  )
delete

◆ OverwriteCount()

template<typename Record , std::size_t kCapacity>
uint32_t hf::ErrorHistory< Record, kCapacity >::OverwriteCount ( ) const
inlineoverridevirtualnoexcept

Number of Push calls that overwrote an older entry.

Implements hf::ErrorHistoryReader< Record >.

◆ Pop()

template<typename Record , std::size_t kCapacity>
bool hf::ErrorHistory< Record, kCapacity >::Pop ( Record &  out)
inlineoverridevirtualnoexcept

Pop oldest record into out; returns false if empty.

Implements hf::ErrorHistoryWriter< Record >.

◆ Push()

template<typename Record , std::size_t kCapacity>
bool hf::ErrorHistory< Record, kCapacity >::Push ( const Record &  record)
inlineoverridevirtualnoexcept

Append record. Overwrites oldest entry if full.

Implements hf::ErrorHistoryWriter< Record >.

◆ Seq()

template<typename Record , std::size_t kCapacity>
uint32_t hf::ErrorHistory< Record, kCapacity >::Seq ( ) const
inlineoverridevirtualnoexcept

Monotonic counter; bumps on every successful Push / Pop / Clear.

Implements hf::ErrorHistoryReader< Record >.

◆ Size()

template<typename Record , std::size_t kCapacity>
std::size_t hf::ErrorHistory< Record, kCapacity >::Size ( ) const
inlineoverridevirtualnoexcept

Number of entries currently held (≤ Capacity()).

Implements hf::ErrorHistoryReader< Record >.

◆ Snapshot()

template<typename Record , std::size_t kCapacity>
std::size_t hf::ErrorHistory< Record, kCapacity >::Snapshot ( Record *  out,
std::size_t  max_out 
) const
inlineoverridevirtualnoexcept

Copy up to max_out records into out, oldest first.

Returns
Number of records actually copied.

Implements hf::ErrorHistoryReader< Record >.

Member Data Documentation

◆ head_

template<typename Record , std::size_t kCapacity>
std::size_t hf::ErrorHistory< Record, kCapacity >::head_ {0}
private

◆ mutex_

template<typename Record , std::size_t kCapacity>
RtosMutex hf::ErrorHistory< Record, kCapacity >::mutex_ {}
mutableprivate

◆ overwrite_count_

template<typename Record , std::size_t kCapacity>
uint32_t hf::ErrorHistory< Record, kCapacity >::overwrite_count_ {0}
private

◆ records_

template<typename Record , std::size_t kCapacity>
Record hf::ErrorHistory< Record, kCapacity >::records_[kCapacity] {}
private

◆ seq_

template<typename Record , std::size_t kCapacity>
uint32_t hf::ErrorHistory< Record, kCapacity >::seq_ {0}
private

◆ size_

template<typename Record , std::size_t kCapacity>
std::size_t hf::ErrorHistory< Record, kCapacity >::size_ {0}
private

◆ tail_

template<typename Record , std::size_t kCapacity>
std::size_t hf::ErrorHistory< Record, kCapacity >::tail_ {0}
private

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