Iguana 1.0.0
Implementation Guardian of Analysis Algorithms
Loading...
Searching...
No Matches
AlgorithmBoilerplate.h File Reference

Detailed Description

Preprocessor macros to generate standardized algorithm boilerplate code.

Definition in file AlgorithmBoilerplate.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CONSTRUCT_IGUANA_ALGORITHM(ALGO_NAME, BASE_NAME)
#define DEFINE_IGUANA_ALGORITHM(ALGO_NAME, ALGO_FULL_NAME)
#define DEFINE_IGUANA_SUBALGORITHM(ALGO_NAME, ALGO_FULL_NAME, BASE_NAME)
#define DEFINE_IGUANA_VALIDATOR(VDOR_NAME, VDOR_FULL_NAME)
#define DEPRECATE_IGUANA_ALGORITHM(CODE)
#define DESTROY_IGUANA_ALGORITHM(ALGO_NAME)
#define IGUANA_ALGORITHM_PRIVATE_MEMBERS    static bool s_registered;
 Define the private members of an algorithm.
#define IGUANA_ALGORITHM_PUBLIC_MEMBERS(ALGO_NAME, ALGO_FULL_NAME, BASE_NAME)
#define REGISTER_IGUANA_ALGORITHM(ALGO_NAME, ...)
#define REGISTER_IGUANA_VALIDATOR(VDOR_NAME)

Macro Definition Documentation

◆ CONSTRUCT_IGUANA_ALGORITHM

#define CONSTRUCT_IGUANA_ALGORITHM ( ALGO_NAME,
BASE_NAME )
Value:
ALGO_NAME(std::string_view name = "") \
: BASE_NAME(name == "" ? GetClassName() : name) \
{ \
m_default_config_file = GetDefaultConfigFile(); \
m_class_name = GetClassName(); \
}

Generate an algorithm constructor

Parameters
ALGO_NAMEthe name of the algorithm class
BASE_NAMEthe name of the base class

Definition at line 7 of file AlgorithmBoilerplate.h.

◆ DEFINE_IGUANA_ALGORITHM

#define DEFINE_IGUANA_ALGORITHM ( ALGO_NAME,
ALGO_FULL_NAME )
Value:
DEFINE_IGUANA_SUBALGORITHM(ALGO_NAME, ALGO_FULL_NAME, Algorithm)
#define DEFINE_IGUANA_SUBALGORITHM(ALGO_NAME, ALGO_FULL_NAME, BASE_NAME)

Define the public and private members of an algorithm, along with its constructor and destructor; this macro should be called in the class body in the algorithm's header file

Parameters
ALGO_NAMEthe name of the algorithm class
ALGO_FULL_NAMEthe full name of this algorithm, used by iguana::AlgorithmFactory

Definition at line 58 of file AlgorithmBoilerplate.h.

◆ DEFINE_IGUANA_SUBALGORITHM

#define DEFINE_IGUANA_SUBALGORITHM ( ALGO_NAME,
ALGO_FULL_NAME,
BASE_NAME )
Value:
private: \
IGUANA_ALGORITHM_PRIVATE_MEMBERS \
public: \
CONSTRUCT_IGUANA_ALGORITHM(ALGO_NAME, BASE_NAME) \
DESTROY_IGUANA_ALGORITHM(ALGO_NAME) \
IGUANA_ALGORITHM_PUBLIC_MEMBERS(ALGO_NAME, ALGO_FULL_NAME, BASE_NAME)

Define the public and private members of an algorithm, with a custom base-class algorithm, along with its constructor and destructor; this macro should be called in the class body in the algorithm's header file

Parameters
ALGO_NAMEthe name of the algorithm class
ALGO_FULL_NAMEthe full name of this algorithm, used by iguana::AlgorithmFactory
BASE_NAMEthe name of the base class, which may be Algorithm or one of its derived classes

Definition at line 46 of file AlgorithmBoilerplate.h.

◆ DEFINE_IGUANA_VALIDATOR

#define DEFINE_IGUANA_VALIDATOR ( VDOR_NAME,
VDOR_FULL_NAME )
Value:
DEFINE_IGUANA_SUBALGORITHM(VDOR_NAME, VDOR_FULL_NAME, Validator)

Define the public and private members of a validator, along with its constructor and destructor; this macro should be called in the class body in the validator's header file

Parameters
VDOR_NAMEthe name of the validator class
VDOR_FULL_NAMEthe full name of this validator, used by iguana::AlgorithmFactory

Definition at line 65 of file AlgorithmBoilerplate.h.

◆ DEPRECATE_IGUANA_ALGORITHM

#define DEPRECATE_IGUANA_ALGORITHM ( CODE)
Value:
void Start(hipo::banklist& banks) override \
{ \
CODE \
} \
bool Run(hipo::banklist& banks) const override \
{ \
CODE return false; \
} \
void Stop() override \
{ \
CODE \
}

Override Start, Run, and Stop functions for a deprecated algorithm.

Parameters
CODEthe code to run within each of these functions; it should throw a runtime exception.

Definition at line 86 of file AlgorithmBoilerplate.h.

◆ DESTROY_IGUANA_ALGORITHM

#define DESTROY_IGUANA_ALGORITHM ( ALGO_NAME)
Value:
~ALGO_NAME() {}

Generate an algorithm destructor

Parameters
ALGO_NAMEthe name of the algorithm class

Definition at line 17 of file AlgorithmBoilerplate.h.

◆ IGUANA_ALGORITHM_PRIVATE_MEMBERS

#define IGUANA_ALGORITHM_PRIVATE_MEMBERS    static bool s_registered;

Define the private members of an algorithm.

Definition at line 36 of file AlgorithmBoilerplate.h.

◆ IGUANA_ALGORITHM_PUBLIC_MEMBERS

#define IGUANA_ALGORITHM_PUBLIC_MEMBERS ( ALGO_NAME,
ALGO_FULL_NAME,
BASE_NAME )
Value:
using BASE_NAME::Start; \
static algo_t Creator() { return std::make_unique<ALGO_NAME>(); } \
static std::string GetClassName() { return #ALGO_FULL_NAME; } \
static std::string GetDefaultConfigFile() \
{ \
return ConfigFileReader::ConvertAlgoNameToConfigName(#ALGO_FULL_NAME); \
}

Define the public members of an algorithm

Parameters
ALGO_NAMEthe name of the algorithm class
ALGO_FULL_NAMEthe full name of this algorithm, used by iguana::AlgorithmFactory
BASE_NAMEthe name of the base class

Definition at line 26 of file AlgorithmBoilerplate.h.

◆ REGISTER_IGUANA_ALGORITHM

#define REGISTER_IGUANA_ALGORITHM ( ALGO_NAME,
... )
Value:
bool ALGO_NAME::s_registered = AlgorithmFactory::Register(ALGO_NAME::GetClassName(), ALGO_NAME::Creator, {__VA_ARGS__});

Register an algorithm for the iguana::AlgorithmFactory; this macro should be called in the algorithm's implementation

Parameters
ALGO_NAMEthe name of the algorithm class
...if this algorithm creates new banks, add their names here; this is a variadic parameter, so you may list as many as needed, or none.

Definition at line 74 of file AlgorithmBoilerplate.h.

◆ REGISTER_IGUANA_VALIDATOR

#define REGISTER_IGUANA_VALIDATOR ( VDOR_NAME)
Value:
#define REGISTER_IGUANA_ALGORITHM(ALGO_NAME,...)

Register a validator for the iguana::AlgorithmFactory, similar to REGISTER_IGUANA_ALGORITHM

Parameters
VDOR_NAMEthe name of the validator class

Definition at line 79 of file AlgorithmBoilerplate.h.