--- /dev/null
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#include "cls_refcount_ops.h"
+#include "common/Formatter.h"
+#include "common/ceph_json.h"
+
+void cls_refcount_get_op::dump(ceph::Formatter *f) const
+{
+ f->dump_string("tag", tag);
+ f->dump_int("implicit_ref", (int)implicit_ref);
+}
+
+void cls_refcount_get_op::generate_test_instances(list<cls_refcount_get_op*>& ls)
+{
+ ls.push_back(new cls_refcount_get_op);
+ ls.push_back(new cls_refcount_get_op);
+ ls.back()->tag = "foo";
+ ls.back()->implicit_ref = true;
+}
+
+
+void cls_refcount_put_op::dump(ceph::Formatter *f) const
+{
+ f->dump_string("tag", tag);
+ f->dump_int("implicit_ref", (int)implicit_ref);
+}
+
+void cls_refcount_put_op::generate_test_instances(list<cls_refcount_put_op*>& ls)
+{
+ ls.push_back(new cls_refcount_put_op);
+ ls.push_back(new cls_refcount_put_op);
+ ls.back()->tag = "foo";
+ ls.back()->implicit_ref = true;
+}
+
+
+
+void cls_refcount_set_op::dump(ceph::Formatter *f) const
+{
+ encode_json("refs", refs, f);
+}
+
+void cls_refcount_set_op::generate_test_instances(list<cls_refcount_set_op*>& ls)
+{
+ ls.push_back(new cls_refcount_set_op);
+ ls.push_back(new cls_refcount_set_op);
+ ls.back()->refs.push_back("foo");
+ ls.back()->refs.push_back("bar");
+}
+
+
+void cls_refcount_read_op::dump(ceph::Formatter *f) const
+{
+ f->dump_int("implicit_ref", (int)implicit_ref);
+}
+
+void cls_refcount_read_op::generate_test_instances(list<cls_refcount_read_op*>& ls)
+{
+ ls.push_back(new cls_refcount_read_op);
+ ls.push_back(new cls_refcount_read_op);
+ ls.back()->implicit_ref = true;
+}
+
+
+void cls_refcount_read_ret::dump(ceph::Formatter *f) const
+{
+ f->open_array_section("refs");
+ for (list<string>::const_iterator p = refs.begin(); p != refs.end(); ++p)
+ f->dump_string("ref", *p);
+ f->close_section();
+}
+
+void cls_refcount_read_ret::generate_test_instances(list<cls_refcount_read_ret*>& ls)
+{
+ ls.push_back(new cls_refcount_read_ret);
+ ls.push_back(new cls_refcount_read_ret);
+ ls.back()->refs.push_back("foo");
+ ls.back()->refs.push_back("bar");
+}
}
template<class T>
-static void encode_json(const char *name, const T& val, Formatter *f)
+static void encode_json(const char *name, const T& val, ceph::Formatter *f)
{
f->open_object_section(name);
val.dump(f);
class utime_t;
-void encode_json(const char *name, const string& val, Formatter *f);
-void encode_json(const char *name, const char *val, Formatter *f);
-void encode_json(const char *name, bool val, Formatter *f);
-void encode_json(const char *name, int val, Formatter *f);
-void encode_json(const char *name, unsigned val, Formatter *f);
-void encode_json(const char *name, long val, Formatter *f);
-void encode_json(const char *name, unsigned long val, Formatter *f);
-void encode_json(const char *name, long long val, Formatter *f);
-void encode_json(const char *name, const utime_t& val, Formatter *f);
-void encode_json(const char *name, const bufferlist& bl, Formatter *f);
-void encode_json(const char *name, long long val, Formatter *f);
-void encode_json(const char *name, long long unsigned val, Formatter *f);
+void encode_json(const char *name, const string& val, ceph::Formatter *f);
+void encode_json(const char *name, const char *val, ceph::Formatter *f);
+void encode_json(const char *name, bool val, ceph::Formatter *f);
+void encode_json(const char *name, int val, ceph::Formatter *f);
+void encode_json(const char *name, unsigned val, ceph::Formatter *f);
+void encode_json(const char *name, long val, ceph::Formatter *f);
+void encode_json(const char *name, unsigned long val, ceph::Formatter *f);
+void encode_json(const char *name, long long val, ceph::Formatter *f);
+void encode_json(const char *name, const utime_t& val, ceph::Formatter *f);
+void encode_json(const char *name, const bufferlist& bl, ceph::Formatter *f);
+void encode_json(const char *name, long long val, ceph::Formatter *f);
+void encode_json(const char *name, long long unsigned val, ceph::Formatter *f);
template<class K, class V>
-static void encode_json(const char *name, const std::map<K, V>& m, Formatter *f)
+static void encode_json(const char *name, const std::map<K, V>& m, ceph::Formatter *f)
{
f->open_array_section(name);
for (typename std::map<K, V>::const_iterator i = m.begin(); i != m.end(); ++i) {
}
template<class T>
-static void encode_json(const char *name, const std::list<T>& l, Formatter *f)
+static void encode_json(const char *name, const std::list<T>& l, ceph::Formatter *f)
{
f->open_array_section(name);
for (typename std::list<T>::const_iterator iter = l.begin(); iter != l.end(); ++iter) {
}
template<class K, class V>
-void encode_json_map(const char *name, const map<K, V>& m, Formatter *f)
+void encode_json_map(const char *name, const map<K, V>& m, ceph::Formatter *f)
{
f->open_array_section(name);
typename map<K,V>::const_iterator iter;
template<class K, class V>
void encode_json_map(const char *name, const char *index_name,
const char *object_name, const char *value_name,
- void (*cb)(const char *, const V&, Formatter *, void *), void *parent,
- const map<K, V>& m, Formatter *f)
+ void (*cb)(const char *, const V&, ceph::Formatter *, void *), void *parent,
+ const map<K, V>& m, ceph::Formatter *f)
{
f->open_array_section(name);
typename map<K,V>::const_iterator iter;
template<class K, class V>
void encode_json_map(const char *name, const char *index_name,
const char *object_name, const char *value_name,
- const map<K, V>& m, Formatter *f)
+ const map<K, V>& m, ceph::Formatter *f)
{
encode_json_map<K, V>(name, index_name, object_name, value_name, NULL, NULL, m, f);
}
template<class K, class V>
void encode_json_map(const char *name, const char *index_name, const char *value_name,
- const map<K, V>& m, Formatter *f)
+ const map<K, V>& m, ceph::Formatter *f)
{
encode_json_map<K, V>(name, index_name, NULL, value_name, NULL, NULL, m, f);
}