1 #ifndef MHO_OperatorBuilder_HH__
2 #define MHO_OperatorBuilder_HH__
110 TODO_FIXME_MSG(
"TODO FIXME -- improve checks on operator attributes in IsConfigurationOk)")
113 if(
fFormat[
"statement_type"] ==
"operator")
115 if(
fFormat.contains(
"type") &&
fFormat[
"type"].get< std::string >() ==
"compound")
118 for(
auto it =
fFormat[
"fields"].begin(); it !=
fFormat[
"fields"].end(); it++)
122 msg_error(
"initialization",
"missing attribute called " << *it <<
" in parameters of operator: "
123 <<
fFormat[
"name"].get< std::string >()
124 <<
", will not build " << eom);
149 std::vector< std::string > ids;
166 return ids.empty() ? std::vector< std::string >{
"??"} : ids;
180 std::string role_mk4 =
fParameterStore->
GetAs< std::string >(std::string(
"/") + role +
"_station/mk4id");
181 std::string role_code =
fParameterStore->
GetAs< std::string >(std::string(
"/") + role +
"_station/site_id");
183 if(station_id ==
"??" || station_id ==
"?")
187 if(station_id.size() == 1)
189 return (station_id == role_mk4);
192 return (station_id == role_code);
211 std::vector< std::string > matching;
212 for(
const auto&
id : all_ids)
216 matching.push_back(
id);
219 return matching.empty() ? std::vector< std::string >{
"??"} : matching;
#define msg_error(xKEY, xCONTENT)
Definition: MHO_Message.hh:238
#define TODO_FIXME_MSG(x)
Definition: MHO_Message.hh:35
Class MHO_ContainerStore.
Definition: MHO_ContainerStore.hh:32
Class MHO_FringeData.
Definition: MHO_FringeData.hh:30
Abtract base class for a builder object (creates an operator for later use)
Definition: MHO_OperatorBuilder.hh:28
mho_json fConditions
Definition: MHO_OperatorBuilder.hh:224
virtual ~MHO_OperatorBuilder()
Definition: MHO_OperatorBuilder.hh:40
void SetConditions(const mho_json &cond)
Setter for applicability conditions.
Definition: MHO_OperatorBuilder.hh:83
void SetFormat(const mho_json &format)
Setter for format.
Definition: MHO_OperatorBuilder.hh:76
void SetParameterStore(MHO_ParameterStore *pstore)
Setter for parameter store.
Definition: MHO_OperatorBuilder.hh:61
bool StationMatchesRole(const std::string &station_id, const std::string &role) const
Definition: MHO_OperatorBuilder.hh:173
MHO_ParameterStore * fParameterStore
Definition: MHO_OperatorBuilder.hh:142
MHO_OperatorToolbox * fOperatorToolbox
Definition: MHO_OperatorBuilder.hh:135
MHO_ContainerStore * fContainerStore
Definition: MHO_OperatorBuilder.hh:141
void SetToolbox(MHO_OperatorToolbox *toolbox)
Setter for toolbox.
Definition: MHO_OperatorBuilder.hh:47
MHO_OperatorBuilder(MHO_OperatorToolbox *toolbox, MHO_FringeData *fdata)
Definition: MHO_OperatorBuilder.hh:31
void SetAttributes(const mho_json &attr)
Setter for attributes.
Definition: MHO_OperatorBuilder.hh:90
virtual bool IsConfigurationOk()
Function IsConfigurationOk provided for derived class to validate fAttributes against fFormat and/or ...
Definition: MHO_OperatorBuilder.hh:108
mho_json fFormat
Definition: MHO_OperatorBuilder.hh:223
MHO_OperatorBuilder(MHO_OperatorToolbox *toolbox, MHO_ContainerStore *cstore=nullptr, MHO_ParameterStore *pstore=nullptr)
Definition: MHO_OperatorBuilder.hh:35
MHO_FringeData * fFringeData
Definition: MHO_OperatorBuilder.hh:138
void SetFringeData(MHO_FringeData *fdata)
Setter for fringe data.
Definition: MHO_OperatorBuilder.hh:54
virtual bool Build()=0
Builds the object and passes it to toolbox if successful, otherwise returns false.
void SetContainerStore(MHO_ContainerStore *cstore)
Setter for container store.
Definition: MHO_OperatorBuilder.hh:68
std::vector< std::string > GetMatchingStationIdentifiers() const
Definition: MHO_OperatorBuilder.hh:208
bool StationMatchesCurrentBaseline(const std::string &station_id) const
Definition: MHO_OperatorBuilder.hh:198
std::vector< std::string > ExtractAllStationIdentifiers() const
Definition: MHO_OperatorBuilder.hh:147
mho_json fAttributes
Definition: MHO_OperatorBuilder.hh:225
Class MHO_ParameterStore.
Definition: MHO_ParameterStore.hh:52
XValueType GetAs(const std::string &value_path) const
Function IsPresent.
Definition: MHO_ParameterStore.hh:292
Definition: MHO_AdhocFlagging.hh:18
struct token_struct * tokens
Definition: parse_control_file.c:26