#include <explicit_storage.hh>
Public Member Functions | |
void * | app_by_ref (state_ref_t refer) |
void | delete_all_states (bool leave_collision_lists=false) |
bool | delete_by_ref (state_ref_t) |
explicit_storage_t (divine::error_vector_t &=gerr) | |
template<class appendix_t> | |
bool | get_app_by_ref (state_ref_t refer, appendix_t &result) |
size_t | get_coltables () |
size_t | get_ht_occupancy () |
size_t | get_max_coltable () |
size_t | get_mem_max_used () |
size_t | get_mem_used () |
size_t | get_states_max_stored () |
size_t | get_states_stored () |
void | init () |
void | insert (state_t, state_ref_t &) |
void | insert (state_t) |
bool | is_stored (state_t, state_ref_t &) |
bool | is_stored (state_t) |
bool | is_stored_if_not_insert (state_t, state_ref_t &) |
state_t | reconstruct (state_ref_t) |
template<class appendix_t> | |
bool | set_app_by_ref (state_ref_t refer, appendix_t appen) |
template<class appendix_t> | |
void | set_appendix (appendix_t) |
void | set_appendix_size (size_t) |
void | set_col_init_size (size_t) |
void | set_col_resize (size_t) |
void | set_compression_method (size_t) |
void | set_hash_function (hash_functions_t) |
void | set_ht_size (size_t) |
bool | set_mem_limit (size_t) |
Protected Member Functions | |
void | mem_counting (int) |
Protected Attributes | |
size_t | appendix_size |
size_t | col_init_size |
size_t | col_resize |
size_t | compression_method |
compressor_t | compressor |
error_vector_t & | errvec |
hash_function_t | hasher |
size_t | ht_size |
bool | initialized |
size_t | mem_limit |
size_t | mem_max_used |
size_t | mem_used |
storage_t | storage |
explicit_storage_t | ( | divine::error_vector_t & | = gerr |
) |
Constructor. An error_vector_t may be specified.
void * app_by_ref | ( | state_ref_t | refer | ) |
Returns pointer to appendix stored at the referenced state.
References state_ref_t::hres, and state_ref_t::id.
void delete_all_states | ( | bool | leave_collision_lists = false |
) |
Deletes all stored states and collision lists. Method has a voluntary parameter leave_collision_lists. If called with leave_collision_lists = true, then colission lists are only cleared and remain allocated.
bool delete_by_ref | ( | state_ref_t | state_reference | ) |
Deletes the state that is referenced by given state_ref_t. Returns false if the delete operation was unsuccessful.
References state_ref_t::hres, and state_ref_t::id.
bool get_app_by_ref | ( | state_ref_t | refer, | |
appendix_t & | result | |||
) | [inline] |
Returns appendix stored at the referenced state.
References state_ref_t::hres, and state_ref_t::id.
size_t get_coltables | ( | ) |
Returns sum of sizes of collision tables (sum of lengths of all collision lists).
size_t get_ht_occupancy | ( | ) |
Returns the number of occupied lines (lines with at least one state stored) in the hashtable.
size_t get_max_coltable | ( | ) |
Returns maximum size of a single collision table (maximum length of a collision list).
size_t get_mem_max_used | ( | ) |
Returns maximal (up to the time if this call) number of bytes allocated by storage and compressor instances. Note this differ from real memory consumption as no fragmentation is included.
size_t get_mem_used | ( | ) |
Returns current number of bytes allocated by storage and compressor instances. Note this differ from real memory consumption as no fragmentation is included.
size_t get_states_max_stored | ( | ) |
Returns maximum number of states stored in the set.
size_t get_states_stored | ( | ) |
Returns current number of states stored in the set.
Referenced by logger_t::log_now().
void init | ( | ) |
This member function performs initialization of the hash table. It must be called in order to use the class for storing states. This function call may be predecessed by calls of various set functions.
References compressor_t::clear(), and compressor_t::init().
void insert | ( | state_t | state, | |
state_ref_t & | state_reference | |||
) |
Insert a copy of the given state in the set of visited states. An exception is generated in the case of unsuccesfull insert. Also sets the given state_ref_t to reference the newly inserted state.
References compressor_t::compress(), hash_function_t::get_hash(), state_ref_t::hres, state_ref_t::id, state_t::ptr, and state_t::size.
void insert | ( | state_t | state | ) |
Insert a copy of the given state in the set of visited states. An exception is generated in the case of unseccesfull insert.
bool is_stored | ( | state_t | state, | |
state_ref_t & | state_reference | |||
) |
Returns true if the state is inserted in the set of visited states and if so then sets the state_ref_t to reference the state.
References compressor_t::compress_without_alloc(), hash_function_t::get_hash(), state_ref_t::hres, state_ref_t::id, state_t::ptr, and state_t::size.
bool is_stored | ( | state_t | state | ) |
Returns true if the state is inserted in the set of visited states.
bool is_stored_if_not_insert | ( | state_t | state, | |
state_ref_t & | state_reference | |||
) |
Tests whether given state is stored in the set of visited states. In the case the state is present in the set, the function returns true and sets the given state_ref_t to reference the state in the set, otherwise a copy of the state is inserted in the set, the given state_ref_t is set to the state that has been just inserted, and false is returned. In the latter case an exception is generated in the case of unseccesfull insert.
References compressor_t::compress(), hash_function_t::get_hash(), state_ref_t::hres, state_ref_t::id, state_t::ptr, and state_t::size.
state_t reconstruct | ( | state_ref_t | state_reference | ) |
Reconstructs state referenced by given state_ref_t. Invalid reference will cause warning and crash the application.
References compressor_t::decompress(), state_ref_t::hres, state_ref_t::id, state_t::ptr, and state_t::size.
bool set_app_by_ref | ( | state_ref_t | refer, | |
appendix_t | appen | |||
) | [inline] |
Rewrites the appendix stored at referenced state with the given one.
References state_ref_t::hres, and state_ref_t::id.
void set_appendix | ( | appendix_t | ) | [inline] |
Sets the size of appendix using an instance of an appendix strucute. Must be called before member function init.
void set_appendix_size | ( | size_t | appendix_size_in | ) |
Sets the size of instance of an appendix structure. The call of this function must preceed the call of init member function.
void set_col_init_size | ( | size_t | coltable_init_size | ) |
Sets initial size of a collision table (default=1). The call of this function must preceed the call of init member function.
void set_col_resize | ( | size_t | coltable_resize_by | ) |
Sets the factor by which a collision table is enlarged if necessary. The call of this function must preceed the call of init member function.
void set_compression_method | ( | size_t | compression_method_id | ) |
Sets compression method. Where the possibilities are: NO_COMPRESS (default) and HUFFMAN_COMPRESS. The call of this function must preceed the call of init member function.
void set_hash_function | ( | hash_functions_t | hf | ) |
Sets hash function to be used.
References hash_function_t::set_hash_function().
void set_ht_size | ( | size_t | hashtable_size | ) |
Sets the hash table size (default: 2^16 = 65536). The call of this function must preceed the call of init member function. The call of this function must preceed the call of init member function.
bool set_mem_limit | ( | size_t | memory_limit | ) |
Sets a limit for the number of allocated bytes (not including memory fragmentation). The call of this function must preceed the call of init member function.