Other node attributes

<< Click to Display Table of Contents >>

Navigation:  Using SMILE > Anatomy of a node >

Other node attributes

Node’s attributes not related to inference are grouped in the DSL_nodeInfo object, accessible through DSL_node::Info method. In turn, the DSL_nodeInfo provides access to the following objects:

header: textual attributes, like node identifier, name and description, through DSL_nodeInfo::Header method returning a reference to DSL_header object.

screen information: position, colors, border thickness, etc., through DSL_nodeInfo::Screen method returning a reference to DSL_screenInfo object.

user properties: a list of key/value pairs used for application-specific purposes, through DSL_nodeInfo::UserProperties method returning a reference to DSL_userProperties object.

int nodeHandle = …;

DSL_node *node = net.GetNode(nodeHandle);

DSL_nodeInfo &info = node->Info();

printf("Node name: %s\n", info.Header().GetName());

const DSL_rectangle &pos = info.Screen().position;

printf("Node center: (%d, %d), size: (%d,%d)\n",

pos.center_X, pos.center_Y,

pos.width, pos.height);

Note that for convenience DSL_node allows direct read access to its identifier by DSL_node::GetId method, which calls Info().Header().GetId().