NodeAnonymizerBase class definition derived from class EnvObject. More...
#include <NodeAnonymizerBase_private.h>
Public Member Functions | |
| INHERITS_FROM (EnvObject) | |
Data Fields | |
| LRUCache_ptr | anon2orig |
| const char *(* | build_anonymous )(NodeAnonymizerBase_ptr self, node_ptr id, const char *prefix) |
| unsigned long long | counter |
| const char * | default_prefix |
| boolean(* | is_id )(NodeAnonymizerBase_ptr self, node_ptr node) |
| boolean(* | is_leaf )(NodeAnonymizerBase_ptr self, node_ptr node) |
| BiMap_ptr | map |
| size_t | memoization_threshold |
| LRUCache_ptr | orig2anon |
| node_ptr(* | translate )(NodeAnonymizerBase_ptr self, node_ptr id, const char *prefix) |
Related Functions | |
(Note that these are not member functions.) | |
| const char * | node_anonymizer_base_build_anonymous (NodeAnonymizerBase_ptr self, node_ptr id, const char *prefix) |
| Build the string to be used for the anonymous id. | |
| const char * | node_anonymizer_base_choose_prefix (NodeAnonymizerBase_ptr self, const char *prefix) |
| Choose the prefix to be used in the construction of the anonymous identifier. | |
| void | node_anonymizer_base_deinit (NodeAnonymizerBase_ptr self) |
| The NodeAnonymizerBase class private deinitializer. | |
| void | node_anonymizer_base_init (NodeAnonymizerBase_ptr self, NuSMVEnv_ptr env, const char *default_prefix, size_t memoization_threshold) |
| The NodeAnonymizerBase class private initializer. | |
| void | node_anonymizer_base_insert_anon2orig (NodeAnonymizerBase_ptr self, node_ptr anonymous_expr, node_ptr expr) |
| Inserts an entry in the cache. | |
| void | node_anonymizer_base_insert_expr_cache (NodeAnonymizerBase_ptr self, node_ptr expr, node_ptr anonymous_expr) |
| Inserts an entry in the cache. | |
| void | node_anonymizer_base_insert_mapping (NodeAnonymizerBase_ptr self, node_ptr id, node_ptr anonymous) |
| Insert a mapping in the map. | |
| boolean | node_anonymizer_base_is_id (NodeAnonymizerBase_ptr self, node_ptr id) |
| True if id is an id. | |
| boolean | node_anonymizer_base_is_id_anonymous (NodeAnonymizerBase_ptr self, node_ptr id) |
| True if id is already in the map. | |
| boolean | node_anonymizer_base_is_id_original (NodeAnonymizerBase_ptr self, node_ptr id) |
| True if id is already in the map. | |
| boolean | node_anonymizer_base_is_leaf (NodeAnonymizerBase_ptr self, node_ptr id) |
| True if node is leaf (traversal should stop). | |
| node_ptr | node_anonymizer_base_map_back (NodeAnonymizerBase_ptr self, node_ptr expr) |
| Translates back an expression previously anonymized. | |
| node_ptr | node_anonymizer_base_map_expr (NodeAnonymizerBase_ptr self, node_ptr expr) |
| Translates an expression. | |
| node_ptr | node_anonymizer_base_search_anon2orig (NodeAnonymizerBase_ptr self, node_ptr expr) |
| Lookups for expr in the cache. | |
| node_ptr | node_anonymizer_base_search_expr_cache (NodeAnonymizerBase_ptr self, node_ptr expr) |
| Lookups for expr in the cache. | |
| node_ptr | node_anonymizer_base_search_mapping (NodeAnonymizerBase_ptr self, node_ptr id) |
| Searches id in the map. | |
| node_ptr | node_anonymizer_base_translate (NodeAnonymizerBase_ptr self, node_ptr id, const char *prefix) |
| translate an id to a new, anonymous one. If id was already mapped, the returned id is just taken from there. Otherwise, it is computed, added to the map and finally returned to the caller | |
| int | node_anonymizer_read_map_from_bimap (NodeAnonymizerBase_ptr self, BiMap_ptr map) |
| Reads a map from a bimap, and merge it into self. | |
| void | NodeAnonymizerBase_destroy (NodeAnonymizerBase_ptr self) |
| The NodeAnonymizerBase class destructor. | |
| int | NodeAnonymizerBase_force_map (NodeAnonymizerBase_ptr self, node_ptr original, node_ptr anonymous) |
| Insert a mapping. | |
| size_t | NodeAnonymizerBase_get_map_size (NodeAnonymizerBase_ptr self) |
| Returns the size of the mapping. | |
| boolean | NodeAnonymizerBase_is_id_anonymous (NodeAnonymizerBase_ptr self, node_ptr id) |
| True if id is already in the map as an anonymous identifier. | |
| boolean | NodeAnonymizerBase_is_id_original (NodeAnonymizerBase_ptr self, node_ptr id) |
| True if id is already in the map as an original identifier. | |
| boolean | NodeAnonymizerBase_is_map_empty (NodeAnonymizerBase_ptr self) |
| True if the map is empty. | |
| int | NodeAnonymizerBase_map (NodeAnonymizerBase_ptr self, node_ptr id, const char *prefix) |
| Anonymize id and insert it in the mapping. | |
| node_ptr | NodeAnonymizerBase_map_back (NodeAnonymizerBase_ptr self, node_ptr expr) |
| Translates back an expression previously anonymized. | |
| node_ptr | NodeAnonymizerBase_map_expr (NodeAnonymizerBase_ptr self, node_ptr expr) |
| Translates an expression. | |
| int | NodeAnonymizerBase_print_map (NodeAnonymizerBase_ptr self, FILE *stream) |
| Print the map on the given string. | |
| int | NodeAnonymizerBase_read_map_from_stream (NodeAnonymizerBase_ptr self, FILE *stream) |
| Reads a map from stream, and merge it into self. | |
NodeAnonymizerBase class definition derived from class EnvObject.
Public interface of class 'NodeAnonymizerBase'.
Private members: map the bidirectional map of identifiers orig2anon cache for expression translation memoization_threshold threshold for the caches. It represents the max total space used for memoization, so it is divided equally over the two caches. counter used for assignind unique identifiers default_prefix the prefix that will used for all anonymized identifiers
Virtual methods: translate translate an id to a new, anonymous one. If id was already mapped, the returned id is just taken from there. Otherwise, it is computed, added to the map and finally returned to the caller.
is_leaf true if node is a leaf is_id true if node is an identifier (something to be translated)
Definition of the public accessor for class NodeAnonymizerBase
| NodeAnonymizerBase::INHERITS_FROM | ( | EnvObject | ) |
| const char * node_anonymizer_base_build_anonymous | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id, | |||
| const char * | prefix | |||
| ) | [related] |
Build the string to be used for the anonymous id.
self->counter is incremented
| const char * node_anonymizer_base_choose_prefix | ( | NodeAnonymizerBase_ptr | self, | |
| const char * | prefix | |||
| ) | [related] |
Choose the prefix to be used in the construction of the anonymous identifier.
prefix must not be NULL
| void node_anonymizer_base_deinit | ( | NodeAnonymizerBase_ptr | self | ) | [related] |
The NodeAnonymizerBase class private deinitializer.
The NodeAnonymizerBase class private deinitializer
| void node_anonymizer_base_init | ( | NodeAnonymizerBase_ptr | self, | |
| NuSMVEnv_ptr | env, | |||
| const char * | default_prefix, | |||
| size_t | memoization_threshold | |||
| ) | [related] |
The NodeAnonymizerBase class private initializer.
The NodeAnonymizerBase class private initializer
| default_prefix | if NULL, it will default to "x" |
| void node_anonymizer_base_insert_anon2orig | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | anonymous_expr, | |||
| node_ptr | expr | |||
| ) | [related] |
Inserts an entry in the cache.
leaves, ids and NULL are not allowed as keys or values
| void node_anonymizer_base_insert_expr_cache | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | expr, | |||
| node_ptr | anonymous_expr | |||
| ) | [related] |
Inserts an entry in the cache.
leaves, ids and NULL are not allowed as keys or values
| void node_anonymizer_base_insert_mapping | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id, | |||
| node_ptr | anonymous | |||
| ) | [related] |
Insert a mapping in the map.
id must not be already in the map
| boolean node_anonymizer_base_is_id | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id | |||
| ) | [related] |
True if id is an id.
| boolean node_anonymizer_base_is_id_anonymous | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id | |||
| ) | [related] |
True if id is already in the map.
id must be an id
| boolean node_anonymizer_base_is_id_original | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id | |||
| ) | [related] |
True if id is already in the map.
id must be an id
| boolean node_anonymizer_base_is_leaf | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id | |||
| ) | [related] |
True if node is leaf (traversal should stop).
| node_ptr node_anonymizer_base_map_back | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | expr | |||
| ) | [related] |
Translates back an expression previously anonymized.
| node_ptr node_anonymizer_base_map_expr | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | expr | |||
| ) | [related] |
Translates an expression.
| node_ptr node_anonymizer_base_search_anon2orig | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | expr | |||
| ) | [related] |
Lookups for expr in the cache.
leaves, ids and NULL are not allowed as keys
| node_ptr node_anonymizer_base_search_expr_cache | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | expr | |||
| ) | [related] |
Lookups for expr in the cache.
leaves, ids and NULL are not allowed as keys
| node_ptr node_anonymizer_base_search_mapping | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id | |||
| ) | [related] |
Searches id in the map.
the anonoymous id corresponding to id if found, otherwise null
| node_ptr node_anonymizer_base_translate | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id, | |||
| const char * | prefix | |||
| ) | [related] |
translate an id to a new, anonymous one. If id was already mapped, the returned id is just taken from there. Otherwise, it is computed, added to the map and finally returned to the caller
| id | an identifier | |
| prefix | a prefix to be used instead of the default one |
| int node_anonymizer_read_map_from_bimap | ( | NodeAnonymizerBase_ptr | self, | |
| BiMap_ptr | map | |||
| ) | [related] |
Reads a map from a bimap, and merge it into self.
map is assumed to be syntactically correct error is returned if an original id is associated with a different anonymous id or if an anonymous id is already used in self
| void NodeAnonymizerBase_destroy | ( | NodeAnonymizerBase_ptr | self | ) | [related] |
The NodeAnonymizerBase class destructor.
AutomaticStart
The NodeAnonymizerBase class destructor
| int NodeAnonymizerBase_force_map | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | original, | |||
| node_ptr | anonymous | |||
| ) | [related] |
Insert a mapping.
| original | must be an id and not in the map | |
| anonymous | must be an id and not in the map back |
| size_t NodeAnonymizerBase_get_map_size | ( | NodeAnonymizerBase_ptr | self | ) | [related] |
Returns the size of the mapping.
| boolean NodeAnonymizerBase_is_id_anonymous | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id | |||
| ) | [related] |
True if id is already in the map as an anonymous identifier.
id must be an id
| boolean NodeAnonymizerBase_is_id_original | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id | |||
| ) | [related] |
True if id is already in the map as an original identifier.
id must be an id
| boolean NodeAnonymizerBase_is_map_empty | ( | NodeAnonymizerBase_ptr | self | ) | [related] |
True if the map is empty.
| int NodeAnonymizerBase_map | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | id, | |||
| const char * | prefix | |||
| ) | [related] |
Anonymize id and insert it in the mapping.
if prefix is not the empty string, it is used instead of the default prefix to create the anonymous id
| id | must not be in the map and must be an identifier | |
| prefix | must not be NULL |
| node_ptr NodeAnonymizerBase_map_back | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | expr | |||
| ) | [related] |
Translates back an expression previously anonymized.
All the identifiers in expr must belong to the codomain of the map
| node_ptr NodeAnonymizerBase_map_expr | ( | NodeAnonymizerBase_ptr | self, | |
| node_ptr | expr | |||
| ) | [related] |
Translates an expression.
expr is not normalized
| int NodeAnonymizerBase_print_map | ( | NodeAnonymizerBase_ptr | self, | |
| FILE * | stream | |||
| ) | [related] |
Print the map on the given string.
| int NodeAnonymizerBase_read_map_from_stream | ( | NodeAnonymizerBase_ptr | self, | |
| FILE * | stream | |||
| ) | [related] |
Reads a map from stream, and merge it into self.
If an error occurs, self is not changed. every line of stream must be in the following format
id := [A-Za-z_][A-Za-z0-9_$#-]* dot_expr := (id | . | ,)+
dot_expr:dot_expr
| const char*(* NodeAnonymizerBase::build_anonymous)(NodeAnonymizerBase_ptr self, node_ptr id, const char *prefix) |
| unsigned long long NodeAnonymizerBase::counter |
| const char* NodeAnonymizerBase::default_prefix |
| boolean(* NodeAnonymizerBase::is_id)(NodeAnonymizerBase_ptr self, node_ptr node) |
| boolean(* NodeAnonymizerBase::is_leaf)(NodeAnonymizerBase_ptr self, node_ptr node) |
| node_ptr(* NodeAnonymizerBase::translate)(NodeAnonymizerBase_ptr self, node_ptr id, const char *prefix) |
1.6.1