Phosphor
phosphor::StatsCallback Class Referenceabstract

#include <stats_callback.h>

Public Member Functions

template<size_t N, typename T >
void operator() (const char(&s)[N], T &&value)
 
virtual void operator() (gsl_p::cstring_span key, gsl_p::cstring_span value)=0
 
virtual void operator() (gsl_p::cstring_span key, bool value)=0
 
virtual void operator() (gsl_p::cstring_span key, size_t value)=0
 
virtual void operator() (gsl_p::cstring_span key, ssize_t value)=0
 
virtual void operator() (gsl_p::cstring_span key, double value)=0
 

Detailed Description

Pure virtual base class for receiving stats from phosphor internals

Methods on this class will be called with the key and value of each stat. Callback implementations MUST NOT re-enter the TraceLog or TraceBuffer upon which it used as locks may be held when the callback is invoked.

Example usage:

class MyStatsCallback : public phosphor::StatsCallback {
     // Implement callback methods
} callback;

phosphor::TraceLog::getInstance().getStats(callback);

// Stash data as required for application
auto data = callback.getData();

Implementations should note that phosphor makes no guarantees about atomicity of the stats with respect to each other.

Member Function Documentation

template<size_t N, typename T >
void phosphor::StatsCallback::operator() ( const char(&)  s[N],
T &&  value 
)
inline

Utility template method for passing a string literal as the first argument instead of a string span

Parameters
sString to convert to a span
valueValue to forward

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