44#ifdef ONLY_FOR_DOXYGEN
53#ifndef RBT_WRAPPER_H_PREFIX_
54#error RBT_WRAPPER_H_PREFIX_ is not defined.
58#error RBT_KEY_T is not defined.
61#ifndef RBT_KEY_COUNT_BITS
62#error RBT_KEY_COUNT_BITS is not defined.
66#error RBT_KEY_PTR is not defined.
70#error RBT_KEY_FPRINT is not defined.
78#undef RBT_NODE_QUERY_WRAPPER
79#define RBT_NODE_QUERY_WRAPPER RBT_TOKEN_2_W(RBT_WRAPPER_H_PREFIX_, node_query_wrapper)
82#define RBT_DELETE RBT_TOKEN_2_W(RBT_WRAPPER_H_PREFIX_, delete)
85#define RBT_HAS_KEY RBT_TOKEN_2_W(RBT_WRAPPER_H_PREFIX_, has_key)
88#define RBT_INSERT RBT_TOKEN_2_W(RBT_WRAPPER_H_PREFIX_, insert)
91#define RBT_RETRIEVE RBT_TOKEN_2_W(RBT_WRAPPER_H_PREFIX_, retrieve)
94#define RBT_SWAP RBT_TOKEN_2_W(RBT_WRAPPER_H_PREFIX_, swap)
130#define RBT_PINS_FIXED ((RBT_KEY_SIZE_FIXED + (RBT_PIN_SIZE - 1)) / RBT_PIN_SIZE)
150#undef _RBT_NODE_QUERY_WITH_CAST_KEY
151#ifdef RBT_KEY_SIZE_FIXED
152 #define _RBT_NODE_QUERY_WITH_CAST_KEY(node, key, bits, action, value) \
155 if (RBT_PIN_SIZE != 1) \
157 if (RBT_KEY_SIZE_FIXED % RBT_PIN_SIZE) \
159 RBT_PIN_T cast_key[RBT_PINS_FIXED]; \
160 memset(cast_key, 0, sizeof(cast_key)); \
161 memcpy(cast_key, RBT_KEY_PTR(key), RBT_KEY_SIZE_FIXED); \
162 bits = sizeof(cast_key) * BITS_PER_BYTE; \
163 return RBT_NODE_QUERY(node, cast_key, bits, action, value); \
167 return RBT_NODE_QUERY(node, (RBT_PIN_T *) RBT_KEY_PTR(key), bits, action, value); \
172 return RBT_NODE_QUERY(node, (RBT_PIN_T *) RBT_KEY_PTR(key), bits, action, value); \
178 #define _RBT_NODE_QUERY_WITH_CAST_KEY(node, key, bits, action, value) \
181 if (RBT_PIN_SIZE != 1) \
185 RBT_DIVMOD(bits, RBT_PIN_SIZE_BITS, q, r); \
189 RBT_PIN_T cast_key[q]; \
190 memset(cast_key, 0, sizeof(cast_key)); \
191 memcpy(cast_key, RBT_KEY_PTR(key), (bits + (BITS_PER_BYTE - 1)) / BITS_PER_BYTE); \
192 bits = q * RBT_PIN_SIZE_BITS; \
193 return RBT_NODE_QUERY(node, cast_key, bits, action, value); \
197 return RBT_NODE_QUERY(node, (RBT_PIN_T *) RBT_KEY_PTR(key), bits, action, value); \
202 return RBT_NODE_QUERY(node, (RBT_PIN_T *) RBT_KEY_PTR(key), bits, action, value); \
241 bits = RBT_KEY_COUNT_BITS(key);
244 _RBT_NODE_QUERY_WITH_CAST_KEY(node, key, bits, action, value);
#define RBT_TOKEN_2_W(a, b)
A wrapper for RBT_TOKEN_2() to ensure macro expansion.
Definition: common.h:240
rbt_query_action_t
Query action for RBT_NODE_QUERY().
Definition: common.h:408
@ RBT_QUERY_ACTION_SWAP
Definition: common.h:435
@ RBT_QUERY_ACTION_RETRIEVE
Definition: common.h:422
@ RBT_QUERY_ACTION_DELETE
Definition: common.h:412
@ RBT_QUERY_ACTION_INSERT
Definition: common.h:417
RBT_VALUE_T RBT_VALUE_T
The node's value type.
Definition: node.h:409
#define RBT_VALUE_IS_NULL(value)
Definition: node.h:395
Rabbit Tree node type.
Definition: node.h:420
RBT_VALUE_T RBT_DELETE(RBT_NODE_T *node, RBT_KEY_T key)
Definition: wrapper.h:312
RBT_VALUE_T RBT_SWAP(RBT_NODE_T *node, RBT_KEY_T key, RBT_VALUE_T value)
Definition: wrapper.h:338
int RBT_HAS_KEY(RBT_NODE_T *node, RBT_KEY_T key)
Definition: wrapper.h:357
RBT_VALUE_T RBT_NODE_QUERY_WRAPPER(RBT_NODE_T *node, RBT_KEY_T key, rbt_query_action_t action, RBT_VALUE_T value)
Definition: wrapper.h:233
RBT_VALUE_T RBT_INSERT(RBT_NODE_T *node, RBT_KEY_T key, RBT_VALUE_T value)
Definition: wrapper.h:265
RBT_VALUE_T RBT_RETRIEVE(RBT_NODE_T *node, RBT_KEY_T key)
Definition: wrapper.h:289