return false;
}
-
-#ifdef __cplusplus
-hashkit_st operator=(const hashkit_st& source)
-{
- hashkit_clone(this, &source);
-
- return *this;
-}
-#endif
struct {
bool is_allocated:1;
} options;
+};
#ifdef __cplusplus
+class Hashkit : private hashkit_st {
+
+public:
- hashkit_st() :
- base_hash(),
- distribution_hash(),
- flags(),
- options()
+ Hashkit()
{
hashkit_create(this);
}
- hashkit_st(const hashkit_st& source) :
- base_hash(),
- distribution_hash(),
- flags(),
- options()
+ Hashkit(const Hashkit& source)
{
hashkit_clone(this, &source);
}
- hashkit_st& operator=(const hashkit_st& source)
+ Hashkit& operator=(const Hashkit& source)
{
hashkit_free(this);
hashkit_clone(this, &source);
return *this;
}
- friend bool operator==(const hashkit_st &left, const hashkit_st &right)
+ friend bool operator==(const Hashkit &left, const Hashkit &right)
{
return hashkit_compare(&left, &right);
}
return hashkit_set_function(this, hash_algorithm);
}
- ~hashkit_st()
+ ~Hashkit()
{
hashkit_free(this);
}
-#endif
};
+#endif
#endif /* HASHKIT_H */
#ifdef __cplusplus
-typedef struct hashkit_st Hashkit;
-
extern "C" {
#endif
#include <libmemcached/verbosity.h>
#include <libmemcached/version.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-LIBMEMCACHED_API
-void memcached_servers_reset(memcached_st *ptr);
-
-LIBMEMCACHED_API
-memcached_st *memcached_create(memcached_st *ptr);
-
-LIBMEMCACHED_API
-void memcached_free(memcached_st *ptr);
-
-LIBMEMCACHED_API
-memcached_st *memcached_clone(memcached_st *clone, const memcached_st *ptr);
-
-LIBMEMCACHED_API
-void *memcached_get_user_data(const memcached_st *ptr);
-
-LIBMEMCACHED_API
-void *memcached_set_user_data(memcached_st *ptr, void *data);
-
-#ifdef __cplusplus
-} // extern "C"
-#endif
-
-
struct memcached_st {
/**
@note these are static and should not change without a call to behavior.
bool is_allocated:1;
} options;
+};
+
#ifdef __cplusplus
- memcached_st() :
- state(),
- flags(),
- distribution(),
- hashkit(),
- continuum_points_counter(),
- number_of_hosts(),
- servers(),
- last_disconnected_server(),
- snd_timeout(),
- rcv_timeout(),
- server_failure_limit(),
- io_msg_watermark(),
- io_bytes_watermark(),
- io_key_prefetch(),
- cached_errno(),
- poll_timeout(),
- connect_timeout(),
- retry_timeout(),
- continuum_count(),
- send_size(),
- recv_size(),
- user_data(),
- next_distribution_rebuild(),
- prefix_key_length(),
- number_of_replicas(),
- distribution_hashkit(),
- result(),
- continuum(),
- allocators(),
- on_clone(),
- on_cleanup(),
- get_key_failure(),
- delete_trigger(),
- callbacks(),
- prefix_key(),
- options()
+extern "C" {
+#endif
+
+LIBMEMCACHED_API
+void memcached_servers_reset(memcached_st *ptr);
+
+LIBMEMCACHED_API
+memcached_st *memcached_create(memcached_st *ptr);
+
+LIBMEMCACHED_API
+void memcached_free(memcached_st *ptr);
+
+LIBMEMCACHED_API
+memcached_st *memcached_clone(memcached_st *clone, const memcached_st *ptr);
+
+LIBMEMCACHED_API
+void *memcached_get_user_data(const memcached_st *ptr);
+
+LIBMEMCACHED_API
+void *memcached_set_user_data(memcached_st *ptr, void *data);
+
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
+
+// Local Only Inline
+static inline memcached_server_st *memcached_server_instance_fetch(memcached_st *ptr, uint32_t server_key)
+{
+ return &ptr->servers[server_key];
+}
+
+#ifdef __cplusplus
+class Memcached : private memcached_st {
+public:
+
+ Memcached()
{
memcached_create(this);
}
- ~memcached_st()
+ ~Memcached()
{
memcached_free(this);
}
- memcached_st(const memcached_st& source) :
- state(),
- flags(),
- distribution(),
- hashkit(),
- continuum_points_counter(),
- number_of_hosts(),
- servers(),
- last_disconnected_server(),
- snd_timeout(),
- rcv_timeout(),
- server_failure_limit(),
- io_msg_watermark(),
- io_bytes_watermark(),
- io_key_prefetch(),
- cached_errno(),
- poll_timeout(),
- connect_timeout(),
- retry_timeout(),
- continuum_count(),
- send_size(),
- recv_size(),
- user_data(),
- next_distribution_rebuild(),
- prefix_key_length(),
- number_of_replicas(),
- distribution_hashkit(),
- result(),
- continuum(),
- allocators(),
- on_clone(),
- on_cleanup(),
- get_key_failure(),
- delete_trigger(),
- callbacks(),
- prefix_key(),
- options()
- {
- memcached_clone(this, &source);
- }
+ Memcached(const Memcached& source)
+ {
+ memcached_clone(this, &source);
+ }
- memcached_st& operator=(const memcached_st& source)
+ Memcached& operator=(const Memcached& source)
{
memcached_free(this);
memcached_clone(this, &source);
return *this;
}
-
-#endif
};
-
-
-// Local Only Inline
-static inline memcached_server_st *memcached_server_instance_fetch(memcached_st *ptr, uint32_t server_key)
-{
- return &ptr->servers[server_key];
-}
+#endif
#endif /* __LIBMEMCACHED_MEMCACHED_H__ */
+
m4_if(PW_LESS_WARNINGS,[no],[
BASE_WARNINGS_FULL="-Wformat=2 ${W_CONVERSION} -Wstrict-aliasing"
CC_WARNINGS_FULL="-Wswitch-default -Wswitch-enum -Wwrite-strings"
- CXX_WARNINGS_FULL="-Weffc++ -Wold-style-cast"
+ CXX_WARNINGS_FULL="-Wold-style-cast"
],[
BASE_WARNINGS_FULL="-Wformat ${NO_STRICT_ALIASING}"
])
{
Hashkit hashk;
(void)obj;
+ (void)hashk;
return TEST_SUCCESS;
}
noinst_PROGRAMS+= \
tests/atomsmasher \
tests/hashplus \
+ tests/memplus \
tests/startservers \
tests/testapp \
tests/testhashkit \
tests_hashplus_LDADD = $(tests_testhashkit_LDADD)
tests_hashplus_DEPENDENCIES = $(tests_testhashkit_LDADD)
+tests_memplus_SOURCES = tests/mem_plus.cc
+tests_memplus_LDADD = tests/libtest.la tests/libserver.la libmemcached/libmemcached.la
+tests_memplus_DEPENDENCIES = $(tests_memplus_LDADD)
+
test: test-docs test-mem test-hash memcapable
echo "Tests completed"
MEM_COMMAND= tests/testapp $(COLLECTION) $(SUITE)
-MEMPLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
+TESTPLUS_COMMAND= tests/testplus $(COLLECTION) $(SUITE)
+
+MEMPLUS_COMMAND= tests/memplus $(COLLECTION) $(SUITE)
HASHPLUS_COMMAND= tests/hashplus $(COLLECTION) $(SUITE)
$(ATOM_COMMAND)
test-plus: tests/testplus
- $(MEMPLUS_COMMAND)
+ $(TESTPLUS_COMMAND)
test-hash: tests/testhashkit
$(HASH_COMMAND)
test-hashplus: tests/hashplus
$(HASHPLUS_COMMAND)
+test-memplus: tests/memplus
+ $(MEMPLUS_COMMAND)
+
pahole-mem: tests/testapp
$(PAHOLE_COMMAND) $(MEM_COMMAND)
$(DEBUG_COMMAND) $(ATOM_COMMAND)
gdb-plus: tests/testplus
- $(DEBUG_COMMAND) $(MEMPLUS_COMMAND)
+ $(DEBUG_COMMAND) $(TESTPLUS_COMMAND)
gdb-hash: tests/testhashkit
$(DEBUG_COMMAND) $(HASH_COMMAND)
gdb-hashplus: tests/hashplus
$(DEBUG_COMMAND) $(HASHPLUS_COMMAND)
+gdb-memplus: tests/memplus
+ $(DEBUG_COMMAND) $(MEMPLUS_COMMAND)
+
gdb-memslap: clients/memslap
$(DEBUG_COMMAND) $(MEMSLAP_COMMAND)
$(VALGRIND_COMMAND) $(ATOM_COMMAND)
valgrind-plus: tests/testplus
- $(VALGRIND_COMMAND) $(MEMPLUS_COMMAND)
+ $(VALGRIND_COMMAND) $(TESTPLUS_COMMAND)
valgrind-hash: tests/testhashkit
$(VALGRIND_COMMAND) $(HASH_COMMAND)
valgrind-hashplus: tests/hashplus
$(VALGRIND_COMMAND) $(HASHPLUS_COMMAND)
+valgrind-memplus: tests/memplus
+ $(VALGRIND_COMMAND) $(MEMPLUS_COMMAND)
+
valgrind-memslap: clients/memslap
$(VALGRIND_COMMAND) $(MEMSLAP_COMMAND)