GraphNodeDataPtr
Description
Get payload pointer through a GraphNode traversal handle.
Parameters
| Name | Direction | Description |
|---|---|---|
g |
in,out | Graph owning the node. |
node |
in | GraphNode handle to access. |
Success
Returns a pointer of type GRAPH_NODE_TYPE(g) * to the payload slot referenced by the handle. The graph is not modified. The pointer is valid until the slot is committed for deletion.
Failure
Does not return - aborts via LOG_FATAL for an invalid handle or graph/handle mismatch (caller bug).
Usage example (Cross-references)
Usage examples (Cross-references)
- In
Init.c:92:
node_id = GraphAddNodeL(&graph, name);
node = GraphGetNode(&graph, node_id);
stored_name = GraphNodeDataPtr(&graph, node);
bool result = GraphNodeIdIndex(node_id) == 0 && StrBegin(&name) != NULL && GraphNodeCount(&graph) == 1 &&- In
Init.c:116:
node_id = GraphAddNodeR(&graph, StrZ("alpha", &alloc));
node = GraphGetNode(&graph, node_id);
stored_name = GraphNodeDataPtr(&graph, node);
bool result = GraphNodeIdIndex(node_id) == 0 && GraphNodeCount(&graph) == 1 && StrBegin(stored_name) != NULL &&- In
Access.c:35:
node_b = GraphGetNode(&graph, b);
*GraphNodeDataPtr(&graph, node_b) = 25;
bool result = GraphNodeCount(&graph) == 3 && GraphEdgeCount(&graph) == 3 && !GraphEmpty(&graph);
Last updated on