tpm_infobuildvar

Land Desktop Development ARX CPP SDK

Up a level
tpm_infobuildvar
 
 

Gets the configuration values of a topology.

int

tpm_infobuildvar(

ade_id tpm_id,

ade_id var_id);

Returns RTNORM or an error code.

tpm_id Topology ID.
var_id Topology variables ID.

The topology variables ID references a set of topology variables in which to store the values that this function gets.

If no topology variables are allocated, call tpm_varalloc to allocate a set of them and return their ID.

To read the values that this function gets, use tpm_varget or tpm_varlist. To build a new topology using these variables, use tpm_mntbuild.

The following sample opens a topology, reads its configuration values using tpm_infobuildvar(), and gets its node layer. The topology is then closed, unloaded and the resbuf is released as required.

char* pszTopoName = "I-95_Corridor";
int resultCode = tpm_acload(pszTopoName, 0);
ade_id topoId = tpm_acopen(pszTopoName, 0);
ade_id topoConfigVarId = tpm_varalloc();
resultCode = tpm_infobuildvar(
                topoId,
                topoConfigVarId);

char* pszConfigVarName = "NODE_LAYER";
struct resbuf* pConfigVarsRb = acutBuildList(RTSTR, "", 0);
resultCode = tpm_varget(
                topoConfigVarId,
                pszConfigVarName,
                pConfigVarsRb);
if (RTNORM == resultCode){
    acutPrintf(
    "\nThe %s variable in the %s topology contains the value \"%s\"."
    , pszConfigVarName, pszTopoName, pConfigVarsRb->resval.rstring);
}
else {
    acutPrintf(
        "\nCould not determine the %s variable value."
        , pszConfigVarName);
}
resultCode = tpm_acclose(topoId);
resultCode = tpm_acunload(pszTopoName);
acutRelRb(pConfigVarsRb);