From e2aba9b9b78232872f149add39672c8f12133255 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 17 Nov 2024 16:16:16 -0500 Subject: [PATCH] cwFlowProc.h/cpp : Moved template default functions std_create(),std_destroy(),std_value(),std_exec(),std_report() from cwFlowProc.cpp to cwFlowProc.h. --- cwFlowProc.cpp | 31 +------------------------------ cwFlowProc.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 30 deletions(-) diff --git a/cwFlowProc.cpp b/cwFlowProc.cpp index 75df7ac..9bb9c36 100644 --- a/cwFlowProc.cpp +++ b/cwFlowProc.cpp @@ -18,6 +18,7 @@ #include "cwFlowDecl.h" #include "cwFlow.h" +#include "cwFlowValue.h" #include "cwFlowTypes.h" #include "cwFlowNet.h" #include "cwFlowProc.h" @@ -40,36 +41,6 @@ namespace cw namespace flow { - template< typename inst_t > - rc_t std_destroy( proc_t* proc ) - { - inst_t* p = (inst_t*)proc->userPtr; - rc_t rc = _destroy(proc,p); - mem::release(proc->userPtr); - return rc; - } - - template< typename inst_t > - rc_t std_create( proc_t* proc ) - { - rc_t rc = kOkRC; - proc->userPtr = mem::allocZ(); - if((rc = _create(proc,(inst_t*)proc->userPtr)) != kOkRC ) - std_destroy(proc); - return rc; - } - - template< typename inst_t > - rc_t std_value( proc_t* proc, variable_t* var ) - { return _value(proc,(inst_t*)proc->userPtr, var); } - - template< typename inst_t > - rc_t std_exec( proc_t* proc ) - { return _exec(proc,(inst_t*)proc->userPtr); } - - template< typename inst_t > - rc_t std_report( proc_t* proc ) - { return _report(proc,(inst_t*)proc->userPtr); } //------------------------------------------------------------------------------------------------------------------ diff --git a/cwFlowProc.h b/cwFlowProc.h index 3ec8641..483f9f4 100644 --- a/cwFlowProc.h +++ b/cwFlowProc.h @@ -2,6 +2,39 @@ namespace cw { namespace flow { + + template< typename inst_t > + rc_t std_destroy( proc_t* proc ) + { + inst_t* p = (inst_t*)proc->userPtr; + rc_t rc = _destroy(proc,p); + mem::release(proc->userPtr); + return rc; + } + + template< typename inst_t > + rc_t std_create( proc_t* proc ) + { + rc_t rc = kOkRC; + proc->userPtr = mem::allocZ(); + if((rc = _create(proc,(inst_t*)proc->userPtr)) != kOkRC ) + std_destroy(proc); + return rc; + } + + template< typename inst_t > + rc_t std_value( proc_t* proc, variable_t* var ) + { return _value(proc,(inst_t*)proc->userPtr, var); } + + template< typename inst_t > + rc_t std_exec( proc_t* proc ) + { return _exec(proc,(inst_t*)proc->userPtr); } + + template< typename inst_t > + rc_t std_report( proc_t* proc ) + { return _report(proc,(inst_t*)proc->userPtr); } + + namespace user_def_proc { extern class_members_t members; } namespace poly { extern class_members_t members; } namespace midi_in { extern class_members_t members; }