[mode]
object_name
[additional_types_and_atts]
[delete_atts]
[properties]
[array_declarator]
[subobjects]
[value_expression] ;
The modify statement modifies an object's definition. Only those clauses you specify are modified. Other clauses are unchanged.
A modify statement does not begin with a type clause. This is what distinguishes it from a create statement. If you specify a type before the object's name, AVS/Express deletes the existing definition of the object and creates a new one.
The clauses are similar to the create statement. The descriptions below highlight the differences.
The object's reference mode. It is ^ (by-value), & (by-reference), or * (by-pointer).
For example, you change object x's reference mode to value:
The name of the object to be modified. You can specify the current object, one of its immediate subobjects, or, using a pathname, any lower-level subobject.
For example, you create an object called c1, then change subobject x, one of the inherited subobjects:
group coordinates {
int x, y;
};
coordinates c1 {
x
= 3;
};
Assume you are in the VCP and want to modify subobject x. One way is to first navigate to x:
Another way is to specify a pathname:
To modify an object's name, use the V command $set_obj_name. For example, you change object x's name to int1:
Additional types to be assigned to the object. additional_types_and_atts begins with a plus sign, followed by one or more plus-sign separated types and/or attributes.
For example, you add the req and notify attributes to x:
You cannot remove a previously assigned type. If this is what you want to do, you must recreate the object.
You can remove a previously assigned attribute, by preceding it with a minus sign:
You cannot remove a previously assigned object type.
You can mix delete_atts with additional_types_and_atts. For example:
OM(SingleWindowApp) -> int x;
OM(SingleWindowApp) -> int+notify x;
OM(SingleWindowApp) -> x-notify+write;
OM(SingleWindowApp) -> $print x
int+write x;
Additional properties and/or modifications to existing properties.
For example, you set x's NEx property to 100:
A new array declaration for the object. If the object is currently a single entity, it changes into an array of the specified dimensions. If the object is already an array, its dimensions change to those specified. You cannot change an array into a single entity, except to specify an array of size 1.
x[10]
; // Change x to a 10 array.
x[mdims][3]
; // Change x to an mdims by 3 array.
Additional subobjects and/or modifications or deletions to existing subobjects.
For example, you modify c1 by modifying subobject x and adding subobject z:
my_coordinates {
x = 100;
int z;
}
;
Caution: Deleting an inherited subobject breaks an object's template hierarchy.
For example, you connect object in to object invert.out:
Below, you break the connection by specifying a null value expression: