op_anim_macro_close()

Abstract

Closes the specified macro, prohibiting the addition of further operations via op_anim_mgp… or op_anim_mme… KP invocations (such KPs will effectively be null operations).

Syntax

op_anim_macro_close (anmid)
Argument Type Description
anmid Anmid macro ID
[An animation macro ID can be obtained when a macro is created via the KP op_anim_macro_create().]

Return Type

void

no return value

Example

/** Construct a macro which depicts a field within a packet. **/
mid = op_anim_macro_create ("pk field");

/* Draw a rectangle fixed at (X,Y) which has width(W) = no. bits(B) x 8 */
op_anim_mgp_reg_set (mid, OPC_ANIM_REG_C_INT, 8);
op_anim_mgp_arop (mid, OPC_ANIM_REG_B_INT, OPC_ANIM_AROP_MULTIPLY,
	OPC_ANIM_REG_C_INT, OPC_ANIM_REG_W_INT);
op_anim_mgp_rect_draw (mid, OPC_ANIM_COLOR_RED, OPC_ANIM_REG_X_INT,
	OPC_ANIM_REG_Y_INT, OPC_ANIM_REG_W_INT, 15);

/* Draw the field name at (L,Y) where L = X + (W / 2) */
op_anim_mgp_reg_set (mid, OPC_ANIM_REG_C_INT, 2);
op_anim_mgp_arop (mid, OPC_ANIM_REG_W_INT, OPC_ANIM_AROP_DIVIDE, OPC_ANIM_REG_C_INT,
	OPC_ANIM_REG_H_INT);
op_anim_mgp_arop (mid, OPC_ANIM_REG_X_INT, OPC_ANIM_AROP_ADD, OPC_ANIM_REG_H_INT,
	OPC_ANIM_REG_L_INT);
op_anim_mgp_text_draw (mid, OPC_ANIM_ALIGNH_CENTER | OPC_ANIM_ALIGNV_BOTTOM |
	OPC_ANIM_FONT_OPEN_10 | OPC_ANIM_COLOR_RED,
	OPC_ANIM_REG_L_INT, OPC_ANIM_REG_Y_INT, OPC_ANIM_REG_S_STR);
op_anim_macro_close (mid);

Details

Immediately after a macro has been created by the KP op_anim_macro_create(), it has open status: it can accept any number of references in op_anim_mgp… or op_anim_mme… KP invocations, appending the resulting macro requests to the end of the macro. Macros must stay open until all their component requests have been appended. Once a macro has been fully defined, it can be closed via this KP. Closing a macro prohibits further addition of requests.

Since invoking op_anim_macro_create() multiple times with the same macro name returns the same macro ID, and since invocations of op_anim_mgp… or op_anim_mme… KPs with the ID of a closed macro result in quiet null operations, definition of a macro shared by multiple processes and/or process instances can be accomplished by the “first author” invoking op_anim_macro_close() to seal the macro’s definition.

Purpose

Provides a mechanism for defining a macro as complete, so that a multiply-instantiated process model can define a macro without requiring special synchronization between its instances. The first instance of a process to define a macro will be successful, but all other instances will simply rendezvous with the original definition.

Errors

  • Recoverable Error: Animation macro ID (<anmid>) is out-of-range. (due to an invalid value for the anmid argument)

Reference

  • Use the KP op_anim_macro_create() to create a new empty macro
  • Use the KP op_anim_macro_destroy() to deallocate the memory associated with a macro which is no longer in use
  • Use the op_anim_mgp… KPs to add animation requests to an existing macro

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · Documentation compiled and provided by Beijing ZNetLink Technology Co., Ltd.

交流群 · QQ Group:OPNET/智网妙算网络仿真交流群(群号 486383494)

原文档 © 2017 Riverbed Technology · 本站为公益翻译,由 AI 辅助完成,请仔细甄别

Original documentation © 2017 Riverbed Technology. Community translation, AI-assisted. Contact: jiazequn@znetlink.com