GridFire v0.7.6rc4.0 General Purpose Nuclear Network

Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
gridfire::trigger::EveryNthTrigger< TriggerContextStruct > Class Template Referencefinal

Pass-through trigger that fires every Nth time its child trigger is true. More...

`#include <trigger_logical.h>`

Inheritance diagram for gridfire::trigger::EveryNthTrigger< TriggerContextStruct >:
[legend]
Collaboration diagram for gridfire::trigger::EveryNthTrigger< TriggerContextStruct >:
[legend]

## Public Member Functions
| EveryNthTrigger (std::unique_ptr< Trigger< TriggerContextStruct > > A, size_t N)
| ~EveryNthTrigger () override=default
bool | check (const TriggerContextStruct &ctx) const override
| Evaluate the trigger condition against the provided context.
void | update (const TriggerContextStruct &ctx) override
| Update any internal state with the given context (e.g., counters, windows).
void | step (const TriggerContextStruct &ctx) override
| similar to update but intended to be run on every step not just those where the trigger triggered
void | reset () override
| Reset internal state and diagnostics counters.
std::string | name () const override
| Short, stable name for this trigger (suitable for logs/UI).
TriggerResult | why (const TriggerContextStruct &ctx) const override
| Explain why the last evaluation would be true/false in a structured way.
std::string | describe () const override
| Human-readable description of this trigger's logic.
size_t | numTriggers () const override
| Total number of times this trigger evaluated to true since last reset.
size_t | numMisses () const override
| Total number of times this trigger evaluated to false since last reset.
Public Member Functions inherited from gridfire::trigger::Trigger< TriggerContextStruct >
virtual | ~Trigger ()=default
| Virtual destructor for polymorphic use.

## Private Attributes
std::unique_ptr< Trigger< TriggerContextStruct > > | m_A
size_t | m_N
size_t | m_counter = 0
size_t | m_hits = 0
size_t | m_misses = 0
size_t | m_updates = 0
size_t | m_resets = 0
size_t | m_steps = 0

## Detailed Description

template<typename TriggerContextStruct>
class gridfire::trigger::EveryNthTrigger< TriggerContextStruct >

Pass-through trigger that fires every Nth time its child trigger is true.

On update(ctx), increments an internal counter when A.check(ctx) is true. check(ctx) returns true only when A.check(ctx) is true and the internal counter is a multiple of N.

Exceptions

  std::invalid_argument | When constructed with N==0.

## Constructor & Destructor Documentation

## ◆ EveryNthTrigger()

template<typename TriggerContextStruct>

gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::EveryNthTrigger | ( | std::unique_ptr< Trigger< TriggerContextStruct > > | A,
|  | size_t | N )
| explicit

## ◆ ~EveryNthTrigger()

template<typename TriggerContextStruct>

gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::~EveryNthTrigger | ( |  | ) |
| override default

## Member Function Documentation

## ◆ check()

template<typename TriggerContextStruct>

bool gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::check | ( | const TriggerContextStruct & | ctx | ) | const
| override virtual

Evaluate the trigger condition against the provided context.

Parameters

  ctx | Context snapshot (immutable view) used to evaluate the condition.

Returns
  true if the condition is satisfied; false otherwise.

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## ◆ describe()

template<typename TriggerContextStruct>

std::string gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::describe | ( |  | ) | const
| override virtual

Human-readable description of this trigger's logic.

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## ◆ name()

template<typename TriggerContextStruct>

std::string gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::name | ( |  | ) | const
| override virtual

Short, stable name for this trigger (suitable for logs/UI).

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## ◆ numMisses()

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::numMisses | ( |  | ) | const
| override virtual

Total number of times this trigger evaluated to false since last reset.

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## ◆ numTriggers()

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::numTriggers | ( |  | ) | const
| override virtual

Total number of times this trigger evaluated to true since last reset.

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## ◆ reset()

template<typename TriggerContextStruct>

void gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::reset | ( |  | ) |
| override virtual

Reset internal state and diagnostics counters.

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## ◆ step()

template<typename TriggerContextStruct>

void gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::step | ( | const TriggerContextStruct & | ctx | ) |
| override virtual

similar to update but intended to be run on every step not just those where the trigger triggered

Parameters

  ctx | Context snapshot used to update state.

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## ◆ update()

template<typename TriggerContextStruct>

void gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::update | ( | const TriggerContextStruct & | ctx | ) |
| override virtual

Update any internal state with the given context (e.g., counters, windows).

Parameters

  ctx | Context snapshot used to update state.

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## ◆ why()

template<typename TriggerContextStruct>

TriggerResult gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::why | ( | const TriggerContextStruct & | ctx | ) | const
| override virtual

Explain why the last evaluation would be true/false in a structured way.

Parameters

  ctx | Context snapshot for the explanation.

Returns
  A TriggerResult tree with a boolean value and per-cause details.

Implements gridfire::trigger::Trigger< TriggerContextStruct >.

## Member Data Documentation

## ◆ m_A

template<typename TriggerContextStruct>

std::unique_ptr<Trigger<TriggerContextStruct> > gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::m_A
| private

## ◆ m_counter

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::m_counter = 0
| mutable private

## ◆ m_hits

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::m_hits = 0
| mutable private

## ◆ m_misses

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::m_misses = 0
| mutable private

## ◆ m_N

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::m_N
| private

## ◆ m_resets

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::m_resets = 0
| mutable private

## ◆ m_steps

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::m_steps = 0
| mutable private

## ◆ m_updates

template<typename TriggerContextStruct>

size_t gridfire::trigger::EveryNthTrigger< TriggerContextStruct >::m_updates = 0
| mutable private

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

- src/include/gridfire/trigger/trigger_logical.h