HOPS
HOPS class reference
Classes | Public Member Functions | List of all members
hops::MHO_OperatorToolbox Class Reference

Class MHO_OperatorToolbox. More...

#include <MHO_OperatorToolbox.hh>

Public Member Functions

 MHO_OperatorToolbox ()
 
virtual ~MHO_OperatorToolbox ()
 
void AddOperator (MHO_Operator *op, const std::string &name, const std::string &category, bool replace_duplicate=true)
 Adds an operator to the toolbox with optional replacement if duplicate name exists. More...
 
std::vector< MHO_Operator * > GetAllOperators ()
 Getter for all operators (vector of pointers) More...
 
std::size_t GetNOperators ()
 Getter for number of operators. More...
 
MHO_OperatorGetOperator (const char *name)
 Getter for an operator by name. More...
 
MHO_OperatorGetOperator (const std::string &name)
 Getter for operator - retrieval by name as generic operator, returns nullptr if missing. More...
 
template<typename XOperatorType >
XOperatorType * GetOperatorAs (const std::string &name)
 Getter for operator, retrieval by name, with cast to specified type (XOperatorType), if missing returns nullptr. More...
 
std::vector< MHO_Operator * > GetOperatorsByCategory (const std::string &category)
 Getter for operators by category. More...
 
std::vector< MHO_Operator * > GetOperatorsByPriorityRange (double lower_limit, double upper_limit)
 Getter for operators by priority range - get all operators within the priority range [low,high) More...
 

Detailed Description

Class MHO_OperatorToolbox.

The toolbox class stores all operator objects as points to the MHO_Operator base class.

Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du
Date
Sun Jun 4 17:43:54 2023 -0400

Constructor & Destructor Documentation

◆ MHO_OperatorToolbox()

hops::MHO_OperatorToolbox::MHO_OperatorToolbox ( )
inline

◆ ~MHO_OperatorToolbox()

virtual hops::MHO_OperatorToolbox::~MHO_OperatorToolbox ( )
inlinevirtual

Member Function Documentation

◆ AddOperator()

void hops::MHO_OperatorToolbox::AddOperator ( MHO_Operator op,
const std::string &  name,
const std::string &  category,
bool  replace_duplicate = true 
)
inline

Adds an operator to the toolbox with optional replacement if duplicate name exists.

Parameters
opPointer to the MHO_Operator to be added
nameName of the operator (duplicate names can be replaced)
categoryCategory under which the operator will be stored
replace_duplicateFlag indicating whether to replace duplicate operators by name

◆ GetAllOperators()

std::vector< MHO_Operator* > hops::MHO_OperatorToolbox::GetAllOperators ( )
inline

Getter for all operators (vector of pointers)

Returns
std::vector<MHO_Operator* sorted list of operators

◆ GetNOperators()

std::size_t hops::MHO_OperatorToolbox::GetNOperators ( )
inline

Getter for number of operators.

Returns
Size of fOperators vector as std::size_t

◆ GetOperator() [1/2]

MHO_Operator* hops::MHO_OperatorToolbox::GetOperator ( const char *  name)
inline

Getter for an operator by name.

Parameters
nameOperator name to search for in the map
Returns
Pointer to MHO_Operator or nullptr if not found

◆ GetOperator() [2/2]

MHO_Operator* hops::MHO_OperatorToolbox::GetOperator ( const std::string &  name)
inline

Getter for operator - retrieval by name as generic operator, returns nullptr if missing.

Parameters
nameOperator name to search for in the map
Returns
Pointer to MHO_Operator or nullptr if not found

◆ GetOperatorAs()

template<typename XOperatorType >
XOperatorType* hops::MHO_OperatorToolbox::GetOperatorAs ( const std::string &  name)
inline

Getter for operator, retrieval by name, with cast to specified type (XOperatorType), if missing returns nullptr.

Parameters
nameOperator name to retrieve
Returns
Pointer to operator cast as XOperatorType or nullptr if not found/cannot be cast

◆ GetOperatorsByCategory()

std::vector< MHO_Operator* > hops::MHO_OperatorToolbox::GetOperatorsByCategory ( const std::string &  category)
inline

Getter for operators by category.

Parameters
categoryThe category of operators to retrieve.
Returns
A vector of MHO_Operator pointers sorted by priority.

◆ GetOperatorsByPriorityRange()

std::vector< MHO_Operator* > hops::MHO_OperatorToolbox::GetOperatorsByPriorityRange ( double  lower_limit,
double  upper_limit 
)
inline

Getter for operators by priority range - get all operators within the priority range [low,high)

Parameters
lower_limitLower bound of priority range
upper_limitUpper bound of priority range
Returns
Vector of MHO_Operator pointers sorted by priority

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