Returns the ID of the selected element.
ade_id
tpm_traceelemid(
ade_id trace_id,
int type,
long index);
Returns an element ID or NULL.
trace_id | Tracing model ID (real) returned by tpm_tracealloc |
type | Element type: 1 Node 2 Link |
index | Element index. The first element's index is 0 |
This function returns the ID of the element selected. Use this function to find the trace result in the source topology after performing a trace with tpm_traceshort or tpm_traceflood.
The following sample opens a topology, performs a short path trace and gets the ID of the third link of the result path using tpm_traceelemid(). The topology Id for the corresponding link is displayed and the topology is unloaded.
char* pszTopoName = "NetTopo"; int topoWriteAccess = 0; int resultCode = tpm_acload(pszTopoName, NULL); ade_id topoId = tpm_acopen(pszTopoName, topoWriteAccess); ade_id traceId = tpm_tracealloc(topoId, NULL, NULL, NULL, NULL); ade_id startNode = 8.0; ade_id endNode = 13.0; resultCode = tpm_traceshort( traceId, startNode, endNode); int elementType = 2;// link long lLinkQuantity = 0; resultCode = tpm_traceqty( traceId, elementType, &lLinkQuantity;); long lLinkIndex = 2; ade_id linkId = tpm_traceelemid( traceId, elementType, lLinkIndex); if (ADE_NULLID != linkId) { acutPrintf("\nThe specified link at index, (%d) contained the topology Id of %.0lf." , lLinkIndex, linkId); } else { acutPrintf("\nThe specified link was not found."); } resultCode = tpm_acclose(topoId); resultCode = tpm_acunload(pszTopoName);