cwFlowTypes.h/cpp : Added var_send_to_ui().
This included the addition of ui_var_head/stub/tail and ui_callback to flow_t and the ui_var and ui_var_link to variable_t.
This commit is contained in:
parent
5ad56fe66c
commit
805451d4d3
@ -2438,6 +2438,34 @@ errLabel:
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cw::rc_t cw::flow::var_send_to_ui( variable_t* var )
|
||||||
|
{
|
||||||
|
|
||||||
|
// var->ui_var_link is set to null when the var is removed from the list
|
||||||
|
|
||||||
|
// 1. Atomically set _head to the new node and return 'old-head'
|
||||||
|
variable_t* prev = var->proc->ctx->ui_var_head.exchange(var,std::memory_order_acq_rel);
|
||||||
|
|
||||||
|
// Note that at this point only the new node may have the 'old-head' as it's predecssor.
|
||||||
|
// Other threads may therefore safely interrupt at this point.
|
||||||
|
|
||||||
|
// 2. Set the old-head next pointer to the new node (thereby adding the new node to the list)
|
||||||
|
prev->ui_var_link.store(var,std::memory_order_release); // RELEASE 'next' to consumer
|
||||||
|
|
||||||
|
return kOkRC;
|
||||||
|
}
|
||||||
|
|
||||||
|
cw::rc_t cw::flow::var_send_to_ui( proc_t* proc, unsigned vid, unsigned chIdx )
|
||||||
|
{
|
||||||
|
rc_t rc = kOkRC;
|
||||||
|
variable_t* var = nullptr;
|
||||||
|
|
||||||
|
if((rc = var_find(proc, vid, chIdx, var )) == kOkRC )
|
||||||
|
rc = var_send_to_ui(var);
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
cw::rc_t cw::flow::var_register_and_set( proc_t* proc, const char* var_label, unsigned sfx_id, unsigned vid, unsigned chIdx, variable_t*& varRef )
|
cw::rc_t cw::flow::var_register_and_set( proc_t* proc, const char* var_label, unsigned sfx_id, unsigned vid, unsigned chIdx, variable_t*& varRef )
|
||||||
{
|
{
|
||||||
return var_register( proc, var_label, sfx_id, vid, chIdx, nullptr, varRef );
|
return var_register( proc, var_label, sfx_id, vid, chIdx, nullptr, varRef );
|
||||||
|
@ -222,6 +222,8 @@ namespace cw
|
|||||||
struct variable_str* dst_tail; //
|
struct variable_str* dst_tail; //
|
||||||
struct variable_str* dst_link; // Link used by dst_head list.
|
struct variable_str* dst_link; // Link used by dst_head list.
|
||||||
|
|
||||||
|
ui_var_t* ui_var; // this variables UI description
|
||||||
|
std::atomic<struct variable_str*> ui_var_link; // UI update var link based on flow_t ui_var_head;
|
||||||
} variable_t;
|
} variable_t;
|
||||||
|
|
||||||
|
|
||||||
@ -377,7 +379,14 @@ namespace cw
|
|||||||
network_preset_t* presetA; // presetA[presetN] partial (label and tid only) parsing of the network presets
|
network_preset_t* presetA; // presetA[presetN] partial (label and tid only) parsing of the network presets
|
||||||
unsigned presetN; //
|
unsigned presetN; //
|
||||||
|
|
||||||
network_t* net;
|
network_t* net; // The root of the network instance
|
||||||
|
|
||||||
|
ui_callback_t ui_callback;
|
||||||
|
void* ui_callback_arg;
|
||||||
|
|
||||||
|
std::atomic<variable_t*> ui_var_head; // Linked lists of var's to send to the UI
|
||||||
|
variable_t ui_var_stub;
|
||||||
|
variable_t* ui_var_tail;
|
||||||
|
|
||||||
} flow_t;
|
} flow_t;
|
||||||
|
|
||||||
@ -548,6 +557,10 @@ namespace cw
|
|||||||
// Get all the label-sfx-id's associated with a give var label
|
// Get all the label-sfx-id's associated with a give var label
|
||||||
rc_t var_mult_sfx_id_array( proc_t* proc, const char* var_label, unsigned* idA, unsigned idAllocN, unsigned& idN_ref );
|
rc_t var_mult_sfx_id_array( proc_t* proc, const char* var_label, unsigned* idA, unsigned idAllocN, unsigned& idN_ref );
|
||||||
|
|
||||||
|
// Send a variable value to the UI
|
||||||
|
rc_t var_send_to_ui( variable_t* var );
|
||||||
|
rc_t var_send_to_ui( proc_t* proc, unsigned vid, unsigned chIdx );
|
||||||
|
|
||||||
//-----------------
|
//-----------------
|
||||||
//
|
//
|
||||||
// var_register
|
// var_register
|
||||||
|
Loading…
Reference in New Issue
Block a user