How do I obtain the data type of an attribute in EMA?

Categories:
Solution Number:
S20692
Last Modified:
2013-08-20
Issue

How do I obtain the data type of an attribute in EMA?

Solution

If you know the attribute's name, but you need to find out its type, you need to write the following code:/* Determine the attribute's data type. */int attr_type;Ema_Obj_Attr_Get (model_id, obj_id, <attribute name>, COMP_CONTENTS_TYPE, &attr_type, EMAC_EOL);/* Get the contents (value) of the attribute, using the appropriate datatype. */switch (attr_type) { case EMAC_INTEGER: case EMAC_TOGGLE: { int var; Ema_Obj_Attr_Get (model_id, obj_id, <attribute name>, COMP_CONTENTS_TYPE, &var, EMAC_EOL); } case EMAC_DOUBLE: case EMAC_TOGGLE_DOUBLE: { double var; Ema_Obj_Attr_Get (model_id, obj_id, <attribute name>, COMP_CONTENTS_TYPE, &var, EMAC_EOL); } case EMAC_STRING: case EMAC_DATAFILE: { char var [1024]; Ema_Obj_Attr_Get (model_id, obj_id, <attribute name>, COMP_CONTENTS_TYPE, &var, EMAC_EOL); } case EMAC_COMPOUND: { /* See OPNET's External Interfaces manual, chapter EMA, section 7 (Compound Object, Examples of compound value object usage) */ } default: { /* This should never happen */ } }For more information, please see OPNET's External Interfaces manual, chapter EMA, section 4 (ACVs).

Environment

DES Kernel->Process Modeling/Coding

Attachments
NOTICE: Riverbed® product names have changed. Please refer to the Product List for a complete list of product names.
Can't find an answer? Create a case