RumPi 1.0
A self-assembling C++ sensor & actuator library for the Raspberry Pi 5
RumPi::AlertEvent Class Reference

A single alert event: a metric crossing (or recovering from) a threshold, with the reading that triggered it. More...

#include <AlertEvent.h>

Public Member Functions

 AlertEvent ()
 Builds an undefined alert event (OK level, sentinel -1 values). More...
 
 AlertEvent (const std::string &metricName, const EAlertLevel alertLevel, const float currentReadingValue, const float valueThreshold, const std::string &eventSummary)
 Builds an alert event from its metric, level, triggering reading, threshold, and summary. More...
 
virtual ~AlertEvent ()=default
 Defaulted destructor. More...
 
std::string ToString () const
 Serializes the metric, alert level, triggering reading, threshold, and summary to a string. More...
 
const std::string & GetMetricName () const
 Gets the metric that triggered the event. More...
 
EAlertLevel GetAlertLevel () const
 Gets the alert level of the event. More...
 
float GetCurrentReadingValue () const
 Gets the reading that triggered the event. More...
 
float GetValueThreshold () const
 Gets the threshold the reading crossed. More...
 
const std::string & GetEventSummary () const
 Gets the human-readable summary of the event. More...
 
void SetMetricName (const std::string &metricName)
 Sets the metric that triggered the event. More...
 
void SetAlertLevel (const EAlertLevel alertLevel)
 Sets the alert level of the event. More...
 
void SetCurrentReadingValue (const float currentReadingValue)
 Sets the reading that triggered the event. More...
 
void SetValueThreshold (const float currentValueThreshold)
 Sets the threshold the reading crossed. More...
 
void SetEventSummary (const std::string &eventSummary)
 Sets the human-readable summary of the event. More...
 

Protected Attributes

std::string myMetricName
 The metric that triggered the event, e.g. "SystemTemperature". More...
 
EAlertLevel myAlertLevel
 OK (recovered), Warning, or Alert. More...
 
float myCurrentReadingValue
 The reading that triggered the event. More...
 
float myValueThreshold
 The limit it crossed. More...
 
std::string myEventSummary
 Human-readable summary. More...
 

Detailed Description

A single alert event: a metric crossing (or recovering from) a threshold, with the reading that triggered it.

Author
Eddie O'Hagan
Date
8/13/2026

Constructor & Destructor Documentation

◆ AlertEvent() [1/2]

RumPi::AlertEvent::AlertEvent ( )

Builds an undefined alert event (OK level, sentinel -1 values).

Author
Eddie O'Hagan
Date
8/13/2026
AlertEvent event;
AlertEvent()
Builds an undefined alert event (OK level, sentinel -1 values).
Definition: AlertEvent.cpp:15

◆ AlertEvent() [2/2]

RumPi::AlertEvent::AlertEvent ( const std::string &  metricName,
const EAlertLevel  alertLevel,
const float  currentReadingValue,
const float  valueThreshold,
const std::string &  eventSummary 
)

Builds an alert event from its metric, level, triggering reading, threshold, and summary.

Author
Eddie O'Hagan
Date
8/13/2026
AlertEvent event("SystemTemperature", EAlertLevel::Alert, 82.0f, 80.0f, "CPU over temperature.");
@ Alert
The metric has crossed its alert threshold.
Definition: Common.h:97
Parameters
[in]metricNameThe metric that triggered the event.
[in]alertLevelThe alert level (OK, Warning, or Alert).
[in]currentReadingValueThe reading that triggered the event.
[in]valueThresholdThe threshold it crossed.
[in]eventSummaryA human-readable summary of the event.

◆ ~AlertEvent()

virtual RumPi::AlertEvent::~AlertEvent ( )
virtualdefault

Defaulted destructor.

Author
Eddie O'Hagan
Date
8/13/2026
AlertEvent* event = new AlertEvent();
delete event;

Member Function Documentation

◆ GetAlertLevel()

EAlertLevel RumPi::AlertEvent::GetAlertLevel ( ) const

Gets the alert level of the event.

Author
Eddie O'Hagan
Date
8/13/2026
EAlertLevel level = event.GetAlertLevel();
EAlertLevel
Severity of a metric relative to its thresholds.
Definition: Common.h:94
Returns
The alert level (OK, Warning, or Alert).

◆ GetCurrentReadingValue()

float RumPi::AlertEvent::GetCurrentReadingValue ( ) const

Gets the reading that triggered the event.

Author
Eddie O'Hagan
Date
8/13/2026
float reading = event.GetCurrentReadingValue();
Returns
The triggering reading.

◆ GetEventSummary()

const std::string & RumPi::AlertEvent::GetEventSummary ( ) const

Gets the human-readable summary of the event.

Author
Eddie O'Hagan
Date
8/13/2026
std::string summary = event.GetEventSummary();
Returns
The event summary.

◆ GetMetricName()

const std::string & RumPi::AlertEvent::GetMetricName ( ) const

Gets the metric that triggered the event.

Author
Eddie O'Hagan
Date
8/13/2026
std::string metric = event.GetMetricName();
Returns
The metric name.

◆ GetValueThreshold()

float RumPi::AlertEvent::GetValueThreshold ( ) const

Gets the threshold the reading crossed.

Author
Eddie O'Hagan
Date
8/13/2026
float threshold = event.GetValueThreshold();
Returns
The threshold value.

◆ SetAlertLevel()

void RumPi::AlertEvent::SetAlertLevel ( const EAlertLevel  alertLevel)

Sets the alert level of the event.

Author
Eddie O'Hagan
Date
8/13/2026
event.SetAlertLevel(EAlertLevel::Warning);
@ Warning
The metric has crossed its warning threshold.
Definition: Common.h:96
Parameters
[in]alertLevelThe alert level to set.

◆ SetCurrentReadingValue()

void RumPi::AlertEvent::SetCurrentReadingValue ( const float  currentReadingValue)

Sets the reading that triggered the event.

Author
Eddie O'Hagan
Date
8/13/2026
event.SetCurrentReadingValue(82.0f);
Parameters
[in]currentReadingValueThe triggering reading to set.

◆ SetEventSummary()

void RumPi::AlertEvent::SetEventSummary ( const std::string &  eventSummary)

Sets the human-readable summary of the event.

Author
Eddie O'Hagan
Date
8/13/2026
event.SetEventSummary("CPU over temperature.");
Parameters
[in]eventSummaryThe event summary to set.

◆ SetMetricName()

void RumPi::AlertEvent::SetMetricName ( const std::string &  metricName)

Sets the metric that triggered the event.

Author
Eddie O'Hagan
Date
8/13/2026
event.SetMetricName("SystemTemperature");
Parameters
[in]metricNameThe metric name to set.

◆ SetValueThreshold()

void RumPi::AlertEvent::SetValueThreshold ( const float  currentValueThreshold)

Sets the threshold the reading crossed.

Author
Eddie O'Hagan
Date
8/13/2026
event.SetValueThreshold(80.0f);
Parameters
[in]currentValueThresholdThe threshold value to set.

◆ ToString()

std::string RumPi::AlertEvent::ToString ( ) const

Serializes the metric, alert level, triggering reading, threshold, and summary to a string.

Author
Eddie O'Hagan
Date
8/13/2026
std::string data = event.ToString();
Returns
A multi-line string describing the alert event.

Member Data Documentation

◆ myAlertLevel

EAlertLevel RumPi::AlertEvent::myAlertLevel
protected

OK (recovered), Warning, or Alert.

◆ myCurrentReadingValue

float RumPi::AlertEvent::myCurrentReadingValue
protected

The reading that triggered the event.

◆ myEventSummary

std::string RumPi::AlertEvent::myEventSummary
protected

Human-readable summary.

◆ myMetricName

std::string RumPi::AlertEvent::myMetricName
protected

The metric that triggered the event, e.g. "SystemTemperature".

◆ myValueThreshold

float RumPi::AlertEvent::myValueThreshold
protected

The limit it crossed.


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