op_pk_vvec_set()

Abstract

Inserts a value vector into a value vector packet.

Syntax

op_pk_vvec_set (vvec_pk_ptr, value_vector)
Argument Type Description
vvec_pk_ptr Packet* pointer to a value vector packet
value_vector Vvec_Vector value vector to be placed into the packet
[A value vector must be of type bit to be inserted into a value vector packet.]

Return Type

Compcode

Completion code indicating whether the value vector was successfully set.

[This value can be compared to the two symbolic constants OPC_COMPCODE_SUCCESS and OPC_COMPCODE_FAILURE.]

Example

/* Append a "partition" value vector onto the contents of a */
/* value vector packet.                                     */

/* Determine if there is already a value vector in this packet */
if (op_pk_vvec_is_set (pkptr))
	{
	/* There is an existing value vector already in this packet. */
	/* Append the "partition" to the existing value vector.      */

	op_pk_vvec_get (pkptr, &current_vvec);

	end_pos = op_vvec_size_get (current_vvec);
	op_vvec_insert (current_vvec, end_pos, partition_vvec);
	}
else
	{
	/* When op_pk_vvec_set () is called, the Kernel */
	/* takes ownership of the value vector.         */
	/* Therefore, create a duplicate of "partition" */
	/* to install into the value vector packet.     */
	current_vvec = op_vvec_copy (partition_vvec, 0,
		op_vvec_size_get (partition_vvec));
	}

op_pk_vvec_set (pkptr, current_vvec);

Details

The value vector being inserted must be of type bit. Any value vector inside the packet when this KP is called is destroyed (that is, the memory associated with it is deallocated). The Simulation Kernel assumes ownership of the value vector when it is inside the packet, and it therefore cannot be modified in any way. After this KP’s invocation, the value vector packet’s size is the size of the value vector plus the bulk size.

Note: If a Sar segment is passed as an argument to op_pk_vvec_set() and the Sar segment is also a value vector packet, the KP replaces the value vector that had been in the packet with the new one provided that the two value vectors are the same size.

Purpose

Provides a mechanism to insert value vectors into value vector packets.

Errors

  • Program Abort: Packet pointer references unowned packet (<pk_id>).
  • Program Abort: Packet pointer references destroyed packet.
  • Program Abort: Packet pointer does not reference value vector packet.
  • Recoverable Error: Value vector is invalid.

Reference

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