From 5ad56fe66cea2980985f3705ba42d0e5fb98889f Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 14 Oct 2024 14:16:14 -0400 Subject: [PATCH] cwFlowNet.h/cpp : Added set_variable_user_id(). --- cwFlowNet.cpp | 20 ++++++++++++++++++++ cwFlowNet.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/cwFlowNet.cpp b/cwFlowNet.cpp index 96cb24f..4fd94fd 100644 --- a/cwFlowNet.cpp +++ b/cwFlowNet.cpp @@ -3116,6 +3116,9 @@ namespace cw ui_var->value_tid = var->type; ui_var->desc_flags = var->varDesc->flags; ui_var->desc_cfg = var->varDesc->cfg; + ui_var->user_id = kInvalidId; + + var->ui_var = ui_var; } } @@ -3314,6 +3317,23 @@ errLabel: 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 ) { rc_t rc = kOkRC; diff --git a/cwFlowNet.h b/cwFlowNet.h index a9c87b6..f1dc091 100644 --- a/cwFlowNet.h +++ b/cwFlowNet.h @@ -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 set_variable_user_id( network_t&net, const ui_var_t* ui_var, unsigned user_id ); + + template< typename T > rc_t set_variable_value( network_t& net, const char* inst_label, const char* var_label, unsigned chIdx, T value ) {