SetTrie
|
Macros | |
#define | MURMUR_SEED 76493 |
Just a 5 digit prime. More... | |
Typedefs | |
typedef SetTrie * | pSetTrie |
typedef StringSet * | pStringSet |
typedef std::map< int, pSetTrie > | SetTrieServer |
typedef std::map< int, pStringSet > | IterServer |
typedef std::map< int, pBinaryImage > | BinaryImageServer |
Functions | |
uint64_t | MurmurHash64A (const void *key, int len) |
MurmurHash2, 64-bit versions, by Austin Appleby. More... | |
bool | image_put (pBinaryImage p_bi, void *p_data, int size) |
bool | image_get (pBinaryImage p_bi, int &c_block, int &c_ofs, void *p_data, int size) |
char * | image_block_as_string (uint8_t *p_in) |
char * | image_block_as_string (ImageBlock &blk) |
bool | string_as_image_block (ImageBlock &blk, char *p_in) |
String | python_set_as_string (char *p_char) |
int | new_settrie () |
void | destroy_settrie (int st_id) |
void | insert (int st_id, char *set, char *str_id) |
char * | find (int st_id, char *set) |
int | supersets (int st_id, char *set) |
int | subsets (int st_id, char *set) |
int | elements (int st_id, int set_id) |
int | next_set_id (int st_id, int set_id) |
int | num_sets (int st_id) |
char * | set_name (int st_id, int set_id) |
int | remove (int st_id, int set_id) |
int | purge (int st_id, int dry_run) |
int | iterator_size (int iter_id) |
char * | iterator_next (int iter_id) |
void | destroy_iterator (int iter_id) |
void | destroy_binary_image (int image_id) |
int | save_as_binary_image (int st_id) |
bool | push_binary_image_block (int st_id, char *p_block) |
int | binary_image_size (int image_id) |
char * | binary_image_next (int image_id) |
Variables | |
int | instance_num = 0 |
int | instance_iter = 0 |
SetTrieServer | instance = {} |
IterServer | iterator = {} |
BinaryImageServer | image = {} |
char | answer_buffer [8192] |
char | answer_block [8208] |
const char | b64chars [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" |
uint8_t | b64inverse [256] = {0} |
#define MURMUR_SEED 76493 |
Just a 5 digit prime.
typedef std::map<int, pBinaryImage> BinaryImageServer |
typedef std::map<int, pStringSet> IterServer |
typedef StringSet* pStringSet |
typedef std::map<int, pSetTrie> SetTrieServer |
char * binary_image_next | ( | int | image_id | ) |
Return the first unread binary images block in an iterator returned by a save_as_binary_image() call.
image_id | The image_id returned by a previous save_as_binary_image() call. |
int binary_image_size | ( | int | image_id | ) |
Return the number of unread binary images blocks in an iterator returned by a save_as_binary_image() call.
image_id | The image_id returned by a previous save_as_binary_image() call. |
void destroy_binary_image | ( | int | image_id | ) |
Destroy an iterator for a binary image(returned by save_as_binary_image()).
image_id | The image_id returned by a previous save_as_binary_image() call. |
void destroy_iterator | ( | int | iter_id | ) |
Destroy an iterator (returned by subsets() or supersets()).
iter_id | The iter_id returned by a previous subsets() or supersets() call. |
void destroy_settrie | ( | int | st_id | ) |
Destroy a SetTrie object that was used via the Python interface.
st_id | The st_id returned by a previous new_settrie() call. |
int elements | ( | int | st_id, |
int | set_id | ||
) |
Return all the elements in a set from a SetTrie identified by set_id as an iterator of strings.
st_id | The st_id returned by a previous new_settrie() call. |
set_id | A valid set_id returned by a successful next_set_id() call. |
char * find | ( | int | st_id, |
char * | set | ||
) |
Find a Python set (serialized by a str() call) for a complete match inside a SetTrie object.
st_id | The st_id returned by a previous new_settrie() call. |
set | A Python set serialized by a str() call. |
char * image_block_as_string | ( | ImageBlock & | blk | ) |
char * image_block_as_string | ( | uint8_t * | p_in | ) |
|
inline |
|
inline |
void insert | ( | int | st_id, |
char * | set, | ||
char * | str_id | ||
) |
Insert a Python set (serialized by a str() call) into a SetTrie object.
st_id | The st_id returned by a previous new_settrie() call. |
set | A Python set serialized by a str() call. |
str_id | An id representing this set that will be returned in searches. |
char * iterator_next | ( | int | iter_id | ) |
Return the first unread item in an iterator (returned by subsets() or supersets()).
iter_id | The iter_id returned by a previous subsets() or supersets() call. |
int iterator_size | ( | int | iter_id | ) |
Return the number of unread items in an iterator (returned by subsets() or supersets()).
iter_id | The iter_id returned by a previous subsets() or supersets() call. |
uint64_t MurmurHash64A | ( | const void * | key, |
int | len | ||
) |
MurmurHash2, 64-bit versions, by Austin Appleby.
(from https://sites.google.com/site/murmurhash/) a 64-bit hash for 64-bit platforms
All code is released to the public domain. For business purposes, Murmurhash is under the MIT license.
The same caveats as 32-bit MurmurHash2 apply here - beware of alignment and endian-ness issues if used across multiple platforms.
key | address of the memory block to hash. |
len | Number of bytes to hash. |
int new_settrie | ( | ) |
Create a new SetTrie object that can be used via the Python interface.
To free the resources allocated by this ID, the (python) caller must call destroy_settrie() with the st_id and never use the same st_id after that.
int next_set_id | ( | int | st_id, |
int | set_id | ||
) |
Return the integer set_id of the next set stored in a SetTrie after a given set_id to iterate over all the sets in the object.
st_id | The st_id returned by a previous new_settrie() call. |
set_id | A valid set_id returned by previous call or the constant -1 to return the first set. Note that 0 may be the set_id of the empty set in case the empty set is in the SetTrie. |
int num_sets | ( | int | st_id | ) |
Return the number of sets in a SetTrie object.
st_id | The st_id returned by a previous new_settrie() call. |
int purge | ( | int | st_id, |
int | dry_run | ||
) |
Purges (reassigns node integer ids and frees RAM) after a series of remove() calls.
st_id | The st_id returned by a previous new_settrie() call. |
dry_run | If nonzero, does nothing and returns the number of dirty nodes. |
bool push_binary_image_block | ( | int | st_id, |
char * | p_block | ||
) |
Pushes raw image blocks into an initially empty SetTrie object and finally creates it already populated with the binary image.
st_id | The st_id returned by a previous new_settrie() call. The object must be empty (never inserted). |
p_block | If non-empty, a block in the right order making a binary image obtained for a previous save_as_binary_image() call. If empty, an order to .load() the SetTrie object and destroyed the previously stored blocks. |
String python_set_as_string | ( | char * | p_char | ) |
int remove | ( | int | st_id, |
int | set_id | ||
) |
Removes a set from the object by its unique integer id.
st_id | The st_id returned by a previous new_settrie() call. |
set_id | A valid set_id returned by a successful next_set_id() call. |
int save_as_binary_image | ( | int | st_id | ) |
Saves a SetTrie object as a BinaryImage.
st_id | The st_id returned by a previous new_settrie() call. |
char * set_name | ( | int | st_id, |
int | set_id | ||
) |
Return the name (Python id) of a set stored in a SetTrie identified by its binary (int) set_id.
st_id | The st_id returned by a previous new_settrie() call. |
set_id | A valid set_id returned by a successful next_set_id() call. |
bool string_as_image_block | ( | ImageBlock & | blk, |
char * | p_in | ||
) |
int subsets | ( | int | st_id, |
char * | set | ||
) |
Find all the subsets of a given Python set (serialized by a str() call) stored inside a SetTrie object.
st_id | The st_id returned by a previous new_settrie() call. |
set | A Python set serialized by a str() call. |
int supersets | ( | int | st_id, |
char * | set | ||
) |
Find all the supersets of a given Python set (serialized by a str() call) stored inside a SetTrie object.
st_id | The st_id returned by a previous new_settrie() call. |
set | A Python set serialized by a str() call. |
char answer_block[8208] |
char answer_buffer[8192] |
const char b64chars[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" |
uint8_t b64inverse[256] = {0} |
BinaryImageServer image = {} |
SetTrieServer instance = {} |
int instance_iter = 0 |
int instance_num = 0 |
IterServer iterator = {} |