APIDb_​GetHotlinkNodeTreeID

Retrieves the tree structure under a given hotlink node.

    GSErrCode ACAPI_Database (
        APIDb_GetHotlinkNodeTreeID,
        const API_Guid*                                    hotlinkNodeGuid,
        GS::HashTable<API_Guid,GS::Array<API_Guid>>*       hotlinkNodeTree
    );

 

Parameters

hotlinkNodeGuid
[in] Guid of the parent node
hotlinkNodeTree
[out] the tree structure under the given parent node

 

Return Values

NoError
The function has completed with success.
APIERR_BADPARS
any of the parameters is nullptr

For other common API errors see the API Errors document.

 

Remarks

This function helps to explore the nested node hierarchy of hotlinks used in the project. The structure is presented in a hashtable of parent node and array of children nodes pairs.

The top node of the tree is defined by the hotlinkNodeGuid parameter, which is usually either the Hotlink Module type or the XRef type hotlink root node (these can be retrieved with the APIDb_GetHotlinkRootNodeGuidID function), however it can be any of the nodes when only a sub-tree is requested.

 

Example


API_HotlinkTypeID type = APIHotlink_Module;
API_Guid hotlinkRootNodeGuid = APINULLGuid;
if (ACAPI_Database (APIDb_GetHotlinkRootNodeGuidID, &type, &hotlinkRootNodeGuid) == NoError) {
    GS::HashTable<API_Guid, GS::Array<API_Guid> > hotlinkNodeTree;
    if (ACAPI_Database (APIDb_GetHotlinkNodeTreeID, &hotlinkRootNodeGuid, &hotlinkNodeTree) == NoError) {
        if (hotlinkNodeTree.ContainsKey (hotlinkRootNodeGuid)) {
            ACAPI_WriteReport ("List of main level hotlink nodes:", false);
            const GS::Array<API_Guid>& nodeRefList = hotlinkNodeTree.Get (hotlinkRootNodeGuid);
            for (UInt32 i = 0; i < nodeRefList.GetSize (); i++) {
                char guidStr[64];
                APIGuid2GSGuid (nodeRefList[i]).ConvertToString (guidStr);
                ACAPI_WriteReport (guidStr, false);
            }
        } else {
            ACAPI_WriteReport ("No hotlink node was found", false);
        }
    }
}

 

Further hotlink-related code samples can be found in the Element_Test example add-on.

 

Requirements

Version: API 12 or later
Header: APIdefs_Database.h

 

See Also

APIDb_GetHotlinkNodeID
APIDb_GetHotlinkNodesID
APIDb_GetHotlinkRootNodeGuidID
APIDb_GetHotlinkInstancesID
ACAPI_Database
API Functions