TOC PREV NEXT INDEX

Create statement

Synopsis

type_and_atts_
[ref_mode]
object_name
[properties]
[array_declarator]
[subobjects]
[value_expression];

Description

The create statement creates an object.

The new object is an immediate subobject of the current object. For example, x is an immediate subobject of grp1:

group grp1 {
int x;
};

You can create several objects at once if their types are the same, by separating the object definitions with commas. The terminating semicolon appears at the end of the last object's definition. For example, the following lines create three integer objects:

int x, y=>3, &z[10];

An object inherits the characteristics of its type. This includes attributes, mode, properties, array declaration, subobjects, and value expression. Characteristics you specify in a create statement override any inherited characteristics.

Clauses

type_and_atts

The object's type and attributes. In a create statement, an object must be assigned at least one type.

type_and_atts can be...

Example

A previously defined object, typically a base type or a template

int x;
DefaultCamera camera1;

A plus-sign separated list of types and/or attributes

int+nosave x;

For a discussion of type, see .
For a discussion of attributes, see .

ref_mode

The object's reference mode.

ref_mode can be...

Example

^ (by-value)

group ^ x; __// Same as group x;

& (by-reference)

GDcamera_templ & cam_in; _

* (by-pointer)

UIpanel _ * parent;


object_name

The object's name. Typically you specify a new name; i.e., a name that is unique among the object's siblings in the object hierarchy. But you can specify the name of a sibling, in which case AVS/Express deletes the sibling and replaces it with the new definition.
A name can consist of letters, numbers, and the special characters # and _. In the Network Editor, the character _ appears as a space. A name cannot start with a digit. Names are case sensitive.

properties

Object properties. An object's properties includes both the properties specified here and any inherited properties.
The properties clause is enclosed in angle brackets. For example, x has the properties NEx, NEy, and NEportLevels:
int x<NEx=100, NEy=100, NEportLevels={2,0}>;

properties can be...

Example

prop_name = value
___This sets a property
___to a particular
___numeric or string
___value.

int x <NEiconName="group"> ;
int x <NEportLevels=2> ;

The second example sets x's input and output port levels to 2.

prop_name = { value , ...}
___This sets a property
___to an array of values.

int x <NEportLevels={2,0}> ;

This example sets x's input port level to 2 and output port level to 0.

value can be a scalar expression.

array_declarator

A C-style array declaration.

array_declarator can be...

Example

[ size ]
___This declares a one
___dimensional array.

int x [10*y] ;
GDobject_templ &objs [nobjs] ;

[]
___This declares a one
___dimensional array of
___unspecified bounds.

int x [] ;
GDobject_templ &objs [] ;

[ size ][ size ]...
___This declares a
___multidimensional array.

byte data [height][width] ;

size can be a scalar integer expression.

subobjects

One or more subobjects. Macros, groups, and libraries can have subobjects. Primitive data objects cannot.
An object has both the subobjects defined here and the subobjects inherited from its type.
subobjects begins with an open brace, continues with one or more create, modify, or delete statements, and finishes with a close brace.

For example, grp1's subobject block creates three float objects and an int object:

group grp1 {

float x, y, z;

int a;
}
;

This next example creates a group whose type is grp1, so it inherits grp1's subobjects, x, y, z, and a. grp2 creates an additional subobject, w, and modifies inherited subobjects x and y:

grp1 _grp2 {

float w;
// Create statement.
x<NEportLevels=2> = 1;
// Modify statement.
y => varx;
// Modify statement.
}
;

value_expression

A scalar or array value expression.
An expression begins with an assignment (=) or connection (=>) operator, then continues with a C-style expression.
Here are some examples of value expressions for primitive data objects:

int x = 4
; // Assignment of a constant.
int y => x
; // Connection to an object.
int z => 4*max(a,b,c)
; // Connection to a multioperand
// expression.
int w[] => {x,y,z}
; // Connection to an array
// of objects.

Below is an example of a value expression for a group object. The example connects the object camera_in to the object view.picked_camera:

GDcamera_templ &camera_in => view.picked_camera


TOC PREV NEXT INDEX