stm_r_xx_attr_valRetrieves attribute values associated with a particular attribute name for the specified element. You can call this function without indicating the specific element type, as follows:stm_r_attr_val (id, attr_name, &status)
Input/Output Ifattr_name
does not exist for the specified element,status
receives the valuestm_attribute_name_not_found
.
● Attribute values may exist for attributes with no name. If you supply contiguous apostrophes (’’
) forattr_name
, you retrieve all values for unnamed attributes.
● In most cases, attributes have only one value. However, there are some cases where more than one attribute value is simultaneously meaningful. For example, a module has an attributeimplementation
. The attributessoftware
andhardware
might both be meaningful for some modules. Therefore, Rational Statemate provides the capability of assigning multiple values to attributes, and the function returns a list of these values. When there is a single value, the list consists of one component.To extract the attribute values of the attribute refer for the stateWAIT
and perform several operations on each of these values, use the following statements:stm_id st_id;
stm_attr_val attrib;
stm_list attr_list;
int status;
.
.
st_id = stm_r_st("WAIT", &status);
attr_list = stm_r_st_attr_val (st_id, "refer", &status);
for (attrib = (stm_attr_val)
stm_list_first_element (attr_list, &status);
status == stm_success;
attrib = (stm_attr_val)
stm_list_next_element (attr_list, &status))