cwFlowProc.h/cpp : Moved template default functions std_create(),std_destroy(),std_value(),std_exec(),std_report() from cwFlowProc.cpp to cwFlowProc.h.

This commit is contained in:
kevin 2024-11-17 16:16:16 -05:00
parent a7b80e841a
commit e2aba9b9b7
2 changed files with 34 additions and 30 deletions

View File

@ -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<inst_t>();
if((rc = _create(proc,(inst_t*)proc->userPtr)) != kOkRC )
std_destroy<inst_t>(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); }
//------------------------------------------------------------------------------------------------------------------

View File

@ -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<inst_t>();
if((rc = _create(proc,(inst_t*)proc->userPtr)) != kOkRC )
std_destroy<inst_t>(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; }