How do I obtain the data type of an attribute in EMA?
How do I obtain the data type of an attribute in EMA?
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).
DES Kernel->Process Modeling/Coding