HOPS
HOPS class reference
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
hops::MHO_ParameterConfigurator Class Reference

some control statements simply trigger a parameter value to be set to a certain value, this class handles this special case More...

#include <MHO_ParameterConfigurator.hh>

Public Member Functions

 MHO_ParameterConfigurator (MHO_ParameterStore *pstore, mho_json control_format)
 
virtual ~MHO_ParameterConfigurator ()
 
virtual bool Configure ()
 Configures parameter value by evaluating conditions and attributes. More...
 
virtual void SetAttributes (const mho_json &attr)
 Setter for (current) data attributes. More...
 
virtual void SetConditions (const mho_json &cond)
 set conditions for this parameter (parsed from the control file) More...
 

Protected Types

typedef ParamType param_t
 
enum class  ParamType {
  config , global , station , baseline ,
  fit , plot , unknown
}
 
typedef ParamValueType paramv_t
 
enum class  ParamValueType {
  int_type , real_type , bool_type , string_type ,
  list_int_type , list_real_type , list_string_type , compound_type ,
  logical_intersection_list_string_type , unknown
}
 

Protected Member Functions

ParamType DetermineParamType (const std::string &par_type) const
 Determines parameter type from string input. More...
 
ParamValueType DetermineParamValueType (const std::string &par_value_type) const
 Determines the parameter value type from a given string representation. More...
 
template<typename XValueType >
void GetScalarParameter (std::string path, XValueType &value)
 Getter for scalar parameter. More...
 
template<typename XValueType >
void GetVectorParameter (std::string path, std::vector< XValueType > &values)
 Getter for vector parameter. More...
 
std::vector< std::string > LogicalIntersection (std::vector< std::string > &values1, std::vector< std::string > &values2) const
 Calculates logical intersection of two sorted string vectors. More...
 
void SetCompoundParameter (std::string path, const mho_json &values)
 Setter for compound parameter. More...
 
template<typename XValueType >
void SetScalarParameter (std::string path, const XValueType &value)
 Setter for scalar parameter. More...
 
template<typename XValueType >
void SetVectorParameter (std::string path, const std::vector< XValueType > &values)
 Setter for vector parameter. More...
 

Protected Attributes

mho_json fAttributes
 
mho_json fConditions
 
mho_json fFormat
 
MHO_ParameterStorefParameterStore
 

Detailed Description

some control statements simply trigger a parameter value to be set to a certain value, this class handles this special case

Date
Mon Jun 12 12:51:32 2023 -0400
Author
J. Barrett - barre.nosp@m.ttj@.nosp@m.mit.e.nosp@m.du

Member Typedef Documentation

◆ param_t

◆ paramv_t

Member Enumeration Documentation

◆ ParamType

data

Enumerator
config 
global 
station 
baseline 
fit 
plot 
unknown 

◆ ParamValueType

Enumerator
int_type 
real_type 
bool_type 
string_type 
list_int_type 
list_real_type 
list_string_type 
compound_type 
logical_intersection_list_string_type 
unknown 

Constructor & Destructor Documentation

◆ MHO_ParameterConfigurator()

hops::MHO_ParameterConfigurator::MHO_ParameterConfigurator ( MHO_ParameterStore pstore,
mho_json  control_format 
)
inline

◆ ~MHO_ParameterConfigurator()

virtual hops::MHO_ParameterConfigurator::~MHO_ParameterConfigurator ( )
inlinevirtual

Member Function Documentation

◆ Configure()

bool hops::MHO_ParameterConfigurator::Configure ( )
virtual

Configures parameter value by evaluating conditions and attributes.

Returns
bool indicating success (true) or failure (false)
Note
This is a virtual function.

◆ DetermineParamType()

MHO_ParameterConfigurator::ParamType hops::MHO_ParameterConfigurator::DetermineParamType ( const std::string &  par_type) const
protected

Determines parameter type from string input.

Parameters
par_typeInput parameter type as string.
Returns
Parameter type enum based on input string.

◆ DetermineParamValueType()

MHO_ParameterConfigurator::ParamValueType hops::MHO_ParameterConfigurator::DetermineParamValueType ( const std::string &  par_value_type) const
protected

Determines the parameter value type from a given string representation.

Parameters
par_value_typeInput string representing the parameter value type.
Returns
Enum value of ParamValueType corresponding to the input string.

◆ GetScalarParameter()

template<typename XValueType >
void hops::MHO_ParameterConfigurator::GetScalarParameter ( std::string  path,
XValueType &  value 
)
protected

Getter for scalar parameter.

Retrieves a scalar parameter value from the parameter store by its path.

Template Parameters
XValueTypeTemplate parameter XValueType
Parameters
pathPath to the parameter as a std::string
valueReference to the scalar parameter value of type XValueType
Returns
void, with success indicated by modifying 'value'
Parameters
pathThe path to the desired parameter.
value(XValueType&)
Returns
void

◆ GetVectorParameter()

template<typename XValueType >
void hops::MHO_ParameterConfigurator::GetVectorParameter ( std::string  path,
std::vector< XValueType > &  values 
)
protected

Getter for vector parameter.

Retrieves a vector parameter from the parameter store using the given path.

Template Parameters
XValueTypeTemplate parameter (used in std::vector< XValueType >&)
Parameters
pathThe path to the parameter in the parameter store.
values(std::vector< XValueType )&
Returns
void
Template Parameters
XValueTypeTemplate parameter XValueType
Parameters
pathThe path to the desired parameter.
values(std::vector< XValueType )&

◆ LogicalIntersection()

std::vector< std::string > hops::MHO_ParameterConfigurator::LogicalIntersection ( std::vector< std::string > &  values1,
std::vector< std::string > &  values2 
) const
protected

Calculates logical intersection of two sorted string vectors.

Parameters
values1First vector of strings to find intersection.
values2Second vector of strings to find intersection.
Returns
Vector of strings representing the logical intersection.

◆ SetAttributes()

virtual void hops::MHO_ParameterConfigurator::SetAttributes ( const mho_json attr)
inlinevirtual

Setter for (current) data attributes.

Parameters
attrInput attribute object to set
Note
This is a virtual function.

◆ SetCompoundParameter()

void hops::MHO_ParameterConfigurator::SetCompoundParameter ( std::string  path,
const mho_json values 
)
protected

Setter for compound parameter.

Parameters
pathPath to the compound parameter as a std::string.
valuesJSON values to set for the compound parameter.

◆ SetConditions()

virtual void hops::MHO_ParameterConfigurator::SetConditions ( const mho_json cond)
inlinevirtual

set conditions for this parameter (parsed from the control file)

Parameters
condInput conditions of type mho_json
Note
This is a virtual function.

◆ SetScalarParameter()

template<typename XValueType >
void hops::MHO_ParameterConfigurator::SetScalarParameter ( std::string  path,
const XValueType &  value 
)
protected

Setter for scalar parameter.

Sets a scalar parameter in the MHO_ParameterStore using a given path and value.

Parameters
pathParameter path as std::string
valueScalar value to set, type XValueType
Returns
void
Parameters
pathThe path to the parameter as a string.
valueThe new value for the parameter of type XValueType.
Returns
No return value (void).

◆ SetVectorParameter()

template<typename XValueType >
void hops::MHO_ParameterConfigurator::SetVectorParameter ( std::string  path,
const std::vector< XValueType > &  values 
)
protected

Setter for vector parameter.

Sets a vector parameter at the specified path in the parameter store.

Template Parameters
XValueTypeTemplate parameter (used in std::vector< XValueType >&)
Parameters
pathParameter path as std::string
valuesVector of values to set at given path
Returns
void
Template Parameters
XValueTypeTemplate parameter XValueType
Parameters
pathThe path to set the vector parameter at.
valuesA reference to the vector of XValueType values to be set.

Member Data Documentation

◆ fAttributes

mho_json hops::MHO_ParameterConfigurator::fAttributes
protected

◆ fConditions

mho_json hops::MHO_ParameterConfigurator::fConditions
protected

◆ fFormat

mho_json hops::MHO_ParameterConfigurator::fFormat
protected

◆ fParameterStore

MHO_ParameterStore* hops::MHO_ParameterConfigurator::fParameterStore
protected

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