cwFlowTypes.h/cpp : Added external_device_t.

This commit is contained in:
kevin 2021-12-11 15:17:11 -05:00
parent 869d367ed9
commit 9e7ab2f367
2 changed files with 24 additions and 6 deletions

View File

@ -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; i<p->deviceN; ++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 )

View File

@ -195,6 +195,8 @@ namespace cw
struct instance_str* link;
} instance_t;
typedef struct flow_str
{
const object_t* cfg;
@ -206,6 +208,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
} flow_t;
@ -256,6 +261,8 @@ namespace cw
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 );
//------------------------------------------------------------------------------------------------------------------------