AURobotServers  4
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
UMisSeqRoot Class Reference

#include <uresrulestate.h>

Inheritance diagram for UMisSeqRoot:
Inheritance graph

Public Member Functions

UResRulegetMissions ()
 
virtual UMisRulegetSubRule (const char *name)
 
void setMissions (UResRule *mis)
 
bool step (int *breakLevels, const bool aLastCall)
 
 UMisSeqRoot ()
 
 ~UMisSeqRoot ()
 
- Public Member Functions inherited from UMisRuleState
bool addRule (UMisRule *plan, bool activate)
 
UMisRuleStategetCalled ()
 Get called plan state If this plan is waiting in a called plan, get the called plan state. More...
 
UMisRuleStategetCaller (const char *name)
 get the state structure of the first caller of the plan with this name. The caller makes the plan busy, so it is nice to know who is calling this plan. More...
 
UMisRulegetRule ()
 
bool getStateStr (const char *pre, char *buff, const int buffCnt)
 
int getSubRulesCnt ()
 
bool isActive (const char *planName)
 is the subplan with this name active More...
 
bool isActive ()
 
bool isLogOpen ()
 
virtual bool methodCall (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct=NULL, int *returnStructCnt=NULL)
 
virtual bool methodCallV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct=NULL, int *returnStructCnt=NULL)
 
void remove ()
 
bool remove (const char *name)
 
bool setActive (bool doStart, bool onceOnly)
 
void setLogFile (ULogFile *logFile)
 
bool setParameters (double dpar[], int dparCnt)
 
bool setParameters (UVariable *params[], int paramsCnt)
 
bool setRule (UMisRule *plan, UMisRuleState *hasParent, ULogFile *logFile)
 
bool startStopRule (const char *planName, bool start)
 Start or stop one of the subplans for this mission Stating a started or stopping a stopped plan makes no change Stopping a started plan makes the plan execute any post-lines before inactivation Starting an rule sets also the auto-repeat flag. More...
 
bool step (int *breakLevels, const bool aLastCall)
 
void toLog (const char *logString)
 
 UMisRuleState ()
 
 ~UMisRuleState ()
 
- Public Member Functions inherited from UVarCalc
double evaluateD (const char *line, const char *start, const char **end, bool *evaluated, bool syntaxCheck)
 Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More...
 
bool evaluateParametersD (const char *sourceLine, const char **paramStart, double *paramValues, int *paramValuesCnt, char **paramStr, char *paramOrder, int maxParamCount, int maxParamStrCount, int maxParamStrLength)
 
bool evaluateParametersV (const char *sourceLine, const char **paramStart, char *paramOrder, UVariable *params[], int *paramsCnt, int maxParamsCnt)
 
bool evaluateToStringD (const char *sourceLine, const char *paramStart, const char **nextChar, char *dest, int destLength)
 
bool evaluateToStringV (const char *sourceLine, const char *paramStart, const char **nextChar, char *dest, int destLength)
 
double evaluateUnaryValD (const char *line, const char *start, const char **end, bool *evaluated, bool syntaxCheck)
 Evaluate an expression. More...
 
bool evaluateUnaryValV (const char *line, const char *start, const char **end, UVariable *value, bool syntaxCheck)
 
bool evaluateV (const char *line, const char *start, const char **end, UVariable *value, bool syntaxCheck)
 Evaluate an expression. More...
 
char * getErrorTxt ()
 
int getErrorTxtMaxCnt ()
 
bool getIdentifier (const char *id, int idCnt, const char *allowed, const char **oChar)
 
bool getValueAnyD (UVarPool *scope, const char *name, double *value, const char **params)
 Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More...
 
bool getValueAnyV (UVarPool *scope, const char *name, UVariable *value, const char **params)
 Get value for the variable or function call with this name Variables and functions in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More...
 
bool getVariableAny (UVarPool *scope, const char *name, UVariable *value)
 Get the variable with this name in the specified scope (incl. math) Variables in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More...
 
bool getVariableRefAny (UVarPool *scope, const char *name, UVariable **found, int *nameIndex)
 Get reference to variable with this name in the specified scope (incl. math) Variables in the local scope has first priority, then gradually one scope at a time until root scope. After that the math scope is tested. true if found. More...
 
bool isDefined (UVarPool *scope, const char *varName)
 Is this variable defined in the scope. The test is for variables and structures, and in the provided scope as well as any parent scope. further the math scope is tested too. More...
 
bool isRemark (const char *string)
 
bool setResource (UResBase *resource, bool remove)
 Called by server core when new resources are available. More...
 
 UVarCalc ()
 
virtual ~UVarCalc ()
 
- Public Member Functions inherited from UVarPool
int addMethod (UVarMethodImplement *implementor, const char *formalName, const char *paramTypes, const char *comment)
 
int addMethodV (UVarMethodImplement *implementor, const char *formalName, const char *paramTypes, const char *comment)
 
int addStruct (const char *name, UVarPool *varStruct)
 
int addStructLink (const char *name, UVarPool *toVarStruct)
 Add a link to another place in the var tree but do not change anything in the linked structure. More...
 
UVarPooladdStructLocal (const char *name, const char *note, bool copy)
 
UVariableaddVar (const char *name, const double initialValue, const char *type, const char *comment)
 
UVariableaddVar (const char *name, const double initialValue, UVariable::varType type, const char *comment, const char *attValue=NULL)
 
UVariableaddVar (const char *name, const UVariable *source, const char *comment)
 
UVariableaddVar (const char *name, const char *comment)
 
UVariableaddVarA (const char *name, const char *attValue, const char *type, const char *comment)
 
bool callGlobal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt)
 Call a method in the root var pool. It may be in this structure or in any sub-structure that the 'name' indicate. More...
 
bool callGlobalV (const char *name, const char *paramOrder, UVariable **params, UDataBase **returnStruct, int *returnStructCnt)
 Call a method from the root var pool scope It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More...
 
bool callLocal (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt)
 Call a method in this var pool. It may be in this structure or in any sub-structure that the 'name' indicate. More...
 
bool callLocalV (const char *name, const char *paramOrder, UVariable *params[], UDataBase **returnStruct, int *returnStructCnt)
 Call a method in this var pool (using UVariable parameters). It may be in this structure or in any sub-structure that the 'name' indicate. More...
 
bool callScope (const char *name, const char *paramOrder, char **strings, const double *doubles, double *value, UDataBase **returnStruct, int *returnStructCnt)
 Call a method in this scope, i.e. try if it fits a call in any of the parent var pools. It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More...
 
bool callScopeV (const char *name, const char *paramOrder, UVariable **params, UDataBase **returnStruct, int *returnStructCnt)
 Call a method in this scope - using UVariable parameters, i.e. try if it fits a call in any of the parent var pools. It may be in the structure direct (no '.') or in any sub-structure that the 'name.subname' indicate. More...
 
bool createVarSpace (const int varCnt, const int structCnt, const int methCnt, const char *note, bool copy)
 
void deleteAll ()
 
void deleteMethod (const char *name, const char *paramStr)
 
void deleteMethods (UVarMethodImplement *owner)
 
void deleteStruct (const char *name)
 
const char * getDescription ()
 
const char * getFullPreName (char *name, const int MNL)
 
const char * getFullPreName ()
 
bool getGlobalString (const char *name, const char **value)
 
bool getGlobalValue (const char *name, double *value)
 
bool getGlobalValue (const char *name, bool *value)
 
bool getGlobalValue (const char *name, UTime *value)
 
UVariablegetGlobalVariable (const char *name, int *element=NULL)
 get pointer to variable object NB! the returned pointer may be ilegal if module that owns the variable is unloaded so it must be used only while executing one command in main server core thread, if needed in a thread - like the sequencer, then get the value only - getValue(). More...
 
UVarMethodgetLocalMethod (const char *name, const char *paramList)
 
UVarPoolgetLocalMethod (const char *name, const char *paramList, UVarMethod **method)
 
UVarMethodgetLocalMethod (const int index)
 
int getLocalMethodIdx (const char *name, const char *paramList)
 Get index of this method in this var pool. More...
 
double getLocalValue (int idx, int element=0)
 
bool getLocalValue (const char *name, double *value)
 
bool getLocalValue (const char *name, bool *value)
 
bool getLocalValue (const char *name, UTime *value)
 
UPosition getLocalValue3D (int idx)
 
UPosRot getLocalValue6D (int idx)
 
bool getLocalValueBool (int idx)
 
int getLocalValueInt (int idx)
 
UPose getLocalValuePose (int idx)
 
URotation getLocalValueRot (int idx)
 
UTime getLocalValueTime (int idx)
 
UVariablegetLocalVar (int index)
 
UVariablegetLocalVariable (const char *name, int *element)
 get pointer to variable object in this variable tree More...
 
int getLocalVarIndex (const char *name, int *element)
 
ULogFilegetLogVar ()
 
ULockgetLogVarLock ()
 
int getMethodCnt ()
 
int getMethodMax ()
 
UVarPoolgetParentVarPool ()
 
UVarPoolgetParentVarPoolScope ()
 
const char * getPreName ()
 
UVarPoolgetRootVarPool ()
 
bool getScopeValue (const char *name, double *value)
 
UVarPoolgetStruct (const char *name)
 
UVarPoolgetStruct (const int idx)
 
int getStructCnt ()
 
UVarPoolgetStructDeep (const char *fullName, char *varName, const int varNameCnt)
 
UVarPoolgetStructDeep (const char *fullName, const bool mayAdd, char *varName, const int varNameCnt)
 
int getStructIdx (const char *name)
 
int getStructMax ()
 
const char * getVarDescription (int idx)
 
int getVarMax ()
 
char * getVarName (int index)
 
UVariable ** getVars ()
 
int getVarsCnt ()
 
bool isLogfileOpen ()
 
bool isVarPoolVerbose ()
 
void listVars (const char *preStr, char *buff, const int buffCnt, bool andStructs)
 
void setDescription (const char *note, bool copy)
 
bool setGlobalVar (const char *name, const double value, bool mayAdd)
 Assigns a value to a variable. The variable may be a part of a structure. More...
 
bool setLocalVar (const int index, const double value, const int element)
 
bool setLocalVar (const int index, UVariable *value)
 
bool setLocalVar (const char *name, const double value, bool mayAdd, UVariable::varType vartyp, const char *attValue=NULL)
 Assigns a value to a variable. The variable may be a part of a structure. More...
 
bool setLocalVar (const char *name, const char *value, bool mayAdd, const char *vartyp, UTime *updTime=NULL, bool *added=NULL)
 Assigns a value to a variable. The variable may be a part of a structure. More...
 
bool setLocalVar3D (int idx, UPosition *value)
 
bool setLocalVar6D (int idx, UPosRot *value)
 
bool setLocalVarAdd (const int index, const double value, const int element)
 
bool setLocalVarPose (int idx, UPose *value)
 
bool setLocalVarRot (int idx, URotation *value)
 
void setLogfile (ULogFile *fileHandle, ULock *fileLock)
 
void setParentVarPool (UVarPool *parent)
 
void setParentVarPoolScope (UVarPool *parent)
 
bool setPreName (const char *name)
 
bool setScopeVar (const char *name, const double value, bool mayAdd)
 
bool setScopeVar (const char *name, const UVariable *source, bool mayAdd)
 
void setVerbose (bool value)
 
 UVarPool ()
 
virtual ~UVarPool ()
 
- Public Member Functions inherited from ULock
bool lock ()
 
void lockInit ()
 
void post ()
 
bool tryLock ()
 
bool tryWait ()
 
 ULock ()
 
void unlock ()
 
bool wait ()
 
 ~ULock ()
 
- Public Member Functions inherited from UServerPush
int addPushCommand (UServerInMsg *msg)
 
virtual void callGotNewDataWithObject ()
 
bool doPushCall (UServerPushElement *pe, const char *value)
 
void flushClientCmds (int clientIdx)
 
UServerPushImplementgetImplementor ()
 
int getPushCmdCnt (int *cmdCnt, int *callCnt)
 
UServerPushQueuegetPushQueue ()
 
bool gotCmdExe ()
 
void gotNewData (void *pData)
 
bool isUpdated (int lastCnt, int *newCnt)
 
bool needNewData ()
 
void print (const char *preString)
 
void print (const char *preString, char *buff, int buffCnt)
 
void servicePendingPushCmds ()
 
void setCmdExe (UServerPushImplement *executor)
 
void setImplementor (UServerPushImplement *executor)
 
bool setResource (UResBase *resource, bool remove)
 
bool setUpdated (const char *value)
 Add watch object if needed. An image or other object is updated. set object as updated, with an extra qualifier, that may be used as a parameter in a push call. this push list is then added to the to the push list examined by the server thread. when server thread reach this push list it will call to get a possible associated data structure by a call to needNewData() whish is expected to call gotNewData(void * data_structure) - but now in the server thread. More...
 
 UServerPush ()
 
virtual ~UServerPush ()
 
- Public Member Functions inherited from UVarMethodImplement
virtual ~UVarMethodImplement ()
 

Protected Member Functions

virtual void createBaseVar ()
 
- Protected Member Functions inherited from UMisRuleState
void advanceToCase ()
 
bool createParameterVar (bool syntaxCheck)
 
UMisRuleStategetSubRuleState (const char *name)
 
UMisItem::ResultValue initCall (bool inLine, bool extraPar, int extraParVal)
 
bool isInMain ()
 
void logActualCall (const int lineNumber, const char *funcName, const char *parOrder, char *sppar[], double dpar[])
 
void logActualCallV (const int lineNumber, const char *funcName, const char *parOrder, UVariable **params)
 
int methodWait (double secs, int repeat)
 Implement a wait control method when called first time (repeat == 0) the start time is stored. on subsequent calles (repeat > 0) then time passed is calculated in return value is set accordingly. More...
 
UMisItem::ResultValue runBreak (int *breakLevels)
 
UMisItem::ResultValue runCall (int *breakLevels, bool lastCall)
 Execute a call to a rule. More...
 
UMisItem::ResultValue runCase (int *breakLevels)
 
UMisItem::ResultValue runControl (int *breakLevels, bool lastCall)
 Execute a control call. More...
 
UMisItem::ResultValue runEnable (UMisEnable *eLine)
 
UMisItem::ResultValue runLine (bool lastCall, int *breakLevels)
 
UMisItem::ResultValue runLines (int *breakLevels, int maxStatements)
 
UMisItem::ResultValue runLoop (int *breakLevels, UMisLoop *lLine)
 
bool runMainLines (int *breakLevel, const bool lastCall)
 
bool runRuleCommands ()
 
UMisItem::ResultValue runSwitch (UMisItem *nextLine)
 
bool skipOneStatement (bool anIf)
 
- Protected Member Functions inherited from UVarCalc
virtual bool getLocalScopeVaiable (const char *name, double *value)
 
- Protected Member Functions inherited from UVarPool
bool createFunctionStack (const int maxCount)
 
bool createVarPoolStack (const int maxCount)
 
bool createVarStack (const int maxCount)
 
virtual bool evaluateSystemFunction (const char *name, const double pars[], int parsCnt, double *value, bool syntaxCheck)
 

Protected Attributes

UResRulemissions
 
UVariablevarSteps
 
- Protected Attributes inherited from UMisRuleState
bool automaticRestart
 
int automaticRestartCnt
 
BlockState blockState
 
UMisRuleStateerrBlock
 
int errCnt
 
int errLevel
 
UMisRuleStateinCall
 
bool inIf [inIfCntMax]
 
int inIfCnt
 
bool initialized
 is the rule initialized More...
 
ULogFilelogf
 
UMisRulemisRule
 
UMisRuleStateparent
 
int seqAgainCnt
 
UMisItemseqLine
 
UMisRuleStatesubRules [MAX_SUBPLANS]
 
int subRulesCnt
 
UVariable ** varParameters
 
UVariablevarWait
 
UTime waitStart
 
- Protected Attributes inherited from UVarCalc
char errorTxt [MAX_ERROR_SIZE]
 
- Protected Attributes inherited from UVarPool
const char * description
 
ULogFilelogVar
 
ULocklogVarLock
 
UVarPool ** varPools
 
bool * varPoolsLocal
 
bool verbose
 

Additional Inherited Members

- Public Types inherited from UMisRuleState
enum  BlockState { inactive, init, main, post }
 
- Static Protected Attributes inherited from UMisRuleState
static const int inIfCntMax = 10
 
static const int MAX_SUBPLANS = 100
 

Constructor & Destructor Documentation

UMisSeqRoot::UMisSeqRoot ( )
inline

Constructor

References UMisRuleState::createBaseVar().

UMisSeqRoot::~UMisSeqRoot ( )
inline

Destructor

Member Function Documentation

void UMisSeqRoot::createBaseVar ( )
protectedvirtual

A varPool method with this class as implementor is called.

Parameters
nameis the name of the called function
paramOrderis a string with one char for each parameter in the call - d is double, s is string, c is class object.
stringsis an array of string pointers for the string type parameters (may be NULL if not used)
doublesis an array with double typed parameters (may be NULL if not used)
valueis the (direct) result of the class, either a double value, or 0.0 for false 1.0 for true (2.0 for implicit stop if a controll call from mission sequencer).
returnStructis an array of class object pointers that can be used as parameters or return objects (may be NULL)
returnStructCntis the number of objects in the returnStruct buffer
Returns
true if the method is recognised (exists), when false is returned a invalid name or parameter list is detected. Create variables and local functions

Reimplemented from UMisRuleState.

References UVarPool::addVar().

UResRule* UMisSeqRoot::getMissions ( )
inline

get the pointer to the mission resource

References UMisRuleState::createBaseVar(), UMisRuleState::getSubRule(), and UMisRuleState::step().

UMisRule * UMisSeqRoot::getSubRule ( const char *  name)
virtual

Get related plan, try: 1 daughter plans, 2 parent's daughter plans (sisters), 3-N grand-parent's daughters until no more parents 4 search root level missions, that has is not known to the sequencer yet.

Parameters
namename of the plan
Returns
a pointer to the first found plan

Reimplemented from UMisRuleState.

References UMisRuleState::getSubRule().

void UMisSeqRoot::setMissions ( UResRule mis)
inline

Set the pointer to the mission resource

bool UMisSeqRoot::step ( int *  breakLevels,
const bool  aLastCall 
)

Execute a step in this plan. This means allow all active subplans to step first, then make a step of the main function of this plan.

Parameters
breakLevelsthe levels og plans that are to be removed, i.e. if breakLevels returns 1 when this level is completed, that is all postLines are executed and all postLines of subRules are executed too.
aLastCallwhen true, this is the last call to this plan, and the plan should do a last call and run the post-lines.
Returns
true if the step did not meet an execution error

References UMisRuleState::step().

Member Data Documentation

UResRule* UMisSeqRoot::missions
protected

Pointer to the missions resource, to get hold of other root plans

UVariable* UMisSeqRoot::varSteps
protected

Index to step counter


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