op_vvec_type_get()
摘要
获取向量的数据类型。
语法
op_vvec_type_get (vector)
| 参数 | 类型 | 说明 |
|---|---|---|
vector |
Vvec_Vector |
目标值向量 |
返回类型
int
指示值向量各元素数据类型的常量
用作返回值的常量列表参见 Table 98 “Value Vector Type Symbolic Constants“ 第 35 页。
示例
/* Determine whether a value vector's type matches an esys interface's */
/* type before applying the vector to the esys interface. */
op_ima_obj_attr_get (interface_id, "type", &interface_type);
if (op_vvec_type_get (src_vector) == interface_type)
{
/* apply the vector value. */
op_esys_interface_vector_set (interface_id, op_sim_time (), src_vector, 0);
}
else
{
printf ("Error: interface type and vector type do not match.\n");
}
详情
向量只能存储与其数据类型匹配的数据。
用途
提供一种确定值向量数据类型的机制。
错误
- 可恢复错误:值向量无效。
参考
- 使用内核过程 op_vvec_insert() 将一个向量的元素放入另一个向量
- 使用内核过程 op_vvec_size_get() 确定向量中元素的数量
- 使用内核过程 op_vvec_from_value() 将值转换为该值的位表示形式
- 使用内核过程 op_vvec_to_value() 将位表示形式转换为值