^autom4te.cache$
^include/(libmemcached_config.h(.in)?|stamp-h1)$
^stamp-h1$
+^lib/libmemcachedPlus.la$
+^tests/testplus$
+
# Build artifacts
^lib/libmemcached.la$
+ * First prototype of C++ interface
* Updated docs for uint16_t changes in previous release
0.13 Sun Jan 13 06:51:50 PST 2008
--- /dev/null
+#ifdef USE_PRAGMA_INTERFACE
+#pragma interface /* gcc class implementation */
+#endif
+
+#include <memcached.h>
+#include <stdio.h>
+
+class Memcached
+{
+ memcached_st memc;
+
+public:
+
+ Memcached();
+ Memcached(memcached_st *clone);
+ ~Memcached()
+ {
+ memcached_free(&memc);
+ }
+
+ char *get(char *key, size_t *value_length);
+ memcached_return set(char *key, char *value, size_t value_length);
+};
memcached_io.h \
common.h
-lib_LTLIBRARIES = libmemcached.la
+lib_LTLIBRARIES = libmemcached.la libmemcachedPlus.la
+
libmemcached_la_SOURCES = crc.c \
hsieh_hash.c \
memcached.c \
libmemcached_la_LIBADD =
libmemcached_la_LDFLAGS = -version-info $(MEMCACHED_LIBRARY_VERSION)
+libmemcachedPlus_la_SOURCES = memcachedplus.cpp
+libmemcachedPlus_la_LIBADD =
+libmemcachedPlus_la_LDFLAGS = -version-info $(MEMCACHED_LIBRARY_VERSION)
+
if HAVE_DTRACE
libmemcached_la_LIBADD += libmemcached_probes.o
endif
--- /dev/null
+/*
+ Memcached library
+*/
+
+#ifdef USE_PRAGMA_IMPLEMENTATION
+#pragma implementation // gcc: Class implementation
+#endif
+
+#include <strings.h>
+#include <memcached.hh>
+
+Memcached::Memcached()
+{
+ memcached_create(&memc);
+}
+
+Memcached::Memcached(memcached_st *clone)
+{
+ WATCHPOINT;
+ memcached_clone(&memc, clone);
+ WATCHPOINT;
+}
+
+char *Memcached::get(char *key, size_t *value_length)
+{
+ uint32_t flags;
+ memcached_return rc;
+
+ return memcached_get(&memc, key, strlen(key),
+ value_length, &flags, &rc);
+}
+
+memcached_return Memcached::set(char *key, char *value, size_t value_length)
+{
+ return memcached_set(&memc, key, strlen(key),
+ value, value_length,
+ (time_t)0, (uint32_t)0);
+}
LIBS =
noinst_HEADERS = test.h
-noinst_PROGRAMS = testapp
+noinst_PROGRAMS = testapp testplus
testapp_SOURCES = test.c function.c ../src/generator.c ../src/execute.c
testapp_LDADD = $(LDADDS)
+testplus_SOURCES = test.c plus.cpp
+testplus_LDADD = $(LDADDS) ../lib/libmemcachedPlus.la
+
record:
./testapp > output.res
--- /dev/null
+/*
+ C++ interface test
+*/
+#include <assert.h>
+#include <memcached.h>
+#include <memcached.hh>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+#include <time.h>
+
+#include "test.h"
+
+uint8_t basic_test(memcached_st *memc)
+{
+ Memcached foo;
+ char *value_set= "This is some data";
+ char *value;
+ size_t value_length;
+
+ foo.set("mine", value_set, strlen(value_set));
+ value= foo.get("mine", &value_length);
+
+ assert((memcmp(value, value_set, value_length) == 0));
+
+ return 0;
+}
+
+test_st tests[] ={
+ {"basic", 0, basic_test },
+ {0, 0, 0}
+};
+
+collection_st collection[] ={
+ {"block", 0, 0, tests},
+ {0, 0, 0, 0}
+};
+
+collection_st *gets_collections(void)
+{
+ return collection;
+}
/*
Structures for generic tests.
*/
+#ifdef __cplusplus
+extern "C" {
+
+#endif
#include <memcached.h>
#include "../lib/common.h"
/* How we make all of this work :) */
collection_st *gets_collections(void);
+
+#ifdef __cplusplus
+}
+#endif