interface xdc.runtime.IInstance

Common instance params

Every module's instance parameter structure contains a pointer to an IInstance.Params structure named instance. So, every instance parameter defined in this interface may optionally be set when creating (or constructing) any module's instances.
XDCspec summary sourced in xdc/runtime/IInstance.xdc
interface IInstance {  ...
instance:  ...
XDCspec declarations sourced in xdc/runtime/IInstance.xdc
package xdc.runtime;
 
interface IInstance {
 
 
instance:
per-instance config parameters
    config CString name// Name of the instance = null;
}
 
config IInstance.Params.name  // instance

Name of the instance

XDCspec declarations sourced in xdc/runtime/IInstance.xdc
config CString name = null;
 
DETAILS
It is possible to "bind" a name to each instance of any module at the time the instance is created (or constructed).
      ModA_Params params;
      ModA_Params_init(&params);
      params.instance->name = "myInstance";
      ModA_create(&params, NULL);
The name field must be assigned a pointer to a buffer that persists as long as the instance that it names exists. Only a reference to the name is retained in the instance, the name is not copied to a secondary buffer.
The configuration parameters that controls if instance names are supported is common$.namedInstance. The parameter is a member of the structure common$, available in each module. By default, this parameter is set to false, which disables support for instance names. Therefore, to enable instance names for a given module Mod, configure the module as follows in your configuration script:
      var Mod = xdc.useModule('pkg.Mod');
      ModA.common$.namedInstance = true;
Here is how the static instances are given names at the configuration time:
      var inst = Mod.create();
      inst.instance.name = "myInstance";
If instance names are enabled and used for statically created instances, the config parameter Text.isLoaded must be set to true to have these names available at runtime.
At runtime, assign your instance a name:
      #include <package/name/Mod.h>
      Mod_Params params;
      Mod_Params_init(&params);
      params.instance->name = "myInstance";
      Mod_create(&params, NULL);
If instances have been configured to not support names, it is still possible to assign to the instance.name field of the parameter structure (as shown above). However, the pointer is not retained and methods that normally return an instance's name will return NULL instead.
generated on Tue, 14 Feb 2017 20:01:27 GMT