Loading...
Searching...
No Matches
gridfire::trigger::AndTrigger< TriggerContextStruct > Class Template Referencefinal

Logical conjunction of two triggers with short-circuit evaluation. More...

`#include <trigger_logical.h>`

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

## Public Member Functions

| AndTrigger (std::unique_ptr< Trigger< TriggerContextStruct > > A, std::unique_ptr< Trigger< TriggerContextStruct > > B)
| Construct AND from two triggers (ownership transferred).
| ~AndTrigger () override=default
bool | check (const TriggerContextStruct &ctx) const override
| Evaluate A && B; increments hit/miss counters.
void | update (const TriggerContextStruct &ctx) override
| Update both sub-triggers and increment update counter.
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 both sub-triggers and local counters.
std::string | name () const override
| Human-readable name.
TriggerResult | why (const TriggerContextStruct &ctx) const override
| Structured explanation; short-circuits on A=false.
std::string | describe () const override
| Description expression e.g. "(A) AND (B)".
size_t | numTriggers () const override
| Number of true evaluations since last reset.
size_t | numMisses () const override
| Number of false evaluations 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
std::unique_ptr< Trigger< TriggerContextStruct > > | m_B
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::AndTrigger< TriggerContextStruct >

Logical conjunction of two triggers with short-circuit evaluation.

check(ctx) returns A.check(ctx) && B.check(ctx). The why(ctx) explanation short-circuits if A is false, avoiding evaluation of B. update(ctx) calls update() on both A and B.

Counters (mutable) are incremented inside const check(): m_hits on true; m_misses on false; m_updates on each update(); m_resets on reset().

Example
  auto t = AndTrigger(ctxA, ctxB);
  if (t.check(ctx)) { (void)ctx; }
  gridfire::trigger::AndTrigger
  Logical conjunction of two triggers with short-circuit evaluation.
  Definition trigger_logical.h:39

## Constructor & Destructor Documentation

## AndTrigger()

template<typename TriggerContextStruct >

gridfire::trigger::AndTrigger< TriggerContextStruct >::AndTrigger | ( | std::unique_ptr< Trigger< TriggerContextStruct > > | A,
|  | std::unique_ptr< Trigger< TriggerContextStruct > > | B
| ) |  |

Construct AND from two triggers (ownership transferred).

## ~AndTrigger()

template<typename TriggerContextStruct >

gridfire::trigger::AndTrigger< TriggerContextStruct >::~AndTrigger | ( |  | ) |

overridedefault

## Member Function Documentation

## check()

template<typename TriggerContextStruct >

bool gridfire::trigger::AndTrigger< TriggerContextStruct >::check | ( | const TriggerContextStruct & | ctx | ) | const

overridevirtual

Evaluate A && B; increments hit/miss counters.

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

## describe()

template<typename TriggerContextStruct >

std::string gridfire::trigger::AndTrigger< TriggerContextStruct >::describe | ( |  | ) | const

overridevirtual

Description expression e.g. "(A) AND (B)".

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

## name()

template<typename TriggerContextStruct >

std::string gridfire::trigger::AndTrigger< TriggerContextStruct >::name | ( |  | ) | const

overridevirtual

Human-readable name.

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

## numMisses()

template<typename TriggerContextStruct >

size_t gridfire::trigger::AndTrigger< TriggerContextStruct >::numMisses | ( |  | ) | const

overridevirtual

Number of false evaluations since last reset.

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

## numTriggers()

template<typename TriggerContextStruct >

size_t gridfire::trigger::AndTrigger< TriggerContextStruct >::numTriggers | ( |  | ) | const

overridevirtual

Number of true evaluations since last reset.

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

## reset()

template<typename TriggerContextStruct >

void gridfire::trigger::AndTrigger< TriggerContextStruct >::reset | ( |  | ) |

overridevirtual

Reset both sub-triggers and local counters.

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

## step()

template<typename TriggerContextStruct >

void gridfire::trigger::AndTrigger< TriggerContextStruct >::step | ( | const TriggerContextStruct & | ctx | ) |

overridevirtual

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::AndTrigger< TriggerContextStruct >::update | ( | const TriggerContextStruct & | ctx | ) |

overridevirtual

Update both sub-triggers and increment update counter.

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

## why()

template<typename TriggerContextStruct >

TriggerResult gridfire::trigger::AndTrigger< TriggerContextStruct >::why | ( | const TriggerContextStruct & | ctx | ) | const

overridevirtual

Structured explanation; short-circuits on A=false.

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

## Member Data Documentation

## m_A

template<typename TriggerContextStruct >

std::unique_ptr<Trigger<TriggerContextStruct> > gridfire::trigger::AndTrigger< TriggerContextStruct >::m_A

private

## m_B

template<typename TriggerContextStruct >

std::unique_ptr<Trigger<TriggerContextStruct> > gridfire::trigger::AndTrigger< TriggerContextStruct >::m_B

private

## m_hits

template<typename TriggerContextStruct >

size_t gridfire::trigger::AndTrigger< TriggerContextStruct >::m_hits = 0

mutableprivate

## m_misses

template<typename TriggerContextStruct >

size_t gridfire::trigger::AndTrigger< TriggerContextStruct >::m_misses = 0

mutableprivate

## m_resets

template<typename TriggerContextStruct >

size_t gridfire::trigger::AndTrigger< TriggerContextStruct >::m_resets = 0

mutableprivate

## m_steps

template<typename TriggerContextStruct >

size_t gridfire::trigger::AndTrigger< TriggerContextStruct >::m_steps = 0

mutableprivate

## m_updates

template<typename TriggerContextStruct >

size_t gridfire::trigger::AndTrigger< TriggerContextStruct >::m_updates = 0

mutableprivate

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

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