HPS::HCA::Model

class HPS::HCA::Model

The Model class provides interactions with a HCA Model

Public Functions

bool Empty()

Checks the state of the Model.

Returns

true if this Model is uninitialized, false otherwise.

bool Equals(Model const &other) const

Check if the source Model is equivalent to this Model.

Parameters

other – The source Model to compare to this Model.

Returns

true if the objects are equivalent, false otherwise.

void Hide(HPS::Canvas const &in_canvas, int64_t in_node_id)

Hides the specified node under the given Canvas. This makes the selected node invisible. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_canvas – The Canvas in which to hide the node.

  • in_node_id – The ID of the node to be hidden

void Highlight(HPS::Canvas const &in_canvas, HighlightOptionsKit const &in_highlight_options, HPS::Int64Array const &in_node_ids)

Highlights the specified nodes under the given Canvas, using the options provided. All specified nodes will be highlighted using the same options. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_canvas – The Canvas in which to highlight the nodes.

  • in_highlight_options – The options to be used when highlighting in_node_ids.

  • in_node_ids – an array of node IDs to be highlighted

void Highlight(HPS::Canvas const &in_canvas, HighlightOptionsKit const &in_highlight_options, int64_t in_node_id)

Highlights the specified node under the given Canvas, using the options provided. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_canvas – The Canvas in which to highlight the node.

  • in_highlight_options – The options to be used when highlighting in_node_id.

  • in_node_id – The ID of the node to be highlighted

bool IsHidden(int64_t in_node_id)

Checks whether the given node is currently Hidden as a result of a Hide or Isolate operation. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters

in_node_id – The ID of the node to examine.

Returns

true if the node is hidden, false otherwise.

bool IsHighlighted(int64_t in_node_id)

Checks whether the given node is currently highlighted. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters

in_node_id – The ID of the node to examine.

Returns

true if the node is highlighted, false otherwise.

void Isolate(HPS::Canvas const &in_canvas, int64_t in_node_id)

Shows only the specified node and hides the rest. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_canvas – The Canvas in which to isolate the node.

  • in_node_id – The ID of the node to isolate.

Model()

Constructs an uninitialized HCA::Model.

Model(HPS::Model const &in_model)

Constructs a HCA::Model under an existing HPS::Model.

Parameters

in_model – the HPS::Model under which to create an HCA::Model.

Model(Model &&that)

The move constructor creates an HCA::Model by transferring the underlying object of the rvalue reference to this HCA::Model.

Parameters

in_that – An rvalue reference to an HCA::Model to take the underlying object from.

Model(Model const &that)

Copy constructor. This constructor creates an HCA::Model which shares the same resources of the source HCA::Model.

Parameters

in_that – The source HCA::Model to copy.

void OnHighlightUnhighlight()

This convenience function performs the HCA::ModelTreeItem::OnHighlightUnhighlight function on the root item of the Model Tree See the description of HCA::ModelTreeItem::OnHighlightUnhighlight for more information.

bool operator!=(Model const &other) const

Check if the source Model is not equivalent to this Model.

Parameters

other – The source Model to compare to this Model.

Returns

true if the objects are not equivalent, false otherwise.

Model &operator=(Model &&other)

Copies the source Model into this Model.

Parameters

other – The source Model to copy.

Returns

A reference to this Model.

bool operator==(Model const &other) const

Check if the source Model is equivalent to this Model.

Parameters

other – The source Model to compare to this Model.

Returns

true if the objects are equivalent, false otherwise.

bool RequestNodeProperties(int64_t in_node_id, uint32_t &out_request_id)

Requests properties for the specified node. throws HPS::InvalidObjectException is the Model is uninitialized. When the request has been fulfilled, an event of type HCA::RequestIdEvent will be injected to the Database’s Event Dispatcher. Registering a handler to HCA::RequestIdEvent will allow the user to know when this request has completed. The value of HCA::RequestIdEvent::request_id object will match out_requested_id, returned by this function.

Parameters
  • in_node_id – the ID for the node whose properties should be collected.

  • out_request_id – an ID which uniquely identifies this request

Returns

true if the node’s properties were gathered successfully, false otherwise.

bool RetrieveNodeProperties(uint32_t in_request_id, uint32_t in_timeout_ms, int64_t &out_node_id, bool &out_valid, HPS::UTF8Array &out_keys, HPS::UTF8Array &out_values)

Retrieves previously requested properties throws HPS::InvalidObjectException is the Model is uninitialized. Before retrieving properties, you should request them, using RequestNodeProperties. This function waits for the requested property to become available If your model’s properties are not changing, it is sufficient to call RequestNodeProperties just once for each node ID of interest. Each property is returned as a pair or key and value. The out_keys and out_values parameters are two parallel arrays containing respectively the key and value of each property.

Parameters
  • in_request_id – a unique ID representing a request for properties. This value is obtained through a call to RequestNodeProperties.

  • in_timeout_ms – the maximum amount of time to wait while trying to retrieve the node properties, specified in milliseconds. Passing 0 means that the function will wait indefinitely until it can retrieve the properties.

  • out_node_id – the ID of the node for which properties are being returned.

  • out_valid – whether the returned properties are valid.

  • out_keys – the property keys. Each entry in this array corresponds to the entry at the same index in the out_values array.

  • out_values – the property values. Each entry in this array corresponds to the entry at the same index in the out_keys array.

Returns

true if the node’s properties were retrieved successfully, false otherwise.

void Show(HPS::Canvas const &in_canvas, int64_t in_node_id)

Shows the specified node under the given Canvas. This makes the selected node visible. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_canvas – The Canvas in which to show the node.

  • in_node_id – The ID of the node to be shown

void ShowAll(HPS::Canvas const &in_canvas)

Shows all nodes in the model, under the specified Canvas. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters

in_canvas – The Canvas in which to show the nodes.

bool ShowNodeChildren(int64_t in_node_id, HPS::Int64Array &out_ids)

Shows the IDs of the children of the requested node. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_node_id – the ID for the node whose children should be shown

  • out_ids – an array of IDs representing the children of in_node_id.

Returns

true if the node’s children were found successfully, false otherwise.

bool ShowNodeFromKeyPath(HPS::KeyPath const &in_key_path, int64_t &out_node_id)

Given a KeyPath, the associated node ID is returned.

Parameters
  • in_key_path – the key path for which a node ID is being requested

  • out_node_id – the node ID that corresponds to in_key_path

Returns

true if the node ID is associated to in_key_path, false otherwise.

bool ShowNodeName(int64_t in_node_id, HPS::UTF8 &out_name)

Shows the name for the requested node. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_node_id – the ID for the node whose name should be shown

  • out_name – the name of in_node_id, in the UTF8 locale. Might be an empty UTF8 object.

Returns

true if the node name was found successfully, false otherwise.

bool ShowNodeParent(int64_t in_node_id, int64_t &out_parent_id)

Shows the ID of the parent of the requested node. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_node_id – the ID for the node whose parent should be shown

  • out_parent_id – the ID representing the parent of in_node_id. Might be an empty array

Returns

true if the node’s parent was found successfully, false otherwise.

bool ShowRootNode(int64_t &out_node_id)

Shows the node ID for the root node of the Model. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters

out_node_id – the node ID for the root node of the Model.

Returns

true if the root node ID was found, false otherwise.

void Unhighlight(HPS::Canvas const &in_canvas, int64_t in_node_id)

Unhighlights the specified node under the given Canvas. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_canvas – The Canvas in which to unhighlight the node.

  • in_node_id – The ID of the node to be unhighlighted

void UnhighlightAll(HPS::Canvas const &in_canvas)

Unhighlights all nodes in the model, under the specified Canvas. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters

in_canvas – The Canvas in which to unhighlight the nodes.

void Zoom(HPS::Canvas const &in_canvas, int64_t in_node_id)

Smoothly zooms the camera to focus on the specified node. The transition lasts half a second. throws HPS::InvalidObjectException is the Model is uninitialized.

Parameters
  • in_canvas – The Canvas in which to zoom to the node.

  • in_node_id – The ID of the node to zoom to.

~Model()