diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-05-30 10:07:34 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-05-30 10:07:34 +0200 |
commit | 0b59866a84f733e5a53b0d2f32570581691747ef (patch) | |
tree | 8861d97915544dc4385177931f299a6f27603c92 /src/trie.hpp | |
parent | 311fb0d852374e769d8ff791c9df38f0464960c6 (diff) |
Patches from sub-forward branch incorporated
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/trie.hpp')
-rw-r--r-- | src/trie.hpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/trie.hpp b/src/trie.hpp index dbf1cb1..a2b55c6 100644 --- a/src/trie.hpp +++ b/src/trie.hpp @@ -35,12 +35,28 @@ namespace zmq trie_t (); ~trie_t (); - void add (unsigned char *prefix_, size_t size_); + // Add key to the trie. Returns true if this is a new item in the trie + // rather than a duplicate. + bool add (unsigned char *prefix_, size_t size_); + + // Remove key from the trie. Returns true if the item is actually + // removed from the trie. bool rm (unsigned char *prefix_, size_t size_); + + // Check whether particular key is in the trie. bool check (unsigned char *data_, size_t size_); + // Apply the function supplied to each subscription in the trie. + void apply (void (*func_) (unsigned char *data_, size_t size_, + void *arg_), void *arg_); + private: + void apply_helper ( + unsigned char **buff_, size_t buffsize_, size_t maxbuffsize_, + void (*func_) (unsigned char *data_, size_t size_, void *arg_), + void *arg_); + uint32_t refcnt; unsigned char min; unsigned short count; |