Public Member Functions | Static Public Member Functions | Data Fields

SignalSpecial Class Reference
[Programmable Signals.]

The special start and end pseudo instructions. More...

#include <programmable_signals.h>

Inheritance diagram for SignalSpecial:
SignalInstruction

Public Member Functions

 SignalSpecial (SignalProgram *prog, SignalOpcode op)
 Constructs a special signal of the opcode op in program prog.
virtual void Evaluate (SignalVM &vm)
 Evaluates the instruction.
virtual void Remove ()
 Removes this instruction.
virtual void SetNext (SignalInstruction *next_insn)

Static Public Member Functions

static void link (SignalSpecial *first, SignalSpecial *last)
 Links the first and last instructions in the program.

Data Fields

SignalInstructionnext
 The next instruction after this one.

Detailed Description

The special start and end pseudo instructions.

These instructions serve two purposes:

  1. They permit every other instruction to assume that there is another following it. This makes the code much simpler (and by extension less error prone).
  2. Particularly in the case of the End instruction, they provide an instruction in the user interface that can be clicked on to add instructions at the end of a program.

Definition at line 241 of file programmable_signals.h.


Constructor & Destructor Documentation

SignalSpecial::SignalSpecial ( SignalProgram prog,
SignalOpcode  op 
)

Constructs a special signal of the opcode op in program prog.

Generally you should not need to call this; it will be called by the program's constructor. An exception is in the saveload code, which needs to construct raw objects to deserialize into.

Definition at line 199 of file programmable_signals.cpp.

References next, PSO_FIRST, and PSO_LAST.


Member Function Documentation

void SignalSpecial::Evaluate ( SignalVM vm  )  [virtual]

Evaluates the instruction.

If this is an Start instruction, flow will be vectored to the first instruction; if it is an End instruction, the program will terminate and the signal will be left red.

Implements SignalInstruction.

Definition at line 221 of file programmable_signals.cpp.

References DEBUG, SignalVM::instruction, next, and PSO_FIRST.

void SignalSpecial::link ( SignalSpecial first,
SignalSpecial last 
) [static]

Links the first and last instructions in the program.

Generally only to be called from the SignalProgram constructor.

Definition at line 214 of file programmable_signals.cpp.

References next, PSO_FIRST, and PSO_LAST.

void SignalSpecial::Remove (  )  [virtual]

Removes this instruction.

If this is the start instruction, then all of the other instructions in the program will be successively removed, (emptying it). If this is the End instruction, then it will do nothing.

This operation, unlike when executed on most instructions, does not destroy the instruction.

Implements SignalInstruction.

Definition at line 206 of file programmable_signals.cpp.

References next, PSO_FIRST, and PSO_LAST.


Field Documentation

The next instruction after this one.

On the End instruction, this should be NULL.

Definition at line 279 of file programmable_signals.h.

Referenced by Evaluate(), link(), Remove(), and SignalSpecial().


The documentation for this class was generated from the following files: