Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

rt::Instr Class Reference

Implements one instruction in a robot's program. More...

#include <robbase.h>

Inheritance diagram for rt::Instr:

Inheritance graph
[legend]
List of all members.

Public Methods

virtual ~Instr ()
virtual ExecReturnType exec (Task *task)=0
 Executes this instruction on the given bot (represented by its active task). More...

virtual rint getNumCycles (Task *task)
 Return the number of cycles this instruction takes, considering the given bot (represented by its active task).
This includes checking for errors as well! This function just returns cycles and will probably not be enough for most instructions.
More...


virtual TimingMode getTimingMode ()
 Returns the timing mode for this instruction. More...

virtual lrt::String getName ()=0
 Return the instruction name here.

virtual lrt::String print (int instrPos=0)
 Returns a String representation of this instruction. More...


Protected Methods

 Instr (int numParams)
 Initializes the operand array.

rint getValue (Task *task, int opNum, bool absolute=false)
 HACK: Task ops return their value + 1. More...

void setValue (Task *task, int opNum, rint value)
 Sets the game (bot, task) variable given by the op at opNum of the bot given by task to the given value.

void initOps (const lrt::Array< Op > &ops)
 Sets the ops up.

lrt::String printOp (int opNum, int instrPos)
 Prints the op.

lrt::String printOps (int instrPos)
 Prints all ops in a comma-separated list.


Protected Attributes

Op * ops
 The operand array.

int numOps
 The number of ops this instruction has.

rint cycles
 The number of cycles this instruction takes.


Detailed Description

Implements one instruction in a robot's program.


Member Function Documentation

virtual ExecReturnType rt::Instr::exec (  Task *    task )  [pure virtual]
 

Executes this instruction on the given bot (represented by its active task).

If this function doesn't return execOK, an error has occured and the robot given by task should be destroyed.

rint rt::Instr::getNumCycles (  Task *    task )  [virtual]
 

Return the number of cycles this instruction takes, considering the given bot (represented by its active task).
This includes checking for errors as well! This function just returns cycles and will probably not be enough for most instructions.


If this function returns a negative value, an error has occured during checking and the bot should be destroyed.

TimingMode rt::Instr::getTimingMode (    )  [virtual]
 

Returns the timing mode for this instruction.

The method of class Instr returns timingNumExec.

See also:
TimingMode

rint rt::Instr::getValue (  Task *    task,
int    opNum,
bool    absolute = false
)  [protected]
 

HACK: Task ops return their value + 1.

Parameters:
absolute  For instructions needing absolute references (BJUMP, AJUMP).

String rt::Instr::print (  int    instrPos = 0 )  [virtual]
 

Returns a String representation of this instruction.

Parameters:
instrPos  Position (in its bank) of the instruction.


The documentation for this class was generated from the following files:
This is the RoboTour API documentation version 0.1 • Copyright (C) by Florian Fischer