AURobotServers
4
|
#include <urule.h>
Public Member Functions | |
void | addIniLine (UMisItem *newLine) |
void | addMainLine (UMisItem *newLine) |
void | addPostLine (UMisItem *newLine) |
virtual const char * | getDataType () |
const char * | getFileName () |
UMisItem * | getIniLines () |
int | getIniLinesCnt () |
UMisItem * | getMainLines () |
int | getMainLinesCnt () |
const char * | getName () |
UMisItem * | getPostLines () |
int | getPostLinesCnt () |
virtual bool | isEdit () |
virtual const char * | print (const char *preStr, char *buf, const int bufCnt) |
virtual int | setBusyCnt (int delta) |
void | setCalc (UVarCalc *calculator) |
void | setLogFile (ULogFile *logFile) |
void | setName (const char *toName) |
UMisRule () | |
bool | unpackRule (USmlSource *cnn, USmlTag *tag) |
virtual | ~UMisRule () |
Public Member Functions inherited from UMisItem | |
virtual ResultValue | execute (UVarCalc *calc, int state) |
const char * | findStopChar (const char *source, char stop) |
int | getLineNumber () |
bool | isA (const char *matchType) |
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 () |
Public Attributes | |
char * | condition |
string | dependPlugin |
string | description |
char * | destination |
bool | isFull |
bool | isLoop |
bool | isRule |
bool | isRun |
bool | isSwitch |
bool | isTop |
ULogFile * | logm |
int | order |
Priority order of this plan - relative to other (sub) plans. This value controls in wich order the list of (sub) plans are assigned processing time, i.e. if a number of sub-plans evaluate some value - e.g. the robot pose - then thise can be assigned to be evaluated before another subplan, that combines or selects the usable results from the others. A priority with a low number is executed first. The value range is 1..100, where 1 is executed before the others. if two plans have the same priority order, then the order is un-determined. Default value is 50. More... | |
char * | parameters |
int | parametersCnt |
int | switchValue |
Public Attributes inherited from UMisItem | |
UMisItem * | next |
Protected Types | |
enum | MisPart { MP_INIT, MP_MAIN, MP_POST } |
Protected Member Functions | |
void | addLine (UMisItem *elemList, UMisItem *newLine) |
virtual bool | checkSyntax (USmlSource *cnn) |
virtual const char * | getEditLines () |
int | getLinesCnt (UMisItem *fromLine) |
int | trimWhiteSpace (char *s) |
bool | unpackBlock (USmlSource *cnn, USmlTag *tag, UMisItem **itemList) |
bool | unpackInitPostBlock (USmlSource *cnn, USmlTag *tag, UMisItem **itemList, MisPart iniBlock) |
bool | unpackLine (USmlSource *cnn, char *line, UMisItem **itemNext, int lineNum, MisPart iniBlock) |
bool | unpackSequence (USmlSource *cnn, char *lines, UMisItem **itemList, int lineNum, MisPart iniBlock=MP_MAIN) |
Protected Member Functions inherited from UMisItem | |
int | symbolLength (const char *exp) |
Protected Attributes | |
UVarCalc * | calc |
char | fileName [MAX_FILENAME_LENGTH] |
bool | inEditAppend |
UMisItem * | iniLines |
UMisItem * | mainLines |
char | name [MAX_VAR_NAME_SIZE] |
UMisItem * | postLines |
Protected Attributes inherited from UMisItem | |
int | lineNumber |
Additional Inherited Members | |
Public Types inherited from UMisItem | |
enum | ResultValue { RV_EMPTY, RV_OK, RV_OK_FALSE, RV_OK_AGAIN, RV_SYNTAX_ERROR, RV_FAILED, RV_IF_TRUE, RV_IF_FALSE } |
Static Public Member Functions inherited from UMisItem | |
static bool | isRem (const char *r) |
Class that holds the base for a mission or a mission segment
|
protected |
UMisRule::UMisRule | ( | ) |
Constructor
|
virtual |
DEstructor
|
inline |
Add a line to the ini-segment
Add a line to this segment
References UMisItem::next.
|
inline |
Add a line to the ini-segment
|
inline |
Add a line to the ini-segment
|
protectedvirtual |
Check the syntax validity of the block statement (not the lines in the block).
cnn | is a pointer to the source - may be NULL if the source is unavailable |
References UMisItem::symbolLength(), and USmlSource::syntaxError().
|
inlinevirtual |
Get (end) type of this structure
Reimplemented from UMisItem.
|
inlineprotectedvirtual |
Get the edit lines (un-implemented parts of a plan)
Reimplemented in UMisLoadedRule.
|
inline |
Get plan name
References buf.
Referenced by UMisRuleState::getStateStr(), and UFuncRule::listMission().
|
inline |
Get the first ini-line
Referenced by UMisRuleState::step().
|
inline |
Get number of ini-lines returns number of ini-lines
|
protected |
Count number of (remaining lines fstarting at this line
References UMisItem::next.
|
inline |
Get the first main-line
Referenced by UMisRuleState::getStateStr(), and UMisRuleState::step().
|
inline |
Get number of main-lines returns number of main-lines
|
inline |
Get plan name
Referenced by UResRuleState::addRule(), UMisRuleState::getCaller(), UResRule::getRule(), UMisRuleState::getStateStr(), UMisRuleState::getSubRule(), UMisRuleState::getSubRuleState(), UFuncRule::listAllMissions(), UMisRuleState::methodCallV(), UMisRuleState::remove(), UMisRuleState::runBreak(), UMisRuleState::runCall(), UMisRuleState::runControl(), UMisRuleState::setParameters(), UMisRuleState::setRule(), and UFuncRule::unloadRule().
|
inline |
Get the first post-line
Referenced by UMisRuleState::step().
|
inline |
Get number of post-lines returns number of post-lines
|
inlinevirtual |
Is this plan in editing mode - i.e. append is allowed
Reimplemented in UMisLoadedRule.
|
virtual |
Print mission plan 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 from UMisItem.
References buf, UMisItem::isA(), UMisItem::next, UMisItem::print(), str2xml(), and str2xmlMin().
Referenced by UResRule::getRuleList(), UFuncRule::listAllMissions(), and UResRule::UResRule().
|
inlinevirtual |
Adjust the number of times this plan is beeing used by the sequencer - add 1 every time it is used in a plan state and remove one when plan state is released
Reimplemented in UMisLoadedRule.
Referenced by UMisRuleState::initCall(), UMisRuleState::remove(), UMisRuleState::runCall(), and UMisRuleState::runControl().
|
inline |
set syntax check var pool calculator
Referenced by UMisLoadedRule::completeEdit(), UMisLoadedRule::unpack(), and unpackBlock().
|
inline |
Set logfile
Referenced by UResRule::completeEdit(), unpackBlock(), and UResRule::unpackMissionRule().
|
inline |
|
protected |
TRim off all pre and post white space and line feeds
s | c-string to trim |
|
protected |
Unpack a block structure - either a command or an block (if, loop or otherwise) This is the same as a plan, but without the init and post structures.
cnn | is the source for more data (the XML file) |
tag | is the block start tag |
itemList | is the position of the pointer, where the block is to be added |
References setCalc(), setLogFile(), and unpackRule().
|
protected |
Unpacks a sequence of statements until the end-tag is discovered. The statements are added to the pointer in the item list.
cnn | is the source for more data (the XML file) |
tag | is the block start tag |
itemList | is the position of the pointer, where the block is to be added |
iniBlock | flag for specific block part 0=main, 1=ini, 2=post |
References USmlSource::getLineNumber(), USmlSource::getNextTag(), USmlTagIn::getTagName(), USmlTagIn::isAStartTag(), USmlTagIn::isTagA(), USmlTagIn::isTagAnEnd(), UMisItem::next, USmlSource::skipToEndTag(), USmlSource::syntaxError(), and xml2str().
|
protected |
Unpack a text line to any of the allowed line types, that is if, call, remark, control or assignment.
line | the line to unpack |
itemNext | the pointer that should point to the new line |
iniBlock | flag for specific block part 0=main, 1=ini, 2=post |
References UMisItem::findStopChar(), UMisItem::setLine(), UMisItem::symbolLength(), and USmlSource::syntaxError().
bool UMisRule::unpackRule | ( | USmlSource * | cnn, |
USmlTag * | tag | ||
) |
unpack from XML source
References USmlTagIn::getAttValue(), USmlTagIn::getAttValueBool(), USmlTagIn::getAttValueInt(), USmlSource::getErrorBuffer(), USmlSource::getLineNumber(), USmlTagIn::getNext(), USmlTagIn::getNextAttribute(), USmlSource::getNextTag(), USmlSource::getSourceName(), USmlTagIn::getTagName(), USmlTagIn::getToEnd(), USmlSource::getToEndTag(), USmlTagIn::isAFullTag(), USmlTagIn::isAStartTag(), USmlSource::isErrorText(), USmlSource::isSourceAvailable(), USmlTagIn::isTagA(), USmlTagIn::isTagAnEnd(), MAX_FILENAME_LENGTH, MAX_VAR_NAME_SIZE, UMisItem::next, USmlTagIn::reset(), UMisItem::setLineNumber(), USmlSource::skipToEndTag(), USmlSource::syntaxError(), and xml2str().
Referenced by UMisLoadedRule::completeEdit(), UMisLoadedRule::unpack(), and unpackBlock().
|
protected |
Unpacks a sequence of statements until the end-tag is discovered. The statements are added to the pointer in the item list.
cnn | is the source for more data (the XML file) |
lines | text buffer with line separated expressions |
itemList | is the position of the pointer, where the block is to be added |
iniBlock | flag for specific block part 0=main (default), 1=ini, 2=post |
References UMisItem::next.
|
protected |
Syntax check calculator
char* UMisRule::condition |
Condition string at start of block Must be evaluated to true to execute block
Referenced by UMisRuleState::getStateStr(), UMisRuleState::methodCall(), and UMisRuleState::step().
string UMisRule::dependPlugin |
Dependency, this is a list of plugin dependecies - a space separated list of plug-in modules that need to be present for this mission to succeed. If some of the listed plug-ins are optional, there should be a note in the description, so that the user may select to start the mission anyhow. The list is therefore not enforced as mandatory, but a tool for the user.
string UMisRule::description |
Description string
char* UMisRule::destination |
destination if the block is to be implemented by another command enterpreter. This could be 'server.send' or 'smr.send'
Referenced by UMisRuleState::runRuleCommands(), and UMisRuleState::step().
|
protected |
filename
Referenced by UResRule::getSyntaxErrorString().
|
protected |
is the current plan in edit-append mode. this will affect the handling of xml blocks to allow end of (file) with no XML end tag.
Referenced by UMisLoadedRule::completeEdit().
|
protected |
First ini-line
bool UMisRule::isFull |
Is this a full rule or just a block (isPlan == false) - only full rules have init and post structures
Referenced by UResRule::addNewRule(), UMisRuleState::runBreak(), UMisRuleState::runMainLines(), and UMisRuleState::step().
bool UMisRule::isLoop |
Is this block a loop
bool UMisRule::isRule |
Is this plan a rule - has an if attrubute
Referenced by UMisRuleState::addRule(), UFuncRule::listAllMissions(), and UMisRuleState::runEnable().
bool UMisRule::isRun |
Is this plan a flagged to run when loaded
Referenced by UMisRuleState::addRule(), and UFuncRule::listAllMissions().
bool UMisRule::isSwitch |
It this block part of a switch statement
Referenced by UMisRuleState::runBreak(), UMisRuleState::runSwitch(), and UMisRuleState::step().
bool UMisRule::isTop |
Is this plan a top level executable mission
Referenced by UResRule::addNewRule(), UMisRuleState::runBreak(), and UResRule::unpackMissionRule().
ULogFile* UMisRule::logm |
Logfile for any mission load statements
|
protected |
First main-line
|
protected |
Name of rule or block
Referenced by UResRule::getRule(), UResRule::tryUnloadRule(), and UResRule::UResRule().
int UMisRule::order |
Priority order of this plan - relative to other (sub) plans. This value controls in wich order the list of (sub) plans are assigned processing time, i.e. if a number of sub-plans evaluate some value - e.g. the robot pose - then thise can be assigned to be evaluated before another subplan, that combines or selects the usable results from the others. A priority with a low number is executed first. The value range is 1..100, where 1 is executed before the others. if two plans have the same priority order, then the order is un-determined. Default value is 50.
Referenced by UMisRuleState::runMainLines().
char* UMisRule::parameters |
Parameter string to be implemented at start of block Could be 'x=1 y=2 th=0.57' these should be created on varpool with these default values.
Referenced by UMisRuleState::createParameterVar(), and UMisRuleState::setRule().
int UMisRule::parametersCnt |
number of parameters found in plan
Referenced by UMisRuleState::createParameterVar(), UMisRuleState::initCall(), and UMisRuleState::setParameters().
|
protected |
First post-line
int UMisRule::switchValue |
The switch value
Referenced by UMisRuleState::advanceToCase(), and UMisRuleState::runSwitch().