AURobotServers  4
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
UMisItem Class Reference

#include <urule.h>

Inheritance diagram for UMisItem:
Inheritance graph

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

UMisItemnext
 

Protected Member Functions

int symbolLength (const char *exp)
 

Protected Attributes

int lineNumber
 

Detailed Description

Class that holds a statement item of any type, blocked or single line

Member Enumeration Documentation

Possible return values of an evaluation

Enumerator
RV_EMPTY 
RV_OK 
RV_OK_FALSE 
RV_OK_AGAIN 
RV_SYNTAX_ERROR 
RV_FAILED 
RV_IF_TRUE 
RV_IF_FALSE 

Constructor & Destructor Documentation

UMisItem::UMisItem ( )

Constructor

References lineNumber, and next.

UMisItem::~UMisItem ( )
virtual

DEstructor

References next.

Member Function Documentation

UMisItem::ResultValue UMisItem::execute ( UVarCalc calc,
int  state 
)
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.

Parameters
sourceis the string to look in
Returns
a pointer to the found stop character, or NULL if not found.

References isRem().

Referenced by UMisAssign::setLine(), UMisLoop::setLine(), UMisControl::setLine(), and UMisRule::unpackLine().

virtual const char* UMisItem::getDataType ( )
inlinevirtual
int UMisItem::getLineNumber ( )
inline
bool UMisItem::isA ( const char *  matchType)
bool UMisItem::isRem ( const char *  r)
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().

const char * UMisItem::print ( const char *  preStr,
char *  buf,
const int  bufCnt 
)
virtual

Print a mission item to buffer

Parameters
preStra string to add before the plan lines
bufa string buffer to hold the plan
bufCntthe size of the buffer

Reimplemented in UMisRule, and UMisLineItem.

References buf.

Referenced by UMisRule::print().

virtual bool UMisItem::setLine ( const int  lineNum,
const char *  value,
UVarCalc calc 
)
inlinevirtual

Check the syntax validity of the statement.

Parameters
cnnis a pointer to the source - may be NULL if the source is unavailable
Returns
true if no errors were found. Set the command line

Reimplemented in UMisControl, UMisCall, UMisCase, UMisCaseSwitch, UMisLoop, UMisEnable, UMisBreak, UMisIf, UMisAssign, and UMisLineItem.

References buf, and findStopChar().

Referenced by UMisRule::unpackLine().

void UMisItem::setLineNumber ( const int  line)
inline

Set source line number for this item

Referenced by UMisLineItem::setLine(), and UMisRule::unpackRule().

int UMisItem::symbolLength ( const char *  exp)
protected

Find the number of characters from the start of this string

Referenced by UMisRule::checkSyntax(), UMisEnable::setLine(), UMisLoop::setLine(), and UMisRule::unpackLine().

Member Data Documentation

int UMisItem::lineNumber
protected

source line number in mission file

Referenced by UMisControl::evaluateCondition(), UMisControl::execute(), UMisLoop::setLine(), and UMisItem().

UMisItem* UMisItem::next

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