Compiles a list of adjacent elements for the specified element.
struct resbuf
*tpm_elemadj(
ade_id tpm_id,
ade_id elem_id,
int adj_type);
Returns a list of element IDs or NULL.
| tpm_id | The topology ID. |
| elem_id | An element ID, received from tpm_elemid. |
| adj_type | The type of adjacent elements to be compiled into the list. Values can be: 1 (node), 2 (link), or 3 (polygon). |
The following sample populates a resbuf with adjacent elements, (links) on a network topology using tpm_elemadj(). If the operation is successful the adjacent id(s) are displayed, and the resbuf is released as required. Note, tpm_acopen() was used to obtain the loaded topology id and tpm_elemid() was used to obtain a specific element id within the loaded topology.
char* pszTopoName = "NetTopo";
int topoWriteAccess = 0;
ade_id topoId = tpm_acopen(pszTopoName, topoWriteAccess);
int adjElementType = 2;
long elementIndex = 1;
ade_id adjElementID = tpm_elemid(topoId, adjElementType, elementIndex);
struct resbuf* pAdjElementIdsRb = tpm_elemadj(topoId, adjElementID, adjElementType);
if (NULL != pAdjElementIdsRb){
struct resbuf* rb = pAdjElementIdsRb;
acutPrintf(
"\nThe specified element has an ID of %.0lf. The following adjacent ID(s) were detected:"
, adjElementID);
while(NULL != rb) {
acutPrintf(
"\n\t %.0lf"
, rb->resval.rreal);
rb = rb->rbnext;
}
}
else {
acutPrintf(
"\nNo adjacent elements were detected.");
}
acutRelRb(pAdjElementIdsRb);
tpm_acclose(topoId);


