From a7b80e841aa277f6a459687946e1dee3d0dc4174 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 17 Nov 2024 16:14:30 -0500 Subject: [PATCH] cwDynRefTbl.h/cpp : Added new create() from file constructor. --- cwDynRefTbl.cpp | 21 +++++++++++++++++++++ cwDynRefTbl.h | 2 ++ 2 files changed, 23 insertions(+) diff --git a/cwDynRefTbl.cpp b/cwDynRefTbl.cpp index a263c84..705f6ae 100644 --- a/cwDynRefTbl.cpp +++ b/cwDynRefTbl.cpp @@ -119,6 +119,27 @@ cw::rc_t cw::dyn_ref_tbl::create( handle_t& hRef, const object_t* cfg ) return rc; } +cw::rc_t cw::dyn_ref_tbl::create( handle_t& hRef, const char* cfg_fname ) +{ + rc_t rc; + object_t* cfg = nullptr; + + if((rc = objectFromFile( cfg_fname, cfg )) != kOkRC ) + { + cwLogError(rc,"Dynamics reference table parse cfg. parse failed on '%s'.",cwStringNullGuard(cfg_fname)); + goto errLabel; + } + + rc = create(hRef,cfg); + +errLabel: + cfg->free(); + + return rc; + +} + + cw::rc_t cw::dyn_ref_tbl::destroy( handle_t& hRef ) { rc_t rc = kOkRC; diff --git a/cwDynRefTbl.h b/cwDynRefTbl.h index f78bb43..7e90584 100644 --- a/cwDynRefTbl.h +++ b/cwDynRefTbl.h @@ -17,6 +17,8 @@ namespace cw // Parse object like: [ { mark:<> level:<>, vel:<> } ] rc_t create( handle_t& hRef, const object_t* cfg ); + rc_t create( handle_t& hRef, const char* cfg_fname ); + rc_t destroy( handle_t& hRef ); const char* level_to_marker( handle_t h, unsigned level );