Elementa v8.0.0
Minimalistic library for any C++ application (C++11 and up)
Loading...
Searching...
No Matches

Description


  Fast logging of data in memory.
Author
Juan-Antonio Fernandez-Madrigal. http://jafma.net
Date
2021
Collaboration diagram for Fast logging of data.:

Classes

class  elementa::utils::FastLog< Data >
 A thread-safe circular buffer in memory to store logs. More...
 

Functions

void elementa::utils::FastLog< Data >::clear (void)
 Clear the log. More...
 
bool elementa::utils::FastLog< Data >::empty (void) const
 Return true if the log is empty. More...
 
size_t elementa::utils::FastLog< Data >::size (void) const
 Return the number of logged items. More...
 
void elementa::utils::FastLog< Data >::add (const Data &data)
 Add a log datum. More...
 
void elementa::utils::FastLog< Data >::extract (Datum &ld)
 Extract the oldest datum or throw if none. More...
 

Class Documentation

◆ elementa::utils::FastLog

class elementa::utils::FastLog
template<typename Data>
class elementa::utils::FastLog< Data >

A thread-safe circular buffer in memory to store logs.

Data must be default constructible and assignable.

Definition at line 48 of file fastlog.h.

Public Member Functions

 FastLog (size_t capacity)
 Create an empty log with the given capacity. More...
 
void clear (void)
 Clear the log. More...
 
bool empty (void) const
 Return true if the log is empty. More...
 
size_t size (void) const
 Return the number of logged items. More...
 
void add (const Data &data)
 Add a log datum. More...
 
void extract (Datum &ld)
 Extract the oldest datum or throw if none. More...
 

Constructor & Destructor Documentation

◆ FastLog()

template<typename Data >
elementa::utils::FastLog< Data >::FastLog ( size_t  capacity)
inline

Create an empty log with the given capacity.

Definition at line 61 of file fastlog.h.

Function Documentation

◆ clear()

template<typename Data >
void elementa::utils::FastLog< Data >::clear ( void  )

#include <elementa/utils/fastlog.h>

Clear the log.

Definition at line 102 of file fastlog.h.

◆ empty()

template<typename Data >
bool elementa::utils::FastLog< Data >::empty ( void  ) const

#include <elementa/utils/fastlog.h>

Return true if the log is empty.

Definition at line 110 of file fastlog.h.

◆ size()

template<typename Data >
size_t elementa::utils::FastLog< Data >::size ( void  ) const

#include <elementa/utils/fastlog.h>

Return the number of logged items.

Definition at line 118 of file fastlog.h.

◆ add()

template<typename Data >
void elementa::utils::FastLog< Data >::add ( const Data &  data)

#include <elementa/utils/fastlog.h>

Add a log datum.

Definition at line 126 of file fastlog.h.

◆ extract()

template<typename Data >
void elementa::utils::FastLog< Data >::extract ( Datum ld)

#include <elementa/utils/fastlog.h>

Extract the oldest datum or throw if none.

Definition at line 137 of file fastlog.h.