op_ev_id_str_get()
Abstract
Obtains the string representation of an event ID.
Syntax
op_ev_id_str_get (evhandle, buffer)
| Argument | Type | Description |
|---|---|---|
evhandle |
Evhandle |
ID of the event-of-interest |
buffer |
char * |
variable to be filled with the string representation of the event ID |
Return Type
Compcode
OPC_COMPCODE_SUCCESS if the event ID string is successfully obtained; OPC_COMPCODE_FAILURE otherwise.
Example
char ev_id_str[20];
/* Get the currently executing event */
evptr = op_ev_current ();
/* Get the event ID as a string */
op_ev_id_str_get (evptr, ev_id_str);
Details
If the simulation uses module-based ID generation, the returned string consists of the ID of the module in which the event was created (or “kernel” if created by the simulation) and the creation index in that module. Otherwise, it is simply the global event creation index.
When using module-based ID generation, this KP provides a better output than just using OPC_EV_ID_FMT to print the ID to a string.
Purpose
Provides a way to obtain a well-formed string representation of an event ID, regardless of whether ID generation is module-based or global.
Errors
- Recoverable Error: Event handle refers to an event that is either invalid or not currently scheduled.
Reference
- Use the KP op_ev_id() to obtain an event ID