cwDynRefTbl.h/cpp : Added new create() from file constructor.

This commit is contained in:
kevin 2024-11-17 16:14:30 -05:00
parent 7c645d6af9
commit a7b80e841a
2 changed files with 23 additions and 0 deletions

View File

@ -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;

View File

@ -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 );