summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@users.sourceforge.jp>2009-03-01 02:55:45 +0900
committerfrsyuki <frsyuki@users.sourceforge.jp>2009-03-01 02:55:45 +0900
commitb33ecbd92baa866803e34e9d7f1148007b16f180 (patch)
tree76fa40792d7f862342a5b51cbe4ea12f26a630a7 /cpp
parentef1c4f82b27e2690694e1995828ca374b5cd225e (diff)
downloadmsgpack-python-b33ecbd92baa866803e34e9d7f1148007b16f180.tar.gz
msgpack_zone_clear, msgpack::zone::clear
Diffstat (limited to 'cpp')
-rw-r--r--cpp/unpack.hpp8
-rw-r--r--cpp/zone.hpp.erb7
2 files changed, 15 insertions, 0 deletions
diff --git a/cpp/unpack.hpp b/cpp/unpack.hpp
index 38ac7ac..324111a 100644
--- a/cpp/unpack.hpp
+++ b/cpp/unpack.hpp
@@ -64,6 +64,9 @@ public:
// otherwise the memrory will leak.
zone* release_zone();
+ /*! 5.2. this method is equivalence to `delete release_zone()` */
+ void reset_zone();
+
/*! 5.3. after release_zone(), re-initialize unpacker */
void reset();
@@ -217,6 +220,11 @@ inline zone* unpacker::release_zone()
return r;
}
+inline void unpacker::reset_zone()
+{
+ msgpack_unpacker_reset_zone(this);
+}
+
inline void unpacker::reset()
{
msgpack_unpacker_reset(this);
diff --git a/cpp/zone.hpp.erb b/cpp/zone.hpp.erb
index a253627..930c8e8 100644
--- a/cpp/zone.hpp.erb
+++ b/cpp/zone.hpp.erb
@@ -37,6 +37,8 @@ public:
void push_finalizer(void (*func)(void*), void* data);
+ void clear();
+
<%0.upto(GENERATION_LIMIT) {|i|%>
template <typename T<%1.upto(i) {|j|%>, typename A<%=j%><%}%>>
T* allocate(<%=(1..i).map{|j|"A#{j} a#{j}"}.join(', ')%>);
@@ -78,6 +80,11 @@ inline void zone::push_finalizer(void (*func)(void*), void* data)
}
}
+inline void zone::clear()
+{
+ msgpack_zone_clear(this);
+}
+
template <typename T>
void zone::object_destructor(void* obj)
{