M1M3 Support System
Loading...
Searching...
No Matches
LSST::M1M3::SS::LimitTrigger< TcheckArgs > Class Template Referenceabstract

Abstract interface class for limiting some action to predefined execution. More...

#include <LimitTrigger.h>

Public Member Functions

void check (TcheckArgs... args)
 Should be called from code when out of bounds conditions for triggering is detected.
 
virtual void reset ()=0
 Pure virtual placeholder to reset any internal variables.
 

Protected Member Functions

virtual bool trigger ()=0
 Pure virtual placeholder for check if triggering criteria are met.
 
virtual void execute (TcheckArgs... args)=0
 Pure virtual placeholder for executing limited action.
 

Detailed Description

template<typename... TcheckArgs>
class LSST::M1M3::SS::LimitTrigger< TcheckArgs >

Abstract interface class for limiting some action to predefined execution.

This class shall be used when a large number of messages (violation of some criteria) can be send. The class can limit number of occurrences it will actually run the execute code.

Template Parameters
TcheckArgsarguments passed to check and execute methods

Example:

class MyLimitTrigger: public LimitTrigger<const char*> {
public:
MyLimitTrigger(int minOccurence) {
reset();
_minOccurence = minOccurence;
}
bool trigger() override { return ++_counter >= _minOccurence; }
void execute(const char *msg) override { std::cout << "Executed with
message " << msg << std::endl; } void reset() override { _counter = 0; }
private:
int _counter;
int _minOccurence;
};
....
MyLimitTrigger limitTrigger(10);
....
limitTrigger.check();
....
virtual void reset()=0
Pure virtual placeholder to reset any internal variables.
virtual void execute(TcheckArgs... args)=0
Pure virtual placeholder for executing limited action.
virtual bool trigger()=0
Pure virtual placeholder for check if triggering criteria are met.

Member Function Documentation

◆ check()

template<typename... TcheckArgs>
void LSST::M1M3::SS::LimitTrigger< TcheckArgs >::check ( TcheckArgs... args)
inline

Should be called from code when out of bounds conditions for triggering is detected.

Parameters
argsarguments that will be passed to execute method if triggering conditions are met.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute()

template<typename... TcheckArgs>
virtual void LSST::M1M3::SS::LimitTrigger< TcheckArgs >::execute ( TcheckArgs... args)
protectedpure virtual

Pure virtual placeholder for executing limited action.

Child subclasses shall override this method and put the action (sending log message, ..) which should be executed.

Parameters
argsarguments passed to check
See also
check
Here is the caller graph for this function:

◆ reset()

template<typename... TcheckArgs>
virtual void LSST::M1M3::SS::LimitTrigger< TcheckArgs >::reset ( )
pure virtual

Pure virtual placeholder to reset any internal variables.

Shall be called after conditions are back inside bounds and no future triggering is expected in the current system state.

Here is the caller graph for this function:

◆ trigger()

template<typename... TcheckArgs>
virtual bool LSST::M1M3::SS::LimitTrigger< TcheckArgs >::trigger ( )
protectedpure virtual

Pure virtual placeholder for check if triggering criteria are met.

Returns
true if execute method shall be executed
Here is the caller graph for this function:

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