0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-15 02:07:59 +08:00

Add specific option to select radix tree implementation for subscriptions (#3304)

* Add specific option to select radix tree implementation for subscriptions (defaults to ON if draft API enabled).
This commit is contained in:
Bill Torpey 2018-11-12 16:57:11 -05:00 committed by Luca Boccassi
parent d60ed2d626
commit 25e069d131
2 changed files with 9 additions and 2 deletions

View File

@ -114,12 +114,19 @@ else()
option(ENABLE_DRAFTS "Build and install draft classes and methods" OFF) option(ENABLE_DRAFTS "Build and install draft classes and methods" OFF)
endif() endif()
if(ENABLE_DRAFTS) if(ENABLE_DRAFTS)
option (ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" ON)
add_definitions(-DZMQ_BUILD_DRAFT_API) add_definitions(-DZMQ_BUILD_DRAFT_API)
set(pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1") set(pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")
else() else()
option (ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" OFF)
set(pkg_config_defines "") set(pkg_config_defines "")
endif() endif()
if (ENABLE_RADIX_TREE)
message(STATUS "Using radix tree implementation to manage subscriptions")
add_definitions(-DZMQ_USE_RADIX_TREE)
endif()
option(WITH_MILITANT "Enable militant assertions" OFF) option(WITH_MILITANT "Enable militant assertions" OFF)
if(WITH_MILITANT) if(WITH_MILITANT)
add_definitions(-DZMQ_ACT_MILITANT) add_definitions(-DZMQ_ACT_MILITANT)

4
src/xsub.hpp Normal file → Executable file
View File

@ -34,7 +34,7 @@
#include "session_base.hpp" #include "session_base.hpp"
#include "dist.hpp" #include "dist.hpp"
#include "fq.hpp" #include "fq.hpp"
#ifdef ZMQ_BUILD_DRAFT_API #ifdef ZMQ_USE_RADIX_TREE
#include "radix_tree.hpp" #include "radix_tree.hpp"
#else #else
#include "trie.hpp" #include "trie.hpp"
@ -82,7 +82,7 @@ class xsub_t : public socket_base_t
dist_t _dist; dist_t _dist;
// The repository of subscriptions. // The repository of subscriptions.
#ifdef ZMQ_BUILD_DRAFT_API #ifdef ZMQ_USE_RADIX_TREE
radix_tree _subscriptions; radix_tree _subscriptions;
#else #else
trie_t _subscriptions; trie_t _subscriptions;