cwFlow.cpp : Added the system parameter 'preset' to apply a network preset prior to network runtime.

This commit is contained in:
kevin 2024-05-24 16:37:31 -04:00
parent d1ba6f76d7
commit 973b1bdd32

View File

@ -62,6 +62,7 @@ namespace cw
{ "list", &list::members }, { "list", &list::members },
{ "add", &add::members }, { "add", &add::members },
{ "preset", &preset::members }, { "preset", &preset::members },
{ "print", &print::members },
{ nullptr, nullptr } { nullptr, nullptr }
}; };
@ -714,13 +715,14 @@ cw::rc_t cw::flow::create( handle_t& hRef,
// parse the optional args // parse the optional args
if((rc = flowCfg->getv_opt("framesPerCycle", p->framesPerCycle, if((rc = flowCfg->getv_opt("framesPerCycle", p->framesPerCycle,
"sample_rate", p->sample_rate, "sample_rate", p->sample_rate,
"maxCycleCount", maxCycleCount, "maxCycleCount", maxCycleCount,
"multiPriPresetProbFl", p->multiPriPresetProbFl, "preset", p->init_net_preset_label,
"multiSecPresetProbFl", p->multiSecPresetProbFl, "multiPriPresetProbFl", p->multiPriPresetProbFl,
"multiPresetInterpFl", p->multiPresetInterpFl, "multiSecPresetProbFl", p->multiSecPresetProbFl,
"printClassDictFl", printClassDictFl, "multiPresetInterpFl", p->multiPresetInterpFl,
"printNetworkFl", printNetworkFl)) != kOkRC ) "printClassDictFl", printClassDictFl,
"printNetworkFl", printNetworkFl)) != kOkRC )
{ {
rc = cwLogError(kSyntaxErrorRC,"Error parsing the optional flow configuration parameters."); rc = cwLogError(kSyntaxErrorRC,"Error parsing the optional flow configuration parameters.");
goto errLabel; goto errLabel;
@ -756,7 +758,12 @@ cw::rc_t cw::flow::create( handle_t& hRef,
if( printNetworkFl ) if( printNetworkFl )
network_print(p->net); network_print(p->net);
if( p->init_net_preset_label != nullptr )
network_apply_preset( p->net, p->init_net_preset_label );
p->isInRuntimeFl = true; p->isInRuntimeFl = true;
cwLogInfo("Entering runtime.");
hRef.set(p); hRef.set(p);
errLabel: errLabel:
@ -832,6 +839,7 @@ cw::rc_t cw::flow::exec( handle_t h )
return rc; return rc;
} }
cw::rc_t cw::flow::apply_preset( handle_t h, const char* presetLabel ) cw::rc_t cw::flow::apply_preset( handle_t h, const char* presetLabel )
{ {
flow_t* p = _handleToPtr(h); flow_t* p = _handleToPtr(h);