TF_2Port, TF_Direct - transfer function subclasses
SYNOPSIS
#include <Unidraw/transfns.h>
DESCRIPTION
The TransferFunct abstract base class defines the transfer
function protocol. The library predefines two subclasses.
TF_2Port is a subclass that acts as an abstract base class
for transfer functions having two sets of state variables,
``input'' and ``output'', with output variables always
dependent on input variables. TF_Direct is a subclass of
TF_2Port that defines a one-to-one assignment relationship
between an input and an output state variable.
TF_2PORT PUBLIC OPERATIONS
void Evaluate(Path* = nil)
Evaluate first carries out information transfer
between dependent state variables by calling the
Transfer operation (described below). Then it
iterates through its output state variables; those
that have changed (according to the ChangedOutput
operation, described below) get Transmit called on
the connector they're bound to. Subclasses needn't
redefine this operation if they implement Transfer
and ChangedOutput appropriately.
virtual StateVar* GetInput(int index)
virtual StateVar* GetOutput(int index)
virtual void SetInput(StateVar*, int index)
virtual void SetOutput(StateVar*, int index)
Retrieve and assign the TF_2Port's input and output
state variables, identified serially. These opera-
tions do nothing by default; subclasses must allo-
cate the storage they require.
virtual int Inputs()
virtual int Outputs()
Return the number of input and output state vari-
ables. These operations return zero by default.
TF_2PORT PROTECTED OPERATIONS
TF_2Port()
The constructor is protected to prevent instantia-
tion.
virtual void Transfer()
Enforce the subclass-specific dependencies between
the TF_2Port's state variables. This operation
does nothing by default.
virtual boolean ChangedOutput(int index = 0)
call to Transfer. Subclasses redefine this opera-
tion according to the semantics of their Transfer
operation.
TF_DIRECT PUBLIC OPERATIONS
TF_Direct(StateVar* input = nil, StateVar* output = nil)
Instantiate a new object, optionally specifying the
input state variable and its dependent output state
variable.
virtual StateVar* GetInput(int index = 0)
virtual StateVar* GetOutput(int index = 0)
virtual void SetInput(StateVar*, int index = 0)
virtual void SetOutput(StateVar*, int index = 0)
Retrieve and assign the TF_Direct's input and out-
put state variables. Specifying an index greater
than zero does nothing, since TF_Direct defines a
dependency between one input and one output state
variable.
virtual int Inputs()
virtual int Outputs()
Return the number of input and output state vari-
ables. These operations return zero by default.
virtual int Inputs()
virtual int Outputs()
These operations return 1.
TF_DIRECT PROTECTED OPERATIONS
virtual void Transfer()
Assign the input state variable to the output state
variable, setting a flag indicating that the output
value has changed.
virtual boolean ChangedOutput(int index = 0)
Return the status of the flag set by Transfer. The
flag is reset as a side-effect of this operation.
SEE ALSO
TransferFunct(3U)
Man(1) output converted with
man2html