Description
The role of circuits in CDL is similar to the role of classes in object oriented languages, in that they localize and encapsulate program functionality. As with class definitions, that can contain aggregations of intrinsic objects and class instances (member objects), so circuit definitions can contain aggregations of intrinsic objects and sub-circuit instances. The major differences are that whilst class entry points are invoked by 'calling'; circuit entry points are invoked by stimulation with 'events'. Also, circuits are intrinsically concurrent and will transparently distribute their execution across available processors (across networks if required).
Circuits have two sets of attributes. The first provide a definition for the circuit, and the second are used in subsequent instantiations. Circuit definitions can be used/re-used anywhere within the defining project, or exported for use in any other projects.
Definition Content
The following information is required in order to define a circuit.
Definition Type
Unique circuit type identifier. This is used to instantiate circuits of the required type (see Instance Content below).
Definition Namespace
Optional definition type namespace.
Circuit Prototype
This is entered graphically with the Blueprint circuit editor. It's purpose is to ensure that connections made by instances contain compatible event trees.
Circuit Definition
This defines the objects owned by the circuit, and also the connections between them. It is also entered graphically using the Blueprint circuit editor.
Create Function
This over-rideable function creates the circuit and is called automatically once only when its parent circuit instance is created.
Integrate Function
This over-rideable function populates the circuit's parent pointer and is called automatically once only when its parent circuit instance is integrated.
Connect Function
This over-rideable function connects the circuit's manual connection(s) and is called automatically once only when its parent circuit instance is connected.
Initialize Function
This user defined function is entered using the Blueprint editor and is automatically called once only before the circuit is first activated.
Exit Function
This user defined function is entered using the Blueprint editor and is automatically called once only on process exit.
Instance Content
The following information is required in order to instantiate a thread.
Definition Type
Instance definition type (see above)
Name
Instance name (see Object Names)
Dimension
Instance dimensionality (see Object Dimensionality)
Presence
Instance presence flag (see Object Presence)
Member Functions
Circuits support the following member functions. These are typically executed from the initialize and/or exit user functions (see above) or active member objects that reference the circuit through use of their 'Parent functions'. None of these functions takes an argument.
Name()
Returns the address of a string containing the circuit element's creation name.
NumDimensions()
Returns the number of dimensions that the circuit instance was created with.
Dimensions()
Returns the address of an unsigned integer array containing the circuit's creation dimensions. The first element of the array contains the fastest varying (rightmost) dimension.
Element()
Returns the address of an unsigned integer array containing the circuit element's particular coordinates.
Parent()
Returns a reference to the circuit's parent circuit.
Workspace()
Returns a reference to the circuit element's workspace object (see State and Workspace Objects).
Example
See