Click or drag to resize

Circuit Class

A Circuit contains arbitrary objects. Connections between the objects' members (fields and properties) automatically handle value propagation - if a source value changes, all the connected members will be set to the updated value.

This is the main object of the Xirkit package. Compare a Circuit to a real electronic circuit with the electronic components being instances of objects, their pins welded to the board being instances of IInPin and IOutPin connected to each others by conductive paths. Instead of electricity floating along the connections, a Circuit instance transmits values of certain types from node to node. If you are familiar with CINEMA 4D's XPresso, you know what a Circuit is. You can also compare Xirkit to WPF's Dependency Properties.

To build up a Circuit in code, create a new Circuit. For each arbitrary object that should be connected in the Circuit, create a hosting Node instance, passing the participating object to the Node's constructor. Use AddNode(Node) to add each new node (with the hosted object). Then use Attach(String, Node, String) to connect members (fields and properties) of objects contained in two different nodes to each others.

Technically a Circuit is a container filled with Node instances that are related to each others by connected (in- and out-) pins. A number of these nodes are specified as root nodes. Whenever a circuit is executed by calling its Execute method, the values of all out-pins at the root nodes are propagated (and possibly converted) the their connected in-pins, which in turn might trigger subsequent propagation along the graph. Nodes exposing the ICalculationPerformer interface are triggered to perform their calculation before the values at their out-pins are further propagated.

Inheritance Hierarchy
SystemObject
  Fusee.XirkitCircuit

Namespace:  Fusee.Xirkit
Assembly:  Fusee.Xirkit (in Fusee.Xirkit.dll) Version: 0.7.0.0 (0.7.0.0)
Syntax
C#
public class Circuit

The Circuit type exposes the following members.

Constructors
  NameDescription
Public methodCircuit
Initializes a new instance of the Circuit class.
Top
Properties
  NameDescription
Public propertyNodeList
Gets list of nodes within this Circuit
Public propertyRootList
Gets list of root nodes within this Circuit. Each root node should additionally be part of the node list.
Top
Methods
  NameDescription
Public methodAddNode
Adds node to the circuit. The node only takes part in an execution as long as it is either also listed as a root node or it has in-pins connected to other nodes in the list.
Public methodAddRoot
Adds a node to list of root nodes. Root nodes are the starting point of the value propagation when a graph is executed (when its Execute method is called).
Public methodDeleteNode
This method is defunkt since a user has no idea of what to specify at "pos".
Public methodDeleteRoot
This method is defunkt since a user has no idea of what to specify at "pos".
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodExecute
Executes this circuit. Propagates the values of all out-pins at the root nodes to the their connected in-pins. If these nodes have out-pins connected to subsequent nodes' in-pins, their values will be further propagated. Nodes exposing the ICalculationPerformer interface are triggered to perform their calculation before the values at their out-pins are further propagated.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodReset
Resets all nodes within this circuit.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
See Also