op_pk_id_str_get()
Abstract
Obtains the string representation of a packet ID.
Syntax
op_pk_id_str_get (pkid, buffer)
| Argument | Type | Description |
|---|---|---|
pkid |
OpT_Packet_Id |
ID of the packet-of-interest |
buffer |
char * |
variable to be filled with the string representation of the packet ID |
Return Type
void
No return value.
Example
char pkt_id_str[20];
/* A packet has arrived at our receiver */
pkptr = op_pk_get (op_intrpt_strm ());
/* Get the packet ID and convert to a string */
pkt_id = op_pk_id (pkptr);
op_pk_id_str_get (pkt_id, pkt_id_str);
Details
If the simulation uses module-based ID generation, the returned string consists of the ID of the module in which the packet was created (or "kernel" if created by the simulation) and the creation index in that module. Otherwise, it is simply the global packet creation index.
When using module-based ID generation, this KP provides a better output than just using OPC_PACKET_ID_FMT to print the ID to a string.
Purpose
Provides a way to obtain a well-formed string representation of a packet ID, regardless of whether ID generation is module-based or global.
Errors
- None.
Reference
- None.