160 |
* @see exprType() |
* @see exprType() |
161 |
*/ |
*/ |
162 |
VMIntArrayExpr* asIntArray() const; |
VMIntArrayExpr* asIntArray() const; |
163 |
|
|
164 |
|
/** |
165 |
|
* Returns true in case this expression can be considered to be a |
166 |
|
* constant expression. A constant expression will retain the same |
167 |
|
* value throughout the entire life time of a script and the |
168 |
|
* expression's constant value may be evaluated already at script |
169 |
|
* parse time, which may result in performance benefits during script |
170 |
|
* runtime. |
171 |
|
*/ |
172 |
|
virtual bool isConstExpr() const = 0; |
173 |
|
|
174 |
|
bool isModifyable() const; |
175 |
}; |
}; |
176 |
|
|
177 |
/** @brief Virtual machine integer expression |
/** @brief Virtual machine integer expression |
378 |
virtual ExprType_t argType(int iArg) const = 0; |
virtual ExprType_t argType(int iArg) const = 0; |
379 |
|
|
380 |
/** |
/** |
381 |
* This function is called by the parser to check whether arguments |
* This method is called by the parser to check whether arguments |
382 |
* passed in scripts to this function are accepted by this function. If |
* passed in scripts to this function are accepted by this function. If |
383 |
* a script calls this function with an argument's data type not |
* a script calls this function with an argument's data type not |
384 |
* accepted by this function, the parser will throw a parser error. On |
* accepted by this function, the parser will throw a parser error. On |
396 |
virtual bool acceptsArgType(int iArg, ExprType_t type) const = 0; |
virtual bool acceptsArgType(int iArg, ExprType_t type) const = 0; |
397 |
|
|
398 |
/** |
/** |
399 |
|
* This method is called by the parser to check whether some arguments |
400 |
|
* (and if yes which ones) passed to this script function will be |
401 |
|
* modified by this script function. Most script functions simply use |
402 |
|
* their arguments as inputs, that is they only read the argument's |
403 |
|
* values. However some script function may also use passed |
404 |
|
* argument(s) as output variables. In this case the function |
405 |
|
* implementation must return @c true for the respective argument |
406 |
|
* index here. |
407 |
|
* |
408 |
|
* @param iArg - index of the function argument in question |
409 |
|
* (must be between 0 .. maxAllowedArgs() - 1) |
410 |
|
*/ |
411 |
|
virtual bool modifiesArg(int iArg) const = 0; |
412 |
|
|
413 |
|
/** |
414 |
* Implements the actual function execution. This exec() method is |
* Implements the actual function execution. This exec() method is |
415 |
* called by the VM whenever this function implementation shall be |
* called by the VM whenever this function implementation shall be |
416 |
* executed at script runtime. This method blocks until the function |
* executed at script runtime. This method blocks until the function |
580 |
VMInt8Array() : data(NULL), size(0) {} |
VMInt8Array() : data(NULL), size(0) {} |
581 |
}; |
}; |
582 |
|
|
583 |
|
/** @brief Virtual machine script variable. |
584 |
|
* |
585 |
|
* Common interface for all variables accessed in scripts. |
586 |
|
*/ |
587 |
|
class VMVariable : virtual public VMExpr { |
588 |
|
public: |
589 |
|
/** |
590 |
|
* Whether a script may modify the content of this variable by |
591 |
|
* assigning a new value to it. |
592 |
|
* |
593 |
|
* @see isConstExpr(), assign() |
594 |
|
*/ |
595 |
|
virtual bool isAssignable() const = 0; |
596 |
|
|
597 |
|
/** |
598 |
|
* In case this variable is assignable, this method will be called to |
599 |
|
* perform the value assignment to this variable with @a expr |
600 |
|
* reflecting the new value to be assigned. |
601 |
|
* |
602 |
|
* @param expr - new value to be assigned to this variable |
603 |
|
*/ |
604 |
|
virtual void assignExpr(VMExpr* expr) = 0; |
605 |
|
}; |
606 |
|
|
607 |
/** @brief Dynamically executed variable (abstract base class). |
/** @brief Dynamically executed variable (abstract base class). |
608 |
* |
* |
609 |
* Interface for the implementation of a dynamically generated content of |
* Interface for the implementation of a dynamically generated content of |
614 |
* to a dynamic variable some native code is executed to actually generate |
* to a dynamic variable some native code is executed to actually generate |
615 |
* and provide the content (value) of this type of variable. |
* and provide the content (value) of this type of variable. |
616 |
*/ |
*/ |
617 |
class VMDynVar : virtual public VMExpr { |
class VMDynVar : public VMVariable { |
618 |
public: |
public: |
619 |
/** |
/** |
|
* Whether a script may modify the content of this dynamic variable by |
|
|
* assigning a new value to it. |
|
|
* |
|
|
* @see isConstExpr(), assign() |
|
|
*/ |
|
|
virtual bool isAssignable() const = 0; |
|
|
|
|
|
/** |
|
620 |
* Returns true in case this dynamic variable can be considered to be a |
* Returns true in case this dynamic variable can be considered to be a |
621 |
* constant expression. A constant expression will retain the same value |
* constant expression. A constant expression will retain the same value |
622 |
* throughout the entire life time of a script and the expression's |
* throughout the entire life time of a script and the expression's |
652 |
* |
* |
653 |
* @see isAssignable() |
* @see isAssignable() |
654 |
*/ |
*/ |
655 |
virtual bool isConstExpr() const { return false; } |
bool isConstExpr() const OVERRIDE { return false; } |
656 |
|
|
657 |
/** |
/** |
658 |
* In case this dynamic variable is assignable, the new value (content) |
* In case this dynamic variable is assignable, the new value (content) |
664 |
* |
* |
665 |
* @param expr - new value to be assigned to this variable |
* @param expr - new value to be assigned to this variable |
666 |
*/ |
*/ |
667 |
virtual void assign(VMExpr* expr) {} |
void assignExpr(VMExpr* expr) OVERRIDE {} |
668 |
}; |
}; |
669 |
|
|
670 |
/** @brief Dynamically executed variable (of integer data type). |
/** @brief Dynamically executed variable (of integer data type). |