op_vvec_size_get()

Abstract

Returns the number of elements in a given value vector.

Syntax

op_vvec_size_get (vector)
Argument Type Description
vector Vvec_Vector vector of interest
[This vector is the subject of this procedure, which returns the number of elements in the vector.]

Return Type

int

Total size (in elements) of the specified vector.

Example

/* Determine the size of a vector before applying it to an esys interface. */
op_ima_obj_attr_get (interface_id, "dimension", &interface_dim);
if (op_vvec_size_get (src_vector) == interface_dim)
	{
	/* apply the vector value. */
	op_esys_interface_vector_set (interface_id, op_sim_time (), src_vector, 0);
	}
else
	{
	printf ("Error: interface dimension and vector size do not match.\n");
	}

Details

Not all elements need to be defined in order to be counted toward the vector size. The size of the value vector is 1 plus the index number of the last element in the vector. The following vector, for example, has a size of 6:

vector = {0, 1, 2, 3, 4, 5}

Purpose

Provides a mechanism to determine the number of elements in a value vector.

Errors

  • 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