cwFlowNet.h/cpp : Added set_variable_user_id().

This commit is contained in:
kevin 2024-10-14 14:16:14 -04:00
parent ee990fd628
commit 5ad56fe66c
2 changed files with 23 additions and 0 deletions

View File

@ -3116,6 +3116,9 @@ namespace cw
ui_var->value_tid = var->type; ui_var->value_tid = var->type;
ui_var->desc_flags = var->varDesc->flags; ui_var->desc_flags = var->varDesc->flags;
ui_var->desc_cfg = var->varDesc->cfg; ui_var->desc_cfg = var->varDesc->cfg;
ui_var->user_id = kInvalidId;
var->ui_var = ui_var;
} }
} }
@ -3314,6 +3317,23 @@ errLabel:
return rc; return rc;
} }
cw::rc_t cw::flow::set_variable_user_id( network_t&net, const ui_var_t* ui_var, unsigned user_id )
{
rc_t rc = kOkRC;
variable_t* var = nullptr;
if((rc = var_find( ui_var->ui_proc->proc, ui_var->vid, ui_var->ch_idx, var )) != kOkRC )
{
rc = cwLogError(rc,"User-Id assigned failed on '%s:%i' because the variable was not found.",cwStringNullGuard(ui_var->label),ui_var->label_sfx_id);
goto errLabel;
}
var->ui_var->user_id = user_id;
errLabel:
return rc;
}
cw::rc_t cw::flow::network_apply_preset( network_t& net, const char* preset_label, unsigned proc_label_sfx_id ) cw::rc_t cw::flow::network_apply_preset( network_t& net, const char* preset_label, unsigned proc_label_sfx_id )
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;

View File

@ -30,6 +30,9 @@ namespace cw
rc_t get_variable( network_t& net, const char* inst_label, const char* var_label, unsigned chIdx, proc_t*& instPtrRef, variable_t*& varPtrRef ); rc_t get_variable( network_t& net, const char* inst_label, const char* var_label, unsigned chIdx, proc_t*& instPtrRef, variable_t*& varPtrRef );
rc_t set_variable_user_id( network_t&net, const ui_var_t* ui_var, unsigned user_id );
template< typename T > template< typename T >
rc_t set_variable_value( network_t& net, const char* inst_label, const char* var_label, unsigned chIdx, T value ) rc_t set_variable_value( network_t& net, const char* inst_label, const char* var_label, unsigned chIdx, T value )
{ {