summaryrefslogtreecommitdiff
path: root/src/barclass.cc
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2009-05-27 15:53:49 -0700
committerYehuda Sadeh <yehuda@hq.newdream.net>2009-05-27 15:54:42 -0700
commit41cee828d6f5c4fe19dec8fece5d23d2b220e540 (patch)
tree5a5147698cc40c671dde5ad3e8bf7227354b2e46 /src/barclass.cc
parente7a12253f7d5c80f4c4daf8a301c84356b113273 (diff)
downloadceph-41cee828d6f5c4fe19dec8fece5d23d2b220e540.tar.gz
class: dependent classes are loaded automatically
Diffstat (limited to 'src/barclass.cc')
-rw-r--r--src/barclass.cc48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/barclass.cc b/src/barclass.cc
new file mode 100644
index 00000000000..f5354f1e0f3
--- /dev/null
+++ b/src/barclass.cc
@@ -0,0 +1,48 @@
+
+
+
+#include <iostream>
+#include <string.h>
+#include <stdlib.h>
+
+#include "objclass/objclass.h"
+
+CLS_VER(1,0)
+CLS_NAME(bar)
+
+cls_handle_t h_class;
+
+cls_method_handle_t h_foo;
+
+int foo_method(cls_method_context_t ctx, char *indata, int datalen,
+ char **outdata, int *outdatalen)
+{
+ int i;
+
+ cls_log("hello world, this is bar");
+ cls_log("indata=%s", indata);
+
+ *outdata = (char *)malloc(128);
+ for (i=0; i<strlen(indata) + 1; i++) {
+ if (indata[i] == '0') {
+ (*outdata)[i] = '*';
+ } else {
+ (*outdata)[i] = indata[i];
+ }
+ }
+ *outdatalen = strlen(*outdata) + 1;
+ cls_log("outdata=%s", *outdata);
+
+ return 0;
+}
+
+void class_init()
+{
+ cls_log("Loaded bar class!");
+
+ cls_register("bar", &h_class);
+ cls_register_method(h_class, "bar", foo_method, &h_foo);
+
+ return;
+}
+