#include <dve_symbol.hh>
Public Member Functions | |
dve_symbol_t (const dve_sym_type_t t, const char *const n, const size_int_t l) | |
A constructor. | |
size_int_t | get_gid () const |
Returns a GID of symbol. | |
size_int_t | get_lid () const |
Returns a LID of symbol. | |
const char * | get_name () const |
Returns a name of symbol. | |
size_int_t | get_name_length () const |
Returns a length of name of symbol. | |
size_int_t | get_process_gid () const |
Returns a GID of process in which the symbol is declared. | |
size_int_t | get_sid () const |
Returns a SID of symbol. | |
dve_sym_type_t | get_symbol_type () const |
Returns a type of symbol - see dve_sym_type_t. | |
bool | get_valid () const |
Returns whether symbol is considered valid (invalid==ignored). | |
bool | is_channel () const |
Returns true iff symbol is a channel. | |
bool | is_process () const |
Returns true iff symbol is a process. | |
bool | is_state () const |
Returns true iff symbol is a process state. | |
bool | is_variable () const |
Returns true iff symbol is a variable. | |
void | set_gid (const size_int_t gid_arg) |
Sets a GID of symbol. | |
void | set_lid (const size_int_t lid_arg) |
Sets a LID of symbol. | |
void | set_name (const char *const str, const size_int_t length) |
Sets a name of a symbol and its length. | |
void | set_name (const char *new_name) |
Sets a name of symbol - be aware of correct length of `new_name'. | |
void | set_process_gid (const size_int_t nbr) |
Sets a GID of process in which the symbol is declared. | |
void | set_sid (const size_int_t symb_id) |
Sets a SID of symbol. | |
void | set_symbol_type (const dve_sym_type_t symb_type) |
Sets a type of symbol - see dve_sym_type_t. | |
void | set_valid (const bool is_valid) |
Sets whether symbol is considered valid (invalid==ignored). | |
~dve_symbol_t () | |
A destructor. | |
Following functions can be called only for vector variables | |
void | create_init_expr_field () |
const dve_expression_t * | get_init_expr (const size_int_t i) const |
Returns a pointer to the i-th initial value. | |
size_int_t | get_init_expr_count () const |
Returns a count of values initializing the vector. | |
std::vector< dve_expression_t * > * | get_init_expr_field () |
Returns a pointer to the vector of initial values. | |
size_int_t | get_vector_size () const |
Returns a size of the vector. | |
void | no_init_expr_field () |
Tells that array has no inital values. | |
void | set_init_expr (const size_int_t i, dve_expression_t *const trans) |
Sets `i'-th initial value from inital expression field. | |
void | set_vector_size (const size_int_t ar_size) |
Sets a size of the vector. | |
Following functions can be called only for channel symbols | |
slong_int_t | get_channel_buffer_size () const |
Returns a size of a buffer of typed channel. | |
size_int_t | get_channel_item_count () const |
Returns a number of items transmittable through a channel simultaneously. | |
dve_var_type_t | get_channel_type_list_item (const size_int_t index) const |
size_int_t | get_channel_type_list_size () const |
bool | get_channel_typed () const |
Returns true iff the channel is a typed channel. | |
void | set_channel_buffer_size (const slong_int_t buffer_size) |
Sets a size of a buffer of typed channel. | |
void | set_channel_item_count (const size_int_t size) |
Sets a number of items transmittable through a channel simultaneously. | |
void | set_channel_type_list_item (const size_int_t index, const dve_var_type_t type_item) |
void | set_channel_type_list_size (const size_int_t size) |
void | set_channel_typed (const bool typed) |
Sets, whether channel is typed (`typed'==true) or not (`typed'==false). | |
Following functions can be called only for scalar variables | |
const dve_expression_t * | get_init_expr () const |
dve_expression_t * | get_init_expr () |
Returns an initial value of scalar variable. | |
void | set_init_expr (dve_expression_t *const p_expr) |
Sets an initial value of scalar variable. | |
Following functions can be called only for variable symbols | |
dve_var_type_t | get_var_type () const |
Returns a type of variable - see dve_var_type_t. | |
bool | is_byte () const |
Returns true iff a variable symbol is of byte type. | |
bool | is_const () const |
Returns true iff a variable symbol is constant. | |
bool | is_int () const |
Returns true iff a variable symbol is of integer type. | |
bool | is_vector () const |
Returns true iff a variable symbol is a vector. | |
void | set_const (const bool const_var) |
Sets, whether a variable symbol is constant. | |
void | set_var_type (const dve_var_type_t var_type) |
Sets a type of variable - see dve_var_type_t. | |
void | set_vector (const bool is_vector) |
Sets, whether a variable symbol is a vector. | |
Static Public Attributes | |
static const size_int_t | CHANNEL_UNUSED = MAX_SIZE_INT |
Return value get_channel_item_count() iff channel has not been used. |
dve_symbol_t represents so called symbol. Symbol is a named entity in a system.
Each symbol has a unique identifier SID. You can obtain it using get_sid().
Each symbol has also an identifier GID. GID is unique too, but only among the symbols of the same type. You can get it using get_gid().
Locally declared symbols have also an identifier LID. LID is unique among all symbols inside the samo process. Only variables and process states can be declared locally. You can get LID of symbol using get_lid(). Method get_lid() has a special semantics in case of global symbols.
Each locally declared symbol has a unique parent process (a process where the symbol was declared). You can obtain a GID of this process by method get_process_gid(). In case of global symbols method get_process_gid() returns NO_ID.
Each symbol has its name of course. You can get it using a method get_name(). The length of this name is available using a method get_name_length().
It is requested to distinguish among separate types of symbols. You can do is using a method get_symbol_type() or using a set of functions is_variable(), is_process(), is_channel() and is_state().
There are altogether 4 types of symbols - see DVE Symbols for details.
dve_symbol_t | ( | const dve_sym_type_t | t, | |
const char *const | n, | |||
const size_int_t | l | |||
) | [inline] |
A constructor.
t | = type of a symbol | |
n | = name of a symbol | |
l | = length of a name of a symbol |
void create_init_expr_field | ( | ) | [inline] |
Creates a new field of initial values (be aware: old one should be deleted first)
size_int_t get_channel_item_count | ( | ) | const [inline] |
Returns a number of items transmittable through a channel simultaneously.
For typed channels it is the same as get_channel_type_list_size()
Referenced by dve_parser_t::trans_sync().
dve_var_type_t get_channel_type_list_item | ( | const size_int_t | index | ) | const [inline] |
Returns a type of `index'-th element of data sent simultaneously through a typed channel
Referenced by dve_explicit_system_t::get_async_enabled_trans_succ_without_property(), and dve_system_t::write().
size_int_t get_channel_type_list_size | ( | ) | const [inline] |
Returns a count of types of values transmitted simultaneously through a typed channel
Referenced by dve_explicit_system_t::DBG_print_state(), dve_parser_t::trans_sync(), and dve_system_t::write().
const dve_expression_t* get_init_expr | ( | ) | const [inline] |
The same as get_init_expr() above, but for constant instances of this class.
dve_expression_t* get_init_expr | ( | ) | [inline] |
Returns an initial value of scalar variable.
Returns an initial value of scalar variable. Initial value is represented by a pointer to the expression (see dve_expression_t) and it can be 0, when there was no initial value.
Referenced by dve_system_t::write().
size_int_t get_lid | ( | ) | const [inline] |
Returns a LID of symbol.
Returns a LID of symbol. If the symbol is global, it returns:
Referenced by dve_parser_t::assertion_create(), dve_parser_t::expr_assign(), dve_transition_t::set_state1_gid(), dve_transition_t::set_state2_gid(), dve_parser_t::state_accept(), dve_parser_t::state_commit(), dve_parser_t::state_init(), and dve_parser_t::trans_sync().
size_int_t get_process_gid | ( | ) | const [inline] |
Returns a GID of process in which the symbol is declared.
Returns a GID of process in which the symbol is declared. If the symbol is global, returns NO_ID.
Referenced by dve_symbol_table_t::add_state(), dve_symbol_table_t::add_variable(), dve_parser_t::check_restrictions_put_on_property(), dve_parser_t::expr_assign(), dve_parser_t::trans_sync(), and dve_expression_t::write().
bool is_byte | ( | ) | const [inline] |
Returns true iff a variable symbol is of byte type.
Returns true iff a variable symbol is of type byte - that is dve_symbol_t::get_var_type() returns VAR_BYTE.
Referenced by dve_system_t::write().
bool is_int | ( | ) | const [inline] |
Returns true iff a variable symbol is of integer type.
Returns true iff a variable symbol is of integer type - that is dve_symbol_t::get_var_type() returns VAR_INT.
void no_init_expr_field | ( | ) | [inline] |
Tells that array has no inital values.
Sets a internal pointer to is field of initial values to zero. Thus tells, that there are no inital values for the field
void set_channel_item_count | ( | const size_int_t | size | ) | [inline] |
Sets a number of items transmittable through a channel simultaneously.
For typed channels it is the same as set_channel_type_list_size()
Referenced by dve_parser_t::trans_sync().
void set_channel_type_list_item | ( | const size_int_t | index, | |
const dve_var_type_t | type_item | |||
) | [inline] |
Sets a type of `index'-th element of data sent simultaneously through a typed channel
void set_channel_type_list_size | ( | const size_int_t | size | ) | [inline] |
Sets a count of types of values transmitted simultaneously through a typed channel
const size_int_t CHANNEL_UNUSED = MAX_SIZE_INT [static] |
Return value get_channel_item_count() iff channel has not been used.
Constant returned by get_channel_item_count() if the number of items transmittable simultaneously through a channel has not been initialized (by the first usage of channel)
Referenced by dve_parser_t::trans_sync().