op_pk_vvec_get()
Abstract
Extracts a value vector from a value vector packet.
Syntax
op_pk_vvec_get (vvec_pk_ptr, value_vector_ptr)
| Argument | Type | Description |
|---|---|---|
vvec_pk_ptr |
Packet* |
pointer to the packet containing the value vector |
value_vector_ptr |
Vvec_Vector* |
pointer to value vector to be filled in by the contents of the packet |
Return Type
Compcode
Completion code indicating whether the value vector was successfully retrieved.
[This value can be compared to the two symbolic constants OPC_COMPCODE_SUCCESS and OPC_COMPCODE_FAILURE.]
Example
if (op_pk_type (pkptr) != OPC_PK_TYPE_VVEC)
{
/* Convert packet to value vector form */
op_pk_convert_to_vvec (pkptr);
}
/* Extract the value vector from the converted pakcet */
op_pk_vvec_get (pkptr, &pk_vvec);
/* The packet is no longer needed */
op_pk_destroy (pkptr);
/* Invoke child process to "clock" the bits of the packet */
/* to the external system... */
Details
This function places a value vector contained inside a value vector packet into an empty value vector. The size of the value vector packet decreases by the size of the value vector removed, but the packet is not destroyed and can be used again.
Note: If the packet passed as an argument to op_pk_vvec_get() is a Sar segment that is also a value vector packet, the function places a copy of the value vector in value_vector_ptr but does not remove the value vector from the value vector packet.
Purpose
Provides a mechanism to remove value vectors from 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
- Use the KP op_pk_vvec_is_set() to determine if a value vector packet contains a value vector
- Use the KP op_pk_vvec_set() to insert value vectors into 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