op_ima_obj_selfdesc_characteristic_get()
Abstract
Obtains self-description information for a node, link, path, or demand model.
Syntax
op_ima_obj_selfdesc_characteristic_get (objid, characteristic_name, max_characteristic_len, value_ptr, type_ptr)
| Argument | Type | Description |
|---|---|---|
objid |
Objid |
object ID of the object-of-interest |
characteristic_name |
const char * |
Name of characteristic to obtain. |
max_characteristic_len |
int |
Length of buffer available to hold the returned characteristic value |
value_ptr |
char * |
Pointer to buffer to be filled with the value of the requested characteristic |
type_ptr |
OpT_Sim_Selfdesc_Characteristic_Type * |
Pointer to area to be filled with the comparator corresponding to the requested characteristic. See Details. |
Return Type
Compcode
OPC_COMPCODE_SUCCESS if the specified characteristic can be obtained; OPC_COMPCODE_FAILURE otherwise.
Example
char vendor [256];
OpT_Sim_Selfdesc_Characteristic_Type type;
if (op_ima_obj_selfdesc_characteristic_get (node_objid, "vendor", sizeof (vendor),
vendor, &type) == OPC_COMPCODE_SUCCESS)
{
printf ("Node's vendor is (%s)\n", vendor);
}
Details
type_ptr is the comparator used to match the characteristic value of the model against that of an imported object during a topology import. It can be one of the following symbolic constants:
OPC_SELFDESC_CHARACTERISTIC_EQUALOPC_SELFDESC_CHARACTERISTIC_ONEOFOPC_SELFDESC_CHARACTERISTIC_RANGEOPC_SELFDESC_CHARACTERISTIC_CONTAINS
Note: This KP is useful only for simulation time 0. After that time, all self-description information is flushed from memory.
Purpose
This function obtains generic self-description information about an object. You can use this function to perform custom processing based on the particular self-description characteristics of an object. For example, process models can use this function to obtain self-description information about a node instance and then perform vendor-specific operations on that node.
Errors
- Recoverable Error: Object ID (
<objid>) is out-of-range. - Recoverable Error: Object ID (
<objid>) refers to a restricted object. - Recoverable Error: Object (
<objid>) has incorrect type (<type>); Node, link, path or demand objects are expected.
Reference
- Use the KP op_id_self() to obtain the object ID of the surrounding processor or queue
- Use the KP op_id_from_name() to obtain the object ID of an arbitrary object