Ets_Obj_Attr_Get()
Abstract
Gets the value of a given ETS object’s attribute.
Syntax
Ets_Obj_Attr_Get (obj_hndl, attr_name, val_ptr)
| Argument | Type | Description |
|---|---|---|
obj_hndl |
EtsT_Obj_Handle |
Handle of object of interest. |
attr_name |
char * |
Name of attribute of interest. |
val_ptr |
void * |
Buffer to be filled with the attribute value. |
Return Type
EtsT_Compcode
EtsC_Compcode_Success if the attribute exists and is valid. EtsC_Compcode_Failure otherwise.
Header
ets_api_obj.h
Details
Obtains the value of an attribute of an object. The queried object need not be installed in a model. You may need to set the model attribute first. The val_ptr points to storage for the type to be returned. (The caller must know the type of the attribute value.)
| If return type is… | val_ptr must be… |
|---|---|
int |
int * |
double |
double * |
string |
char * |
text list |
PrgT_List * |
compound attr obj |
EtsT_Obj_Handle * |
toggle |
int * |
typed file |
char * |
profile |
PrgT_Profile_Spec * |
The caller always gets its own copy of the desired attribute value. The caller always supplies the storage space for the attribute value. This function can only get attributes of the types listed above.
Upon success, the value of the desired attribute is loaded into memory at the address provided, and success is returned. Otherwise, failure is returned.
If you use this function to get a compound attribute, it returns a copy of the compound attribute. Thus:
- If you modify the copy of the compound attribute and want the modification to take effect, you must set the copy of the compound attribute back on wherever it came from.
- When you are done, you must call Ets_Obj_Destroy() on the copy of the compound attribute.
To obtain a sub-attribute of a compound attribute, use the hierarchical name as described in Dealing with Compound Attributes.