From RTSC-Pedia
revision tip
LANDSCAPE orientationC - Params init
Initialize new instance creation parameters
Synopsis
| #include <«pkg»/«Mod».h>
Void «Mod»_init(«Mod»_Params *params); |
Description
Prior to creating a new instance managed by «Mod» with non-default parameters, you must first initialize a structure, named «Mod»_Params, with the default parameters.
| Mod_Params params; /* declare space for a Mod_Params structure */
Mod_Params_init(¶ms); /* initialize all params to their defaults */
params.«inst_config» = ...; /* assign a custom value to «inst_config» */
Mod_create(¶ms, NULL); /* create an instance with this custom setting */ |
It is possible to "bind" a name to each instance of any module at the time the instance is created (or constructed).
| Mod_Params params;
Mod_Params_init(¶ms);
params.instance->name = "myInstance";
Mod_create(¶ms, 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.
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.
See also
C - create
| Allocate and initialize a new instance object and return its handle
|
C - construct
| Initialize a new instance object inside the provided structure
|
C - Params_copy
| Copy instance creation parameters
|
Copyright © 2008 The Eclipse Foundation. All Rights Reserved