basic wrapping of Annotations
[mussa.git] / py / annotations.cpp
diff --git a/py/annotations.cpp b/py/annotations.cpp
new file mode 100644 (file)
index 0000000..4c0c53c
--- /dev/null
@@ -0,0 +1,31 @@
+#include <boost/iterator.hpp>
+
+#include <boost/python.hpp>
+#include <boost/python/return_value_policy.hpp>
+#include <boost/python/manage_new_object.hpp>
+
+#include <boost/python/register_ptr_to_python.hpp>
+using namespace boost::python;
+
+#include "alg/annotations.hpp"
+
+#include "stl_container_adapter.hpp"
+
+void export_annotations()
+{
+
+  class_<Annotations>("annotations", init<std::string>())
+    .add_property("name", &Annotations::name, &Annotations::setName)
+    .def("__contains__", &map_item<Annotations>::in)
+    .def("__delitem__", &map_item<Annotations>::del)
+    .def("__getitem__", &map_item<Annotations>::get,
+        return_value_policy<copy_non_const_reference>())
+    .def("__setitem__", &map_item<Annotations>::set)
+    .def("__len__", &Annotations::size)
+    .def("keys", &map_item<Annotations>::keys)
+    .def("values", &map_item<Annotations>::values)
+    .def("items", &map_item<Annotations>::items)
+    ;
+
+  //register_ptr_to_python< AnnotationsRef >();
+}