cumbia-qtcontrols 1.x
Qt widgets on top of the cumbia C++ library
Public Member Functions | Public Attributes | List of all members
CuLinkStats Class Reference

Class used by cumbia-qtcontrols objects to store a minimal set of statistics about the link health. More...

#include <culinkstats.h>

Public Member Functions

 CuLinkStats (int errorHistoryBufSiz=10)
 
void addOperation ()
 Increment operation count. More...
 
int opCnt () const
 returns the number of recorded operations. More...
 
int errorCnt () const
 Returns the error count. More...
 
void addError (const std::string &message)
 Add a date/time generated on the fly to the errorHistory circular buffer. More...
 
void setErrorHistorySize (int s)
 Change the error history buffer size. More...
 
int errorHistorySize () const
 Returns the error history buffer size. More...
 
QList< QDateTime > errorHistory () const
 Returns the error history circular buffer. More...
 
QDateTime connectionDateTime () const
 returns the date and time when addOperation was called the first time. More...
 

Public Attributes

std::string last_error_msg
 

Detailed Description

Class used by cumbia-qtcontrols objects to store a minimal set of statistics about the link health.

Available information
  • op_cnt a counter incremented at each operation (read/write/configuration)
  • errorCnt a method returning the total number of errors occurred
  • last_error_msg a std::string containing the last error message
  • errorHistory: a circular buffer whose size is determined at creation time (constructor) or changed at runtime through setErrorHistorySize. It stores QDateTime elements marking the date and time of the last errors occurred.
To get a reference to the link statistics, call getLinkStats on the cumbia-qtcontrols object.

This class provide minimal statistics about the connection status of the object. It is foreseen that every implementation of either a reader or writer provides some basic information such as error events. The date and time stored in the errorHistory is not taken from a timestamp from the engine implementation. It's instead generated on the fly by addError.

Constructor & Destructor Documentation

◆ CuLinkStats()

CuLinkStats::CuLinkStats ( int  errorHistoryBufSiz = 10)

Member Function Documentation

◆ addError()

void CuLinkStats::addError ( const std::string &  message)

Add a date/time generated on the fly to the errorHistory circular buffer.

  • Adds a date/time generated on the fly to the errorHistory circular buffer (timestamp is not taken by the underlying link implementation)
  • increments the error counter

References last_error_msg.

Referenced by QmlChartBackend::onUpdate(), QuSpectrumPlot::update(), and QuTrendPlot::update().

◆ addOperation()

void CuLinkStats::addOperation ( )

Increment operation count.

The first time addOperation is called, the current date time is saved. Get it with connectionDateTime.

See also
connectionDateTime
opCnt

Referenced by QmlChartBackend::onUpdate(), QuSpectrumPlot::update(), and QuTrendPlot::update().

◆ connectionDateTime()

QDateTime CuLinkStats::connectionDateTime ( ) const

returns the date and time when addOperation was called the first time.

Returns
QDateTime of the first recorded operation
See also
addOperation

◆ errorCnt()

int CuLinkStats::errorCnt ( ) const

Returns the error count.

Every time addError is invoked, the error counter is incremented

See also
addError

◆ errorHistory()

QList< QDateTime > CuLinkStats::errorHistory ( ) const

Returns the error history circular buffer.

See also
setErrorHistorySize
errorHistorySize

Returns a circular buffer long errorHistorySize. It stores a set of QDateTime values accounting for the date and time when the last errors occurred.

◆ errorHistorySize()

int CuLinkStats::errorHistorySize ( ) const

Returns the error history buffer size.

◆ opCnt()

int CuLinkStats::opCnt ( ) const

returns the number of recorded operations.

Returns
the number of times addOperation has been called

◆ setErrorHistorySize()

void CuLinkStats::setErrorHistorySize ( int  s)

Change the error history buffer size.

Parameters
sthe new buffer size. At the (s + 1)-th error event, the oldest value is removed from the circular buffer.

Member Data Documentation

◆ last_error_msg

std::string CuLinkStats::last_error_msg

Referenced by addError().


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