#include <SIG_ProgramLine.h>
Public Methods | |
SIG_ProgramLine () | |
This constructor initializes an empty program line that does not contain any elements. More... | |
SIG_ProgramLine ( SIGEL_Tools::SIG_Randomizer &r, SIGEL_Robot::SIG_LanguageParameters &languageP, QArray< int > &prob ) | |
This constructor generates a random instruction that is dependend on the language parameters. More... | |
virtual | ~SIG_ProgramLine () |
An empty destructor. More... | |
void | generateRandomRobotInstruction ( SIGEL_Robot::SIG_LanguageParameters &languageP, SIGEL_Tools::SIG_Randomizer &r, QArray< int > &prob ) |
This function generates a random instruction that is dependend on the language parameters. More... | |
void | clearLine () |
This function deletes the data of a program line completely. More... | |
void | copyLine ( SIGEL_Program::SIG_ProgramLine *source, SIGEL_Program::SIG_ProgramLine *destination ) |
This instruction copies the program line source into the line destination. More... | |
void | randomRobotinstruction ( SIGEL_Robot::SIG_LanguageParameters &languageP, SIGEL_Tools::SIG_Randomizer &r, QArray< int > &prob ) |
This function generates randomly a robot instruction. More... | |
void | print () |
This function is only for test purposes and prints a program line. More... | |
void | setElement ( int no, int value ) |
This function sets an element (with index no) to the value. More... | |
void | resizeElements ( int size ) |
This function changes to size of the array that saves the elements. More... | |
void | writeToFile ( QTextStream &file ) |
This function writes a program line into a QTextStream. More... | |
bool | readFromFile ( QString &str, SIGEL_Program::SIG_ProgramLine *line ) |
This function will generate a program line from the read QTextStream.It will return true if a robot instruction could be generated. More... | |
void | printToString (QString &lineStr) |
This function prepares a QString. More... | |
QArray< int > | getElementsArray () |
This function returns the array of a line's elements. More... | |
Robotinstruction | getRobotinstructionType () |
This function returns the type of the current robotinstruction. More... | |
int | getInstructionElement (int no) |
This function returns the element of the current robotinstruction. More... | |
int | getElement (int no) |
This function returns the element with the index no. More... | |
int | getNumberOfElements () |
This function gives an inormation about the number of elements at all. More... | |
SIGEL_Program::SIG_ProgramLine& | operator= (SIGEL_Program::SIG_ProgramLine const & prgLine) |
This operator copies a complete program line. More... | |
void | setRobotinstructionType ( Robotinstruction instr ) |
Sets the robot instrction type, e.g. More... | |
void | setRobotinstruction (SIGEL_Program::Robotinstruction instr, int op1, int op2) |
A robot instruction can be set explicitely by using this function. More... | |
Protected Methods | |
void | readTwoRegisters (QString &str,int ®1,int ®2) |
Internal function, only internal usage. More... | |
void | readOneRegisterAndIntegerConstant (QString &str,int ®1,int &cnst) |
Internal function, only internal usage. More... | |
void | readOneRegister (QString &str,int ®) |
Internal function, only internal usage. More... | |
Protected Attributes | |
Robotinstruction | instructionType |
The type of the current robot inbstruction, e.g. More... | |
QArray< int > | element |
This array contains the elements of a program line. More... |
A program line is a set of elements. The meaning of the elements is dependend on the type of an instruction. Every instruction type defines a fix meaning for every element.
Definition at line 63 of file SIG_ProgramLine.h.
|
This constructor initializes an empty program line that does not contain any elements.
Definition at line 23 of file SIG_ProgramLine.cpp. |
|
This constructor generates a random instruction that is dependend on the language parameters. The probability to be chosen randomly is dependend on the given probabilities (prob). Definition at line 34 of file SIG_ProgramLine.cpp. |
|
An empty destructor.
Definition at line 26 of file SIG_ProgramLine.cpp. |
|
This function deletes the data of a program line completely.
Definition at line 29 of file SIG_ProgramLine.cpp. |
|
This instruction copies the program line source into the line destination.
Definition at line 857 of file SIG_ProgramLine.cpp. |
|
This function generates a random instruction that is dependend on the language parameters. The probability to be chosen randomly is dependend on the given probabilities (prob). Definition at line 849 of file SIG_ProgramLine.cpp. Referenced by SIG_ProgramLine(). |
|
This function returns the element with the index no.
Definition at line 171 of file SIG_ProgramLine.cpp. Referenced by printToString(), and writeToFile(). |
|
This function returns the array of a line's elements.
Definition at line 166 of file SIG_ProgramLine.cpp. |
|
This function returns the element of the current robotinstruction. The first element, e.g. a register, is to be accessed with index 0. In case of an invalid access, e.g. a not defined index, this function returns -1. Example 1: LOAD 1,432 -> getInstructionElement(0)=1,getInstructionElement(1)=432; Example 2: ADD 1,2 -> getInstructionElement(0)=1,getInstructionElement(1)=2;
Definition at line 145 of file SIG_ProgramLine.cpp. Referenced by SIGEL_Simulation::SIG_Interpreter::interprete(), and SIGEL_GP::SIG_GPOperations::mutation(). |
|
This function gives an inormation about the number of elements at all.
Definition at line 216 of file SIG_ProgramLine.cpp. Referenced by getElement(), getInstructionElement(), SIGEL_GP::SIG_GPOperations::mutation(), and setElement(). |
|
This function returns the type of the current robotinstruction.
Definition at line 140 of file SIG_ProgramLine.cpp. Referenced by SIGEL_Simulation::SIG_Interpreter::interprete(), SIGEL_GP::SIG_GPOperations::mutation(), printToString(), and writeToFile(). |
|
This operator copies a complete program line.
Definition at line 9 of file SIG_ProgramLine.cpp. |
|
This function is only for test purposes and prints a program line.
Definition at line 221 of file SIG_ProgramLine.cpp. Referenced by SIGEL_GP::SIG_GPOperations::mutation(). |
|
This function prepares a QString. This QString will contain the current program line.
Definition at line 230 of file SIG_ProgramLine.cpp. Referenced by SIGEL_Simulation::SIG_Interpreter::interprete(), and print(). |
|
This function generates randomly a robot instruction. The choice is depended on the current language parameters and the given probabilities (prob). Definition at line 657 of file SIG_ProgramLine.cpp. Referenced by generateRandomRobotInstruction(), and SIGEL_GP::SIG_GPOperations::mutation(). |
|
This function will generate a program line from the read QTextStream.It will return true if a robot instruction could be generated. If no defined instruction could be generated, the current read line will be ignored. So comments can be used within a robot program. Comments always have to use a complete line, and comments are not allowed to contain any keywords (=robot instructions, e.g. ADD).
Definition at line 456 of file SIG_ProgramLine.cpp. Referenced by SIGEL_Program::SIG_Program::readFromFile(). |
|
Internal function, only internal usage.
Definition at line 341 of file SIG_ProgramLine.cpp. Referenced by readFromFile(). |
|
Internal function, only internal usage.
Definition at line 372 of file SIG_ProgramLine.cpp. Referenced by readFromFile(). |
|
Internal function, only internal usage.
Definition at line 413 of file SIG_ProgramLine.cpp. Referenced by readFromFile(). |
|
This function changes to size of the array that saves the elements.
Definition at line 336 of file SIG_ProgramLine.cpp. Referenced by setRobotinstruction(). |
|
This function sets an element (with index no) to the value. value has to be a pre-defined constant value.
Definition at line 193 of file SIG_ProgramLine.cpp. Referenced by operator=(), and setRobotinstruction(). |
|
A robot instruction can be set explicitely by using this function. The robot instruction is set to instructionType. The operands are defined by op1 and op2. If an instruction only needs one operad (op1) the second operand (op2) will be ignored. Definition at line 46 of file SIG_ProgramLine.cpp. Referenced by SIGEL_GP::SIG_GPOperations::mutation(), randomRobotinstruction(), and readFromFile(). |
|
Sets the robot instrction type, e.g. SIGEL_Program::COPY, ... Definition at line 41 of file SIG_ProgramLine.cpp. Referenced by operator=(), and setRobotinstruction(). |
|
This function writes a program line into a QTextStream.
Definition at line 563 of file SIG_ProgramLine.cpp. |
|
This array contains the elements of a program line. Elements are coded with values between 0 and MAXINT. The meaning of these elements is dependend on the instruction type. Elements can represent registers or integer values. Definition at line 80 of file SIG_ProgramLine.h. |
|
The type of the current robot inbstruction, e.g. LOAD, COPY, ... Definition at line 71 of file SIG_ProgramLine.h. |