0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-26 23:01:04 +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)
endif()
if(ENABLE_DRAFTS)
option (ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" ON)
add_definitions(-DZMQ_BUILD_DRAFT_API)
set(pkg_config_defines "-DZMQ_BUILD_DRAFT_API=1")
else()
option (ENABLE_RADIX_TREE "Use radix tree implementation to manage subscriptions" OFF)
set(pkg_config_defines "")
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)
if(WITH_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 "dist.hpp"
#include "fq.hpp"
#ifdef ZMQ_BUILD_DRAFT_API
#ifdef ZMQ_USE_RADIX_TREE
#include "radix_tree.hpp"
#else
#include "trie.hpp"
@ -82,7 +82,7 @@ class xsub_t : public socket_base_t
dist_t _dist;
// The repository of subscriptions.
#ifdef ZMQ_BUILD_DRAFT_API
#ifdef ZMQ_USE_RADIX_TREE
radix_tree _subscriptions;
#else
trie_t _subscriptions;