#include <dve_system.hh>
Public Member Functions | |
dve_system_t (error_vector_t &evect=gerr) | |
A constructor. | |
virtual | ~dve_system_t () |
A destructor. | |
Methods modifying a system | |
virtual void | add_process (process_t *const process) |
virtual void | remove_process (const size_int_t process_id) |
Implements system_t::remove_process(). | |
DVE system specific methods | |
These methods are implemented only in DVE system and they cannot be run using an abstract interface of system_t. | |
void | DBG_print_all_initialized_variables () |
For debugging purposes. | |
size_int_t | get_channel_count () const |
Returns a count of channels in the system. | |
size_int_t | get_channel_freq (size_int_t ch_gid) const |
Returns count of channel usage in processes (`ch_gid' = GID of channel). | |
size_int_t | get_channel_freq_ask (size_int_t ch_gid) const |
size_int_t | get_channel_freq_exclaim (size_int_t ch_gid) const |
size_int_t | get_global_variable_count () const |
Returns a count of global varibles. | |
size_int_t | get_global_variable_gid (const size_int_t i) const |
Returns a GID of global varibles. | |
bool | get_property_with_synchro () const |
Returns true, iff whether the property process contains any synchronizaiton. | |
dve_symbol_table_t * | get_symbol_table () const |
Returns pointer to the symbol table. | |
system_synchronicity_t | get_system_synchro () const |
Returns a synchronicity of the system. | |
bool | not_in_limits (dve_var_type_t var_type, all_values_t value) |
Returns, whether value of `value' is in bounds of type `var_type'. | |
void | set_property_with_synchro (const bool contains_synchro) |
Sets, whether the property process contains any synchronizaiton. | |
void | set_system_synchro (const system_synchronicity_t sync) |
Sets a synchronicity of the system. | |
Obligatory part of abstact interface | |
virtual slong_int_t | from_string (const std::string str) |
Implements system_t::from_string(const std::string str) in DVE system. | |
virtual slong_int_t | read (const char *const filename) |
Implements system_t::read(const char * const filename) in DVE system. | |
virtual slong_int_t | read (std::istream &ins=std::cin) |
Implements system_t::read(std::istream & ins = std::cin) in DVE system. | |
virtual std::string | to_string () |
Implements system_t::to_string() in DVE system. | |
virtual void | write (std::ostream &outs=std::cout) |
Implements system_t::write(std::ostream & outs = std::cout) in DVE system. | |
virtual bool | write (const char *const filename) |
Implements system_t::write(const char * const filename) in DVE system. | |
Methods working with processes | |
virtual const process_t * | get_process (const size_int_t id) const |
Implements system_t::get_process(const size_int_t id) const in DVE system. | |
virtual process_t * | get_process (const size_int_t gid) |
Implements system_t::get_process(const size_int_t gid) in DVE system. | |
virtual size_int_t | get_process_count () const |
Implements system_t::get_process_count() in DVE system. | |
Methods working with property process | |
virtual size_int_t | get_property_gid () const |
Implements system_t::get_property_gid() in DVE system. | |
virtual const process_t * | get_property_process () const |
Implements system_t::get_property_process() in DVE system. | |
virtual process_t * | get_property_process () |
Implements system_t::get_property_process() in DVE system. | |
virtual property_type_t | get_property_type () |
Implements system_t::get_property_type() in DVE system. | |
virtual void | set_property_gid (const size_int_t gid) |
Implements system_t::set_property_gid() in DVE system. | |
Methods to check the SCCs of property process graph | |
virtual int | get_property_scc_count () const |
virtual int | get_property_scc_id (state_t &_state) const |
virtual int | get_property_scc_type (state_t &_state) const |
virtual int | get_property_scc_type (int _scc) const |
virtual bool | is_property_weak () const |
Methods working with transitions | |
virtual size_int_t | get_trans_count () const |
virtual const transition_t * | get_transition (size_int_t gid) const |
Implements system_t::get_transition(size_int_t gid) const in DVE system. | |
virtual transition_t * | get_transition (size_int_t gid) |
Implements system_t::get_transition(size_int_t gid) in DVE system. | |
Protected Member Functions | |
all_values_t | eval_expr (const dve_expression_t *const expr, bool &eval_err) const |
Evaluates an expression. | |
all_values_t | fast_eval (compacted_viewer_t *p_compacted, bool &eval_err) const |
Evaluates a compacted expression. | |
Protected Attributes | |
size_int_t | channel_count |
bool * | constants |
all_values_t(* | eval_dot )(const void *parameters, const dve_expression_t &subexpr, bool &eval_err) |
all_values_t(* | eval_dot_compact )(const void *parameters, const dve_symbol_table_t *symbol_table, const size_int_t &gid, bool &eval_err) |
all_values_t(* | eval_id )(const void *parameters, const dve_expression_t &expr, bool &eval_err) |
all_values_t(* | eval_id_compact )(const void *parameters, const size_int_t &gid, bool &eval_err) |
all_values_t(* | eval_square_bracket )(const void *parameters, const dve_expression_t &subexpr, const size_int_t &array_index, bool &eval_err) |
all_values_t(* | eval_square_bracket_compact )(const void *parameters, const size_int_t &gid, const size_int_t &array_index, bool &eval_err) |
size_int_t | glob_var_count |
count of global varibles | |
size_int_t * | initial_states |
SYS_initial_values_t * | initial_values |
initial values for some symbols (see union SYS_initial_values_t) | |
size_int_t * | initial_values_counts |
additional information to `initial_values' | |
const size_int_t | MAX_INIT_VALUES_SIZE |
Constant set to initial_values_counts for scalar variables with initializer. | |
void * | parameters |
dve_process_t * | pproperty |
The pointer to the property process. | |
size_int_t | process_field_size |
capacity of field `processes' | |
array_t< dve_process_t * > | processes |
field of processes (0th element is not used) | |
size_int_t | prop_gid |
GID of the property process | |
bool | property_has_synchronization |
Says, whether the property contains synchronization. | |
dve_symbol_table_t * | psymbol_table |
"Symbol table" | |
size_int_t | state_count |
size_int_t * | state_lids |
system_synchronicity_t | system_synchro |
size_int_t | var_count |
dve_var_type_t * | var_types |
types of varibles (GID of variable is an index to this field) |
This class implements the abstact interface system_t.
This implementation contains the symbol table (dve_symbol_table_t) (as its element). It can read in and write out DVE source files. It can also offers basic informations about the system represented read from DVE source file. It implements the full DiVinE abstract interface and the model of the system has the complete structure of DiVinE system - it means, that processes, transitions and expressions are supported.
Furthermore it provides the set of methods, which are purely DVE system specific.
The very DVE system specific properties: (1) System can be synchronous or asynchronous. These two types of system differ in runs which they can do. In the synchronous system all processes have to do the transition each round of run of the system. In the asynchronous system only one process does do the transition except for transitions which are synchronized and transitions of the property process. Therefore in the asynchronous system there can simultaneously work at most 3 processes (the second process is synchronized with the first process and the third process can be only the property process). Such a tuple of transitions which can be used in a given state of the asynchronous system is called enabled transition.
(2) The system needs to know the declarations of channels, varibles, states and processes. For that reason it uses the class dve_symbol_table_t (symbol table) to store these declarations separatelly. Therefore system_t itself doesn't provide many informations about the declarations of symbols. To get these informations you should get the symbol table first. You can use the function system_t::get_symbol_table().
dve_system_t | ( | error_vector_t & | evect = gerr |
) |
A constructor.
evect | = the error vector, that will be used by created instance of system_t |
References system_abilities_t::explicit_system_can_evaluate_expressions, system_abilities_t::explicit_system_can_system_transitions, system_t::get_abilities(), initial_values, initial_values_counts, parameters, system_abilities_t::process_can_be_modified, system_abilities_t::process_can_read, system_abilities_t::process_can_transitions, property_has_synchronization, psymbol_table, system_abilities_t::system_can_be_modified, system_abilities_t::system_can_processes, system_abilities_t::system_can_property_process, system_abilities_t::system_can_transitions, system_abilities_t::transition_can_be_modified, system_abilities_t::transition_can_read, and var_types.
void add_process | ( | process_t *const | process | ) | [virtual] |
Implements system_t::add_process() in DVE system, but see also implementation specific notes below.
Imporant thing is, that this is the only permitted way of adding the process to the system. Program should not use dve_symbol_table_t::add_process() instead of this method.
Implements system_t.
References process_t::get_gid(), dve_symbol_table_t::get_process(), processes, psymbol_table, and array_t::push_back().
void DBG_print_all_initialized_variables | ( | ) |
For debugging purposes.
Prints all varibles with their initial values
References SYS_initial_values_t::all_value, dve_symbol_t::get_name(), dve_symbol_table_t::get_variable(), initial_values, initial_values_counts, dve_symbol_t::is_vector(), and psymbol_table.
all_values_t eval_expr | ( | const dve_expression_t *const | expr, | |
bool & | eval_err | |||
) | const [protected] |
Evaluates an expression.
Carries out complete expression evaluation. Evaluation of varibles and state identifiers can be changed in the descendant by changing protected varibles `eval_id', `eval_square_bracket', and `eval_dot'.
expr | = pointer to structure representing expression | |
eval_err | = boolean that says, whether evaluation passed correctly |
References SYS_initial_values_t::all_value, SYS_initial_values_t::all_values, dve_expression_t::arity(), eval_dot, eval_id, eval_square_bracket, fast_eval(), dve_expression_t::get_ident_gid(), dve_expression_t::get_operator(), dve_expression_t::get_p_compact(), dve_expression_t::get_value(), initial_values, initial_values_counts, dve_expression_t::is_compacted(), dve_expression_t::left(), parameters, dve_expression_t::right(), and dve_expression_t::to_string().
Referenced by dve_explicit_system_t::eval_expr().
all_values_t fast_eval | ( | compacted_viewer_t * | p_compacted, | |
bool & | eval_err | |||
) | const [protected] |
Evaluates a compacted expression.
Carries out complete expression evaluation over compacted expression. Evaluation of varibles and state identifiers can be changed in the descendant by changing protected varibles `eval_id_compact', `eval_square_bracket_compact', and `eval_dot_compact'.
p_compacted | = pointer to compacted expresion | |
eval_err | = boolean that says, whether evaluation passed correctly |
References SYS_initial_values_t::all_value, SYS_initial_values_t::all_values, gerr, compacted_t::get_gid(), compacted_t::get_operator(), compacted_t::get_value(), initial_values, initial_values_counts, compacted_t::left(), parameters, psymbol_table, compacted_t::ptr, compacted_t::right(), and compacted_t::to_string().
Referenced by eval_expr(), and dve_explicit_system_t::eval_expr().
size_int_t get_channel_freq_ask | ( | size_int_t | ch_gid | ) | const [inline] |
Returns count of channel usage in processes in a synchronization with a question mark.
size_int_t get_channel_freq_exclaim | ( | size_int_t | ch_gid | ) | const [inline] |
Returns count of channel usage in processes in a synchronization with a exclamaion mark.
size_int_t get_global_variable_gid | ( | const size_int_t | i | ) | const [inline] |
Returns a GID of global varibles.
Returns a GID of global varibles. i is an index to the list of global varibles (in an interval 0..(get_global_variable_count()-1) ). You can obtain this index by dve_symbol_t::get_lid().
virtual int get_property_scc_count | ( | ) | const [inline, virtual] |
Returns the number of SCCs in the decomposition.
References gerr.
virtual int get_property_scc_id | ( | state_t & | _state | ) | const [inline, virtual] |
Returns id of an SCC that the given state projects to.
References gerr, and state_t::ptr.
virtual int get_property_scc_type | ( | state_t & | _state | ) | const [inline, virtual] |
Returns type of an SCC that the given state projects to, where 0 means nonaccepting component, 1 means partially accepting component, and 2 means fully accepting component.
References gerr, and state_t::ptr.
virtual int get_property_scc_type | ( | int | _scc | ) | const [inline, virtual] |
Returns type of the given SCC, where 0 means nonaccepting component, 1 means partially accepting component, and 2 means fully accepting component.
References gerr.
dve_symbol_table_t* get_symbol_table | ( | ) | const [inline] |
Returns pointer to the symbol table.
Symbol table (= instance of class dve_symbol_table_t) is automatically created in creation time of system_t as its private data member. It contains all declarations of all named symbols (processes, channels, varibles and process states).
See symbol table and dve_symbol_table_t for details.
Referenced by dve_transition_t::get_symbol_table(), dve_process_t::get_symbol_table(), dve_expression_t::get_symbol_table(), and por_t::init().
system_synchronicity_t get_system_synchro | ( | ) | const [inline] |
Returns a synchronicity of the system.
virtual size_int_t get_trans_count | ( | ) | const [inline, virtual] |
Implements system_t::get_trans_count() in DVE system, but see also implementation specific notes below
Returned count of transitions comprises also invalid transitions (transitions, where transition_t::get_valid() returns false)
Implements system_t.
Referenced by por_t::init(), and por_t::static_c3().
virtual bool is_property_weak | ( | ) | const [inline, virtual] |
Returns whether the process has a weak graph.
References gerr.
void set_property_with_synchro | ( | const bool | contains_synchro | ) | [inline] |
Sets, whether the property process contains any synchronizaiton.
contains_synchro | = true, iff the property process contains any synchronizaiton |
all_values_t(* eval_dot)(const void *parameters, const dve_expression_t &subexpr, bool &eval_err) [protected] |
functional variable that points to the function, which should be used to evaluate state identifiers
Referenced by eval_expr().
all_values_t(* eval_id)(const void *parameters, const dve_expression_t &expr, bool &eval_err) [protected] |
functional variable that points to the function, which should be used to evaluate varibles
Referenced by eval_expr().
all_values_t(* eval_square_bracket)(const void *parameters, const dve_expression_t &subexpr, const size_int_t &array_index, bool &eval_err) [protected] |
functional variable that points to the function, which should be used to evaluate variable fields
Referenced by eval_expr().
size_int_t* initial_values_counts [protected] |
additional information to `initial_values'
`initial_values_counts' is the additional information to `intial_values': initial_values_counts[i] =
Referenced by DBG_print_all_initialized_variables(), dve_system_t(), eval_expr(), fast_eval(), and dve_explicit_system_t::get_initial_state().
void* parameters [protected] |
parameters points to the piece of the memory where additional informations for 'eval_*' functions are stored.
Referenced by dve_system_t(), eval_expr(), fast_eval(), and dve_explicit_system_t::~dve_explicit_system_t().