Nestedsums library
|
This class provides a container for expressions to be stored in hash tables. More...
#include <hash_entry.h>
Public Member Functions | |
hash_entry (const GiNaC::ex &cd, const GiNaC::ex &sd, const GiNaC::ex &rd, unsigned rkey) | |
void | archive (GiNaC::archive_node &node) const override |
void | read_archive (const GiNaC::archive_node &node, GiNaC::lst &sym_lst) override |
unsigned | return_type (void) const override |
void | print (const GiNaC::print_context &c, unsigned level=0) const override |
unsigned | precedence (void) const override |
GiNaC::ex | eval () const override |
GiNaC::ex | subs (const GiNaC::exmap &m, unsigned options=0) const override |
GiNaC::ex | return_value (const GiNaC::ex &obj_data) const |
GiNaC::ex | hash_data (void) const |
GiNaC::ex | subst_data (void) const |
Protected Member Functions | |
GiNaC::ex | eval_ncmul (const GiNaC::exvector &v) const override |
GiNaC::ex | derivative (const GiNaC::symbol &s) const override |
unsigned | calchash (void) const override |
Protected Attributes | |
GiNaC::ex | compare_data |
GiNaC::ex | replace_data |
GiNaC::ex | return_data |
unsigned | rtti_key |
This class provides a container for expressions to be stored in hash tables.
The class hash_entry is designed to be stored as the second entry in a hash map. The map would be of type map<unsigned, ex> and the ex would always refer to an object of type hash_entry.
The class hash_entry has four data members: compare_data, replace_data, return_data and rtti_key.
The member compare_data can be accessed via the method hash_data(void) and is used to verify exactly if the entry stored in the map is equivalent to the object which is being looked up. "Is equivalent" can mean "is exactly identical" or "is identical up to simple substitutions".
The member replace_data specifies the components of the return_data which have to be substituted.
The method return_value(obj_data) takes the subst_data from the object looked up and substitutes it into the return_data. If the rtti_key is zero, it is assumed that no substitutions are necesarry and the return_data is returned directly.
Classes which are supposed to be stored in the hash table, have to provide four methods: unsigned get_key(void) ex hash_data(void) ex subst_data(void) ex get_template(void)
get_key is the key for the first entry in the hash map. If the key is found in the hash map, hash_data is used to verify if the entry is equivalent to the class being looked up. subst_data() provides the part which has to specialized. If substitutions are required, get_template() returns the "raw" form for the specific instance of a class.
|
override |
No automatic simplifications
|
overrideprotected |
No automatic simplifications
ex hash_data | ( | void | ) | const |
Returns the member compare_data.
ex return_value | ( | const GiNaC::ex & | obj_data | ) | const |
The method return_value(obj_data) takes the subst_data from the object looked up and substitutes it into the return_data. The way substitutions are performed depends on the rtti_key.
If the rtti_key is zero, it is assumed that no substitutions are necesarry and the return_data is returned directly.
If the rtti_key is one, the obj_data is substituted for the replace_data.
The default is to return the return_data directly.
ex subst_data | ( | void | ) | const |
Returns the member replace_data.