#include <dve_expression.hh>
Public Member Functions | |
virtual void | assign (const expression_t &expr) |
Implements expression_t::assign() in DVE system. | |
dve_expression_t (const dve_expression_t &expr) | |
A copy constructor. | |
dve_expression_t (const std::string &str_expr, system_t *const system, size_int_t process_gid=NO_ID) | |
A constructor from a string. | |
dve_expression_t (int expr_op, const dve_expression_t &expr_left, system_t *const system=0) | |
dve_expression_t (int expr_op, const dve_expression_t &expr_left, const dve_expression_t &expr_right, system_t *const system=0) | |
dve_expression_t (int expr_op, std::stack< dve_expression_t * > &subexprs_stack, const short int ar=0, system_t *const system=0) | |
A constructor used by a parser. | |
dve_expression_t (system_t *const system=0) | |
A contructor of empty expression. | |
virtual int | from_string (std::string &expr_str, const size_int_t process_gid=NO_ID) |
Implements expression_t::from_string() in DVE system. | |
virtual int | read (std::istream &istr, size_int_t process_gid=NO_ID) |
Implements expression_t::read() in DVE system. | |
virtual void | swap (expression_t &expr) |
Implements expression_t::swap() in DVE system. | |
virtual std::string | to_string () const |
Implements expression_t::to_string() in DVE system. | |
virtual void | write (std::ostream &ostr) const |
Implements expression_t::write() in DVE system. | |
virtual | ~dve_expression_t () |
DVE system specific methods | |
These methods are implemented only in DVE system and they cannot be run using an abstract interface of expression_t | |
size_int_t | arity () const |
void | compaction () |
Computes compatc version of the expression (single memory block). | |
size_int_t | get_ident_gid () const |
int | get_operator () const |
compacted_viewer_t * | get_p_compact () const |
Returns pointer to compacted representation. | |
dve_symbol_table_t * | get_symbol_table () const |
Returns a pointer to the symbol table corresponding to this expression. | |
all_values_t | get_value () const |
bool | is_compacted () const |
Says whether the expression is compacted. | |
const dve_expression_t * | left () const |
Returns the left-most constant immediate subexpression. | |
dve_expression_t * | left () |
Returns the left-most immediate subexpression. | |
const dve_expression_t * | right () const |
Returns the right-most constant immediate subexpression. | |
dve_expression_t * | right () |
Returns the right-most immediate subexpression. | |
void | set_arity (const size_int_t new_arity) |
void | set_ident_gid (const size_int_t gid) |
void | set_operator (const int oper) |
void | set_value (const all_values_t value) |
const dve_expression_t * | subexpr (size_int_t index) const |
Returns the `index'-th constant immediate subexpression. | |
dve_expression_t * | subexpr (size_int_t index) |
Returns the `index'-th immediate subexpression. |
This class implements the abstract interface of expression_t and moreover it provides many methods beside methods of that interface.
Expressions are stored in a structure of a syntax tree. The methods of class dve_expression_t enables to obtain or change the informations about the top-most node in a syntax tree of the expression. To edit the lower levels of the syntax tree you can use methods left(), right() and subexpr().
The syntax tree is little different than you are probably used to. The inner nodes may contain following operators:
The leaf nodes may contain following operators:
table->get_state(expr->get_ident_gid())->get_process_gid()
. ~dve_expression_t | ( | ) | [virtual] |
IMPLEMENTATION OF VIRTUAL INTERFACE OF expression_t ///// A destructor.
dve_expression_t | ( | int | expr_op, | |
const dve_expression_t & | expr_left, | |||
const dve_expression_t & | expr_right, | |||
system_t *const | system = 0 | |||
) | [inline] |
A constructor that creates a new expression from 2 expressions and an operator.
dve_expression_t | ( | int | expr_op, | |
const dve_expression_t & | expr_left, | |||
system_t *const | system = 0 | |||
) | [inline] |
A constructor that creates a new expression from 1 expression and an operator.
dve_expression_t | ( | const std::string & | str_expr, | |
system_t *const | system, | |||
size_int_t | process_gid = NO_ID | |||
) |
A constructor from a string.
str_expr | = string assigning the expression to represent | |
par_table | = symbol table containing symbols needed to recognize in the expression (e.g. variable names) | |
process_gid | = GID of process in which the expression is given (NO_ID means no process, that is a global environment) |
size_int_t arity | ( | ) | const [inline] |
Returns a number of chilren of the top-most node in the syntax tree of the expression.
Referenced by compaction(), and dve_system_t::eval_expr().
size_int_t get_ident_gid | ( | ) | const [inline] |
Returns an identifier contained in the top-most node of the syntax tree of the expression.
It can be used only if operator in this node is T_ID (scalar variable), T_SQUARE_BRACKETS (vector variable) or T_DOT (process state).
It returns GID of the object of a certain type - the type is given by get_operator() (values T_ID, T_SQUARE_BRACKETS, T_DOT).
Referenced by dve_parser_t::check_restrictions_put_on_property(), compaction(), dve_system_t::eval_expr(), dve_parser_t::expr_assign(), dve_explicit_system_t::set_state_creator_value_extended(), and dve_parser_t::trans_sync().
int get_operator | ( | ) | const [inline] |
Returns an operator in the top-most node of the syntax tree of the expression.
Referenced by compaction(), dve_system_t::eval_expr(), dve_parser_t::expr_assign(), dve_explicit_system_t::set_state_creator_value_extended(), and dve_parser_t::trans_sync().
all_values_t get_value | ( | ) | const [inline] |
Returns a value contained in the top-most node of the syntax tree of the expression. It can be used only if operator in this node is T_NAT (number).
Referenced by compaction(), and dve_system_t::eval_expr().
void set_arity | ( | const size_int_t | new_arity | ) | [inline] |
Sets a number of chilren of the top-most node in the syntax tree of the expression.
void set_ident_gid | ( | const size_int_t | gid | ) | [inline] |
Sets an identifier contained in the top-most node of the syntax tree of the expression.
It can be used only if operator in this node is T_ID (scalar variable), T_SQUARE_BRACKETS (vector variable) or T_DOT (process state).
It returns GID of the object of a certain type - the type is given by get_operator() (values T_ID, T_SQUARE_BRACKETS, T_DOT).
void set_operator | ( | const int | oper | ) | [inline] |
Sets an operator in the top-most node of the syntax tree of the expression.
void set_value | ( | const all_values_t | value | ) | [inline] |
Sets a value contained in the top-most node of the syntax tree of the expression. It can be used only if operator in this node is T_NAT (number).