2024-12-01 19:35:24 +00:00
|
|
|
//| Copyright: (C) 2020-2024 Kevin Larke <contact AT larke DOT org>
|
|
|
|
//| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
|
2024-06-10 20:39:17 +00:00
|
|
|
#ifndef cwIoFlowCtl_H
|
|
|
|
#define cwIoFlowCtl_H
|
|
|
|
|
|
|
|
namespace cw
|
|
|
|
{
|
|
|
|
namespace io_flow_ctl
|
|
|
|
{
|
|
|
|
|
|
|
|
typedef handle< struct io_flow_ctl_str > handle_t;
|
|
|
|
|
|
|
|
rc_t create( handle_t& hRef, io::handle_t ioH, const char* flow_cfg_fn );
|
|
|
|
rc_t create( handle_t& hRef, io::handle_t ioH, const object_t* flow_cfg );
|
|
|
|
rc_t destroy( handle_t& hRef );
|
|
|
|
|
2024-09-20 22:16:28 +00:00
|
|
|
// Query the available programs from the 'flow_cfg' file.
|
2024-06-10 20:39:17 +00:00
|
|
|
unsigned program_count( handle_t h);
|
|
|
|
const char* program_title( handle_t h, unsigned pgm_idx );
|
|
|
|
unsigned program_index( handle_t h, const char* pgm_title);
|
2024-09-20 22:16:28 +00:00
|
|
|
|
|
|
|
// Create the parse the program but do not instantiate the network.
|
2024-06-10 20:39:17 +00:00
|
|
|
rc_t program_load( handle_t h, unsigned pgm_idx );
|
|
|
|
|
|
|
|
// Return the index of the currently loaded program or kInvalidIdx if no program is loaded.
|
|
|
|
unsigned program_current_index( handle_t h );
|
|
|
|
|
|
|
|
// Is the currently loaded program in non-real-time mode
|
|
|
|
bool is_program_nrt( handle_t h );
|
|
|
|
|
2024-09-20 22:16:28 +00:00
|
|
|
// Return the count of network presets and the associated labels for the currently loaded program.
|
|
|
|
unsigned program_preset_count( handle_t h );
|
|
|
|
const char* program_preset_title( handle_t h, unsigned preset_idx );
|
|
|
|
|
|
|
|
// Create the network and prepare to enter runtime.
|
|
|
|
rc_t program_initialize( handle_t h, unsigned preset_idx=kInvalidIdx );
|
2024-09-21 21:18:46 +00:00
|
|
|
bool program_is_initialized( handle_t h );
|
2024-10-12 19:30:20 +00:00
|
|
|
|
|
|
|
// Get the UI description data structures for the current program.
|
|
|
|
const flow::ui_net_t* program_ui_net( handle_t h );
|
2024-09-20 22:16:28 +00:00
|
|
|
|
2024-06-10 20:39:17 +00:00
|
|
|
// Execute the currently loaded non-real-time program to completion.
|
|
|
|
rc_t exec_nrt( handle_t h );
|
|
|
|
|
2024-09-20 22:16:28 +00:00
|
|
|
// Handle an incoming IO msg. This is the main point of entry for executing
|
|
|
|
// real-time programs.
|
2024-06-10 20:39:17 +00:00
|
|
|
rc_t exec( handle_t h, const io::msg_t& msg );
|
|
|
|
|
2024-09-20 22:16:28 +00:00
|
|
|
// Is the current program loaded, initialized and not yet complete.
|
2024-07-01 14:35:24 +00:00
|
|
|
bool is_executable( handle_t h );
|
2024-09-20 22:16:28 +00:00
|
|
|
|
|
|
|
// The current program has completed.
|
2024-07-01 14:35:24 +00:00
|
|
|
bool is_exec_complete( handle_t h );
|
|
|
|
|
2024-10-12 19:30:20 +00:00
|
|
|
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, bool& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, int& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, unsigned& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, float& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, double& value_ref );
|
|
|
|
rc_t get_variable_value( handle_t h, const flow::ui_var_t* ui_var, const char*& value_ref );
|
|
|
|
|
|
|
|
template< typename T >
|
|
|
|
rc_t get_variable( handle_t h, const flow::ui_var_t* ui_var, T& value_ref )
|
|
|
|
{ return get_variable_value(h,ui_var,value_ref); }
|
|
|
|
|
2024-10-14 18:22:51 +00:00
|
|
|
rc_t set_variable_user_id( handle_t h, const flow::ui_var_t* ui_var, unsigned user_id );
|
|
|
|
|
2024-10-12 19:30:20 +00:00
|
|
|
rc_t set_variable_value( handle_t h, const flow::ui_var_t* ui_var, bool value );
|
|
|
|
rc_t set_variable_value( handle_t h, const flow::ui_var_t* ui_var, int value );
|
|
|
|
rc_t set_variable_value( handle_t h, const flow::ui_var_t* ui_var, unsigned value );
|
|
|
|
rc_t set_variable_value( handle_t h, const flow::ui_var_t* ui_var, float value );
|
|
|
|
rc_t set_variable_value( handle_t h, const flow::ui_var_t* ui_var, double value );
|
|
|
|
rc_t set_variable_value( handle_t h, const flow::ui_var_t* ui_var, const char* value );
|
|
|
|
|
|
|
|
template< typename T >
|
|
|
|
rc_t set_variable( handle_t h, const flow::ui_var_t* ui_var, T value )
|
|
|
|
{ return set_variable_value(h,ui_var,value); }
|
|
|
|
|
2024-06-10 20:39:17 +00:00
|
|
|
void report( handle_t h );
|
|
|
|
void print_network( handle_t h );
|
2024-10-12 19:30:20 +00:00
|
|
|
|
|
|
|
|
2024-06-10 20:39:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|