The attributes, relationships, and operations of an object are its properties. ASL assigns values to properties by using the following syntax:
<objectRef>-><property> = <value>;
The <objectRef> is the object handle for the object. You assign the object handle by using the create() or object() functions or through a relationship.
The following script loads the names of all instances of the classes “Card” and “Port” into a Domain Manager. The datafile contains a card name followed by the ports associated with the card. As this script loads cards and ports, it creates a relationship between a card and its ports.
Relationships between objects in MODEL are paired. It is not necessary to define both relationships. Define one relationship. Its converse is defined by default.
ASL Script (properties_obj.asl): START { CARD rep(PORT) } CARD { "CARD:" cardname:word eol } do { cardObj = create("Card",cardname); } PORT { portname:word eol } do { portObj = create("Port",portname); cardObj->ComposedOf += portObj; print(portObj." ".cardObj); } Input (create_obj.asl): CARD: CARD0 PORT00 PORT01 PORT02 PORT03 CARD: CARD1 PORT10 PORT11 PORT12 CARD: CARD2 PORT20 PORT21 PORT22 PORT23 PORT24 PORT25 Output: $ sm_adapter --server=JS1 --file=create_obj.txt properties_obj.asl Port::PORT00 Card::CARD0 Port::PORT01 Card::CARD0 Port::PORT02 Card::CARD0 Port::PORT03 Card::CARD0 Port::PORT10 Card::CARD1 Port::PORT11 Card::CARD1 Port::PORT12 Card::CARD1 Port::PORT20 Card::CARD2 Port::PORT21 Card::CARD2 Port::PORT22 Card::CARD2 Port::PORT23 Card::CARD2 Port::PORT24 Card::CARD2 Port::PORT25 Card::CARD2 $
The value stored in <objectRef>-><property >can also be assigned to an ASL variable.
<variable> = <objectRef>-><property>;
You can refer to properties indirectly. This is a two-step process. First, assign the property to a variable. Second, the variable can be used in place of the property in conjunction with an indirection operator (->*).
propertyname = “property”; objRef->*propertyname = "UP";
The syntax objRef->*variable allows you to access an attribute by variable. The following code sample assigns the attribute name to a variable, then makes a reference to that attribute through the indirection operator. The output is the creation class name of the given object.
variable = “CreationClassName”; c = objRef->*variable; print(c);
When you run this ASL script on a router object, the output is “Router”.