AURobotServers
4
|
#include <urule.h>
Public Types | |
enum | ResultValue { RV_EMPTY, RV_OK, RV_OK_FALSE, RV_OK_AGAIN, RV_SYNTAX_ERROR, RV_FAILED, RV_IF_TRUE, RV_IF_FALSE } |
Public Member Functions | |
virtual ResultValue | execute (UVarCalc *calc, int state) |
const char * | findStopChar (const char *source, char stop) |
virtual const char * | getDataType () |
int | getLineNumber () |
bool | isA (const char *matchType) |
virtual const char * | print (const char *preStr, char *buf, const int bufCnt) |
virtual bool | setLine (const int lineNum, const char *value, UVarCalc *calc) |
void | setLineNumber (const int line) |
UMisItem () | |
virtual | ~UMisItem () |
Public Member Functions inherited from UDataBase | |
bool | isA (const char *typeString) |
virtual bool | isAlsoA (const char *typeString) |
virtual void | snprint (const char *preString, char *buff, const int buffCnt) |
UDataBase () | |
virtual | ~UDataBase () |
Static Public Member Functions | |
static bool | isRem (const char *r) |
Public Attributes | |
UMisItem * | next |
Protected Member Functions | |
int | symbolLength (const char *exp) |
Protected Attributes | |
int | lineNumber |
Class that holds a statement item of any type, blocked or single line
UMisItem::UMisItem | ( | ) |
Constructor
References lineNumber, and next.
|
virtual |
DEstructor
References next.
|
virtual |
execute item. result of executing this line normal is RV_OK, an error ir RV_SYNTAX_ERROR. The error text is to be returned in the errTxt buffer.
Reimplemented in UMisRemark, UMisControl, UMisIf, and UMisAssign.
References getDataType(), and RV_EMPTY.
Referenced by UMisRuleState::runLine().
const char * UMisItem::findStopChar | ( | const char * | source, |
char | stop | ||
) |
Find a caracter outside any strings or (sub) brackets Looking for a ':' in 'smr.do('drive : sin($odoth) < 0') : false' will find the second ':' as the first one is within a string delimiter (and in a bracket). Looking for a ')' in the same string will find the last ')' for the same reason. Looking for a ')' in 'atan2(sin(th), cos(45*(pi/180.0))) + 1)' will find the last bracket (after the 1), as the others are matched. Embedded strings in strings (or brackets) are allowed. Embedded brackets in strings are ignored. The string characters are quotes (") and apostrof (') - these MUST be matched.
source | is the string to look in |
References isRem().
Referenced by UMisAssign::setLine(), UMisLoop::setLine(), UMisControl::setLine(), and UMisRule::unpackLine().
|
inlinevirtual |
Get (end) type of this structure
Reimplemented from UDataBase.
Reimplemented in UMisRule, UMisString, UMisRemark, UMisControl, UMisCall, UMisCaseDefault, UMisCase, UMisCaseSwitch, UMisLoop, UMisEnable, UMisBreak, UMisIfElse, UMisIf, UMisAssign, and UMisLineItem.
Referenced by execute(), isA(), and UMisRuleState::runSwitch().
|
inline |
Get line number of this mission statement (or first line, if multi line statement)
Referenced by UMisRuleState::getStateStr(), UMisRuleState::initCall(), UMisRuleState::runBreak(), UMisRuleState::runControl(), UMisRuleState::runLine(), UMisRuleState::runLines(), UMisRuleState::runRuleCommands(), UMisRuleState::skipOneStatement(), and UMisRuleState::step().
bool UMisItem::isA | ( | const char * | matchType | ) |
Is this line of this specified type.
References getDataType().
Referenced by UMisRuleState::advanceToCase(), UMisRule::print(), UMisRuleState::runCall(), UMisRuleState::runLine(), UMisRuleState::runLines(), UMisRuleState::runLoop(), UMisRuleState::runMainLines(), UMisRuleState::runSwitch(), and UMisRuleState::skipOneStatement().
|
static |
Is this character (and possibly the next) a start of remark character A remark is the rest of a line starting with a ';' a '#' or a '//' pair
Referenced by UMisControl::evaluateCondition(), findStopChar(), UMisRuleState::runBreak(), UMisBreak::setLine(), and UMisCase::setLine().
|
virtual |
Print a mission item to buffer
preStr | a string to add before the plan lines |
buf | a string buffer to hold the plan |
bufCnt | the size of the buffer |
Reimplemented in UMisRule, and UMisLineItem.
References buf.
Referenced by UMisRule::print().
|
inlinevirtual |
Check the syntax validity of the statement.
cnn | is a pointer to the source - may be NULL if the source is unavailable |
Reimplemented in UMisControl, UMisCall, UMisCase, UMisCaseSwitch, UMisLoop, UMisEnable, UMisBreak, UMisIf, UMisAssign, and UMisLineItem.
References buf, and findStopChar().
Referenced by UMisRule::unpackLine().
|
inline |
Set source line number for this item
Referenced by UMisLineItem::setLine(), and UMisRule::unpackRule().
|
protected |
Find the number of characters from the start of this string
Referenced by UMisRule::checkSyntax(), UMisEnable::setLine(), UMisLoop::setLine(), and UMisRule::unpackLine().
|
protected |
source line number in mission file
Referenced by UMisControl::evaluateCondition(), UMisControl::execute(), UMisLoop::setLine(), and UMisItem().
UMisItem* UMisItem::next |
Next line in a line sequence
Referenced by UMisRule::addLine(), UMisRuleState::advanceToCase(), UMisRule::getLinesCnt(), UMisRule::print(), UMisRuleState::runLine(), UMisRuleState::runLines(), UMisRuleState::runLoop(), UMisRuleState::runRuleCommands(), UMisRuleState::runSwitch(), UMisRuleState::skipOneStatement(), UMisItem(), UMisRule::unpackInitPostBlock(), UMisRule::unpackRule(), UMisRule::unpackSequence(), and ~UMisItem().