op_vvec_type_get()
Abstract
Obtains the data type of a vector.
Syntax
op_vvec_type_get (vector)
| Argument | Type | Description |
|---|---|---|
vector |
Vvec_Vector |
value vector of interest |
Return Type
int
Constant indicating the data type of each element of a value vector
See Table 98 “Value Vector Type Symbolic Constants“ on page 35 for the list of constants used as return values.
Example
/* 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");
}
Details
A vector can store only data that matches its data type.
Purpose
Provides a mechanism to determine the data type of a value vector.
Errors
- Recoverable Error: Value vector is invalid.
Reference
- Use the KP op_vvec_insert() to place elements from one vector into another
- Use the KP op_vvec_size_get() to determine the number of elements in a vector
- Use the KP op_vvec_from_value() to convert a value to a bit representation of that value
- Use the KP op_vvec_to_value() to convert a bit representation to a value