op_pk_vvec_is_set()
Abstract
Determines whether a value vector packet currently contains a value vector.
Syntax
op_pk_vvec_is_set (pk_ptr)
| Argument | Type | Description |
|---|---|---|
pk_ptr |
Packet* |
pointer to the packet of interest [The packet must be a value vector packet.] |
Return Type
Boolean
Returns OPC_TRUE if the packet contains a value vector, and OPC_FALSE if the packet does not contain a value vector.
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, ¤t_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
A value vector packet does not necessarily contain a value vector at all times. This function allows you to determine whether a given value vector packet contains a value vector.
Purpose
Provides a mechanism to determine whether a value vector packet contains a value vector.
Errors
- Program Abort: Packet pointer references destroyed packet.
- Recoverable Error: Packet
<pk_id>) is of a type that does not contain a value vector.
Reference
- Use the KP op_pk_vvec_set() to insert value vectors into value vector packets
- Use the KP op_pk_vvec_get() to retrieve value vectors from value vector packets
- Use the KP op_vvec_create() to create a new value vector
- Use the KP op_pk_destroy() to destroy a packet and deallocate its memory
- Use the KP op_pk_type() to see if a packet is formatted, unformatted, or value vector