op_anim_ime_npath_traverse()
Abstract
Depicts the traversal of a model path displayed in a viewer via a moving mark. Examples of paths include network links and node streams.
Syntax
op_anim_ime_npath_traverse (anvid, path_type, path_name, trav_id, trav_options, props, text)
| Argument | Type | Description |
|---|---|---|
anvid |
Anvid |
viewer ID [This value is a numeric identifier which references a viewer. The path traversal will be displayed in the viewer’s window.] |
path_type |
int |
path object type code |
path_name |
char* |
path name |
trav_id |
int |
traversal ID |
trav_options |
int |
traversal option flags |
props |
int |
graphical property flags [This value is the bitwise OR combination of symbolic constant flags listed under “Animation Graphical Property Symbolic Constants—Text Alignment“ on page 3.] |
text |
char* |
text associated with traversal |
Return Type
void
no return value
Example
/* Receive a cell on input stream. */
cell_ptr = op_pk_get (op_intrpt_strm ());
/* Extract ID & address information. */
op_pk_nfd_get (cell_ptr, "cell id", &cell_id);
op_pk_nfd_get (cell_ptr, "src_addr", &src_addr);
op_pk_nfd_get (cell_ptr, "dst_addr", &dst_addr);
/* Determine next hop of cell and forward. */
out_strm = cell_route_next_hop_port (dst_addr, local_id);
op_pk_send (cell_ptr, out_strm);
/* Animate cell’s transmission to next switch. */
sprintf (cell_data, "cell #%d: s(%d) d(%d)",
cell_id, src_addr, dst_addr);
op_anim_ime_npath_traverse (vid, OPC_ANIM_OBJTYPE_STREAM, strm_name [out_strm],
Trav_Id++, OPC_ANIM_TRAV_OPTION_CIRCLE | OPC_ANIM_TRAV_OPTION_FULL |
OPC_ANIM_TRAV_OPTION_TEXT, OPC_ANIM_COLOR_YELLOW, cell_data);
Details
Path traversals are affected by the color graphical property. The color graphical property of the moving mark can be assigned any of the 64 indexed color values (with the format OPC_ANIM_COLOR_RGB<rgb>) or the 25 named color values (the default color value is black).
The path_type argument should be passed a symbolic constant with the format OPC_ANIM_OBJTYPE_<type>, where possible values of <type> include SIMPLINK, DUPLINK, BUSLINK, and TAPLINK within network model diagrams, or STREAM and STATWIRE within node model diagrams.
There are several options available on path traversals, as specified by the bitwise OR combination of flags passed to the trav_options argument. Option flags have the format OPC_ANIM_TRAV_OPTION_<opt>, where the option values include: mark shape (either CIRCLE or SQUARE), text enabling (TEXT), traversal direction (REVERSE), and traversal scope (FULL—mark traverses complete path from source to destination, SRC_BEGIN—mark traverses from path source to midpoint, DST_END—mark traverses from path midpoint to destination). There are other advanced options that are primarily used by the automatic simulation features of the Simulation Kernel (these appear in Table 46 “Animation Path Traverse Option Symbolic Constants“ on page 9).
The trav_id argument is an integer value which uniquely identifies a specific traversal; this allows destination traversals to refer back to source traversals so that the appropriate marks are moved.
Purpose
Provides a mechanism for depicting movement of information (such as packets) through a network. Typically, this KP is applied to node stream or network link objects to depict messages flowing across such connections.
Errors
- Program Abort: segmentation violation (due to a badly formed string for the
path_nameortextarguments) - Diagnostic Error: Animation viewer ID (
<anvid>) is out-of-range. (due to an invalid value for theanvidargument) - Diagnostic Error: Kernel procedure argument (
<arg_name>) has out-of-range value (<arg_val>). (due to an invalid value for thepath_typeortrav_optionsarguments) - Diagnostic Error: Invalid property component (
<prop_comp>) for graphical primitive. (due to an inapplicable or invalid value for thepropsargument)
Reference
- Use the KP op_anim_ime_nmod_draw() to load and display a model within an animation viewer (this is required before model path objects can be traversed using op_anim_ime_npath_traverse())
- Use the KP op_anim_mme_nobj_pos() to determine the position of a model object within a macro, for use in displaying graphical figures in the proximity of the objects
- Use the KPs op_anim_viewer_open() or op_anim_viewer_open_std() to create an animation viewer and obtain its ID, or the KP op_anim_lprobe_anvid() to obtain the ID of a viewer opened by a labeled custom animation probe