next up previous contents
Next: Methods Up: Objects In C Previous: Initialising the device

The template device

Each device is initialised at creation time with default values. These default values can be defined (in order of precedence) either -

  1. in the class source code (the socalled code defaults), or
  2. in the resource database as class default values (the socalled class defaults), or
  3. in the resource database as device default values (the socalled device defaults).

Each class has a template copy of a device which is initialised at runtime by the class_initialise method. It is used for initialising devices of this class. Analogous to the class pointer, aGPowerSupplyClass, the template device is called aGPowerSupply. It is defined and should only be accessible from the classes source code. It should be initialised in the class_initialise() to the predefined code defaults which can be overridden by the class defaults stored in the static database. This means the class_initialise() should access the database after it has initialised the default object. This object will be used to initialise all newly created objects of that class. In C this is achieved by a single structure assignment statement. The defaults in the template object can be overridden by the devices defaults stored in the database.



Andy Goetz
Tue Jan 28 13:58:13 MET 1997