From 0b59866a84f733e5a53b0d2f32570581691747ef Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Mon, 30 May 2011 10:07:34 +0200 Subject: Patches from sub-forward branch incorporated Signed-off-by: Martin Sustrik --- src/trie.hpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/trie.hpp') 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; -- cgit v1.2.3