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 ()
 
 MHO_OperatorToolbox (const MHO_OperatorToolbox &)=delete
 
virtual ~MHO_OperatorToolbox ()
 
void AddOperator (std::unique_ptr< 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::vector< MHO_Operator * > GetAllOperatorsByName (const std::string &name)
 Getter for all operators with the given name - returns all operators whose name matches, sorted by priority. Use this when multiple operators may share the same name. More...
 
std::size_t GetNOperators ()
 Getter for number of operators. More...
 
std::size_t GetNOperatorsInCategory (const std::string &cat)
 
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...
 
MHO_OperatorToolboxoperator= (const MHO_OperatorToolbox &)=delete
 
void PrintOperatorNames ()
 

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() [1/2]

hops::MHO_OperatorToolbox::MHO_OperatorToolbox ( )
inline

◆ MHO_OperatorToolbox() [2/2]

hops::MHO_OperatorToolbox::MHO_OperatorToolbox ( const MHO_OperatorToolbox )
delete

◆ ~MHO_OperatorToolbox()

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

Member Function Documentation

◆ AddOperator()

void hops::MHO_OperatorToolbox::AddOperator ( std::unique_ptr< 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_duplicateIf true, an existing operator with the same name is removed first. If false, the new operator is added alongside any same-named ones, GetOperator(name) then returns the most recently added, while GetAllOperatorsByName(name) retrieves all of them sorted by priority.

◆ 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

◆ GetAllOperatorsByName()

std::vector< MHO_Operator* > hops::MHO_OperatorToolbox::GetAllOperatorsByName ( const std::string &  name)
inline

Getter for all operators with the given name - returns all operators whose name matches, sorted by priority. Use this when multiple operators may share the same name.

Parameters
nameOperator name to search for
Returns
Vector of MHO_Operator pointers sorted by priority

◆ GetNOperators()

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

Getter for number of operators.

Returns
Size of fOperators vector as std::size_t

◆ GetNOperatorsInCategory()

std::size_t hops::MHO_OperatorToolbox::GetNOperatorsInCategory ( const std::string &  cat)
inline

◆ 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

◆ operator=()

MHO_OperatorToolbox& hops::MHO_OperatorToolbox::operator= ( const MHO_OperatorToolbox )
delete

◆ PrintOperatorNames()

void hops::MHO_OperatorToolbox::PrintOperatorNames ( )
inline

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