Show / Hide Table of Contents

Class VariableFactory

A factory for variables that will shield them from outside.

Inheritance
object
VariableFactory
Implements
IVariableFactory<IVariable>
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: SpiceSharp.Components.Subcircuits
Assembly: SpiceSharp.dll
Syntax
public class VariableFactory : IVariableFactory<IVariable>

Constructors

VariableFactory(string, IVariableFactory<IVariable>, IEnumerable<Bridge<string>>, IEqualityComparer<string>)

Initializes a new instance of the VariableFactory class.

Declaration
public VariableFactory(string name, IVariableFactory<IVariable> parent, IEnumerable<Bridge<string>> nodes, IEqualityComparer<string> comparer)
Parameters
Type Name Description
string name

The subcircuit instance name.

IVariableFactory<IVariable> parent

The parent.

IEnumerable<Bridge<string>> nodes

The nodes.

IEqualityComparer<string> comparer

The equality comparer for nodes.

Exceptions
Type Condition
ArgumentNullException

Thrown if name, parent or nodes is null.

Methods

CreatePrivateVariable(string, IUnit)

Creates a variable that is private to whoever requested it. The factory will not shared this variable with anyone else, and the name is only used for display purposes.

Declaration
public IVariable CreatePrivateVariable(string name, IUnit unit)
Parameters
Type Name Description
string name

The name of the private variable.

IUnit unit

The unit of the variable.

Returns
Type Description
IVariable

The private variable.

GetSharedVariable(string)

Gets a variable that can be shared with other behaviors by the factory. If another variable already exists with the same name, that is returned instead.

Declaration
public IVariable GetSharedVariable(string name)
Parameters
Type Name Description
string name

The name of the shared variable.

Returns
Type Description
IVariable

The shared variable.

Exceptions
Type Condition
ArgumentNullException

Thrown if name is null.

Implements

IVariableFactory<V>

Extension Methods

Utility.ThrowIfNull<T>(T, string)

See Also

IVariableFactory<V>
IVariable
In this article
Back to top Generated by DocFX