From RTSC-Pedia

Jump to: navigation, search
revision tip
—— LANDSCAPE orientation
[printable version]  [offline version]offline version generated on 04-Aug-2010 21:08 UTC

XDCscript - Instance-Body.instance$static$init

Statically initialize a target module's instance object

Contents

Synopsis

 
function instance$static$init(obj, [r1, ...,] params, mod)

Parameters

obj 
the instance object to be initialized
params 
the instance config parameters. This structure contains fields for each instance config parameter declared in the module's spec file as well as a distinguished field named instance. The instance field is another structure containing the common instance parameters declared by xdc.runtime.IInstance.
mod 
the module that manages this instance
r1, ... 
the required create parameters declared in the create methods of the module. If no parameters are declared, then only obj and params are passed to this function.

Description

This function is called to initialize the instance object obj. No changes in configuration parameters are allowed, but the instance object's state may be initialized as a function of its parameters.

For information about the order in which module and instance functions are invoked, see Creating Configurable Content.

Example

Mod.xs
 
 
 
 
 
 
 
 
function instance$static$init(obj, prms)
{
    obj.x = 0;
    /* print the name for this instance */
    if (prms.instance.name != null) {
        print("creating instance named '" + prms.instance.name + "'");
    }
}

See also

XDCscript - Instance-Body.instance$meta$init Initialize a meta-only module's instance
XDCscript - Module-Object.create Create a new Instance object managed by this unit
Creating Configurable Content How to leverage the configuration process

[printable version]  [offline version]offline version generated on 04-Aug-2010 21:08 UTC
Copyright © 2008 The Eclipse Foundation. All Rights Reserved


Views
Personal tools
package reference