From 9e7ab2f36724c86ced833968413394d6beef24c4 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 11 Dec 2021 15:17:11 -0500 Subject: [PATCH] cwFlowTypes.h/cpp : Added external_device_t. --- cwFlowTypes.cpp | 15 +++++++++++++-- cwFlowTypes.h | 15 +++++++++++---- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/cwFlowTypes.cpp b/cwFlowTypes.cpp index 702ef47..19b29e0 100644 --- a/cwFlowTypes.cpp +++ b/cwFlowTypes.cpp @@ -7,6 +7,7 @@ #include "cwVectOps.h" #include "cwMtx.h" #include "cwDspTypes.h" // real_t, sample_t +#include "cwFlow.h" #include "cwFlowTypes.h" @@ -1049,6 +1050,16 @@ cw::rc_t cw::flow::instance_find( flow_t* p, const char* inst_label, instance_t* return cwLogError(kInvalidArgRC,"The instance '%s' was not found.", inst_label ); } +cw::flow::external_device_t* cw::flow::external_device_find( flow_t* p, const char* device_label, unsigned typeId, unsigned inOrOutFl ) +{ + for(unsigned i=0; ideviceN; ++i) + if( cw::textIsEqual(p->deviceA[i].label,device_label) && p->deviceA[i].typeId==typeId && cwIsFlag(p->deviceA[i].flags,inOrOutFl )) + return p->deviceA + i; + + cwLogError(kInvalidArgRC,"The %s device named '%s' could not be found.", cwIsFlag(inOrOutFl,kInFl) ? "in" : "out", device_label ); + + return nullptr; +} void cw::flow::instance_print( instance_t* inst ) { @@ -1060,10 +1071,10 @@ void cw::flow::instance_print( instance_t* inst ) if( inst->class_desc->members->report ) inst->class_desc->members->report( inst ); - - } + + void cw::flow::_var_destroy( variable_t* var ) { if( var != nullptr ) diff --git a/cwFlowTypes.h b/cwFlowTypes.h index f649a86..c34e341 100644 --- a/cwFlowTypes.h +++ b/cwFlowTypes.h @@ -193,7 +193,9 @@ namespace cw variable_t** varMapA; // varMapA[ varMapN ] struct instance_str* link; - } instance_t; + } instance_t; + + typedef struct flow_str { @@ -205,6 +207,9 @@ namespace cw class_desc_t* classDescA; // unsigned classDescN; // + + external_device_t* deviceA; // deviceA[ deviceN ] external device description array + unsigned deviceN; // struct instance_str* network_head; // first instance struct instance_str* network_tail; // last insance @@ -254,9 +259,11 @@ namespace cw // Instance // - instance_t* instance_find( flow_t* p, const char* inst_label ); - rc_t instance_find( flow_t* p, const char* inst_label, instance_t*& instPtrRef ); - void instance_print( instance_t* inst ); + instance_t* instance_find( flow_t* p, const char* inst_label ); + rc_t instance_find( flow_t* p, const char* inst_label, instance_t*& instPtrRef ); + external_device_t* external_device_find( flow_t* p, const char* device_label, unsigned typeId, unsigned inOrOutFl ); + + void instance_print( instance_t* inst ); //------------------------------------------------------------------------------------------------------------------------ //