Ets_Nt_Clipboard_Paste_Echo_Objects_Get()

Note: Requires OPNET Development Kit

Abstract

Gets the clipboard copy of a pasted object and copies of any objects originally attached to the object.

Syntax

Ets_Nt_Clipboard_Paste_Echo_Objects_Get (installed_obj_hndl, connected_echo_obj_lptr)
Argument Type Description
installed_obj_hndl EtsT_Obj_Handle Handle to a just-pasted clipboard object
connected_echo_obj_lptr EtsT_Obj_List * Pointer to list for returning copies of connected objects

Return Type

EtsT_Obj_Handle

Handle to the clipboard copy of the installed object.

ets_api_nt_cback.h

Details

This function returns a handle to the clipboard object that corresponds to the specified object (installed_obj_hndl) that was just installed as the result of a paste operation. The returned object handle is valid only if the function is called from a callback function registered with Ets_Nt_Object_Install_Callback_Register() and the object specified by installed_obj_hndl is one of the objects being installed.

If an empty, initialized object list is passed via connected_echo_obj_lptr, this function also returns “echos” of the objects that were originally attached to the returned clipboard object. These echo objects are copies of the original objects, with the same set of attributes, but do not belong to any network model. Some of these echo objects might also be in the clipboard (and pasted alongside the specified object), but others might be kept purely for this function.

One use for these echo objects is to access protocol-specific attributes on the original endpoints of a pasted link. For example:

. . .
Ets_Nt_Object_Install_Callback_Register (install_callback, OPC_NIL);
. . .

static void
install_callback (EtsT_Obj_Handle *obj_array, int array_size, void *state_ptr, EtsT_Nt_Object_Install_Src source)
   {
   FIN (install_callback);

   for (int i = 0; i < array_size; i++)
      {
      /* Get next valid installed object */
      EtsT_Obj_Handle pasted_obj_hndl = obj_array [i];
      if (Ets_Obj_Invalid (pasted_obj_hndl))
         continue;

      /* Find the desired link object */
      char name [VOSC_STR_LEN];
      Ets_Obj_Attr_Get (pasted_obj_hndl, "name", name);
      if (name != "my_link")
         continue;

      /* Get clipboard echo objects for the desired link object */
      EtsT_Obj_Handle src_link_hndl;
      EtsT_Obj_List *src_nodes_lptr = Ets_Obj_List_Create ();
      src_link_hndl = Ets_Nt_Clipboard_Paste_Echo_Objects_Get (pasted_obj_hndl, src_nodes_lptr);

      /* Get source nodes */
      EtsT_Obj_Handle src_node_a_hndl = Ets_Obj_List_Object_Get (src_nodes_lptr, 0);
      EtsT_Obj_Handle src_node_b_hndl = Ets_Obj_List_Object_Get (src_nodes_lptr, 1);

      /* Process as needed */
      . . .

      Ets_Obj_List_Destroy (src_nodes_lptr);
      }

   FOUT;
   }

本站文档由 北京智网畅联科技有限公司 整理、翻译并提供 · 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