Added DynamicUCharVector.
diff --git a/ndn-cpp/util/dynamic-uchar-vector.cpp b/ndn-cpp/util/dynamic-uchar-vector.cpp
new file mode 100644
index 0000000..d346494
--- /dev/null
+++ b/ndn-cpp/util/dynamic-uchar-vector.cpp
@@ -0,0 +1,31 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "dynamic-uchar-vector.hpp"
+
+using namespace std;
+
+namespace ndn {
+
+DynamicUCharVector::DynamicUCharVector(unsigned int initialLength)
+: vector_(new vector<unsigned char>(initialLength))
+{
+ ndn_DynamicUCharArray_init(this, &vector_->front(), initialLength, DynamicUCharVector::realloc);
+}
+
+unsigned char *DynamicUCharVector::realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length)
+{
+ // Because this method is private, assume there is not a problem with upcasting.
+ DynamicUCharVector *thisObject = (DynamicUCharVector *)self;
+
+ if (array != &thisObject->vector_->front())
+ // We don't expect this to ever happen. The caller didn't pass the array from this object.
+ return 0;
+
+ thisObject->vector_->reserve(length);
+ return &thisObject->vector_->front();
+}
+
+}
diff --git a/ndn-cpp/util/dynamic-uchar-vector.hpp b/ndn-cpp/util/dynamic-uchar-vector.hpp
new file mode 100644
index 0000000..f372aff
--- /dev/null
+++ b/ndn-cpp/util/dynamic-uchar-vector.hpp
@@ -0,0 +1,48 @@
+/**
+ * @author: Jeff Thompson
+ * See COPYING for copyright and distribution information.
+ */
+
+#ifndef NDN_DYNAMIC_UCHAR_VECTOR_HPP
+#define NDN_DYNAMIC_UCHAR_VECTOR_HPP
+
+#include <vector>
+#include "../common.hpp"
+#include "../c/util/dynamic-uchar-array.h"
+
+namespace ndn {
+
+/**
+ * A DynamicUCharVector extends ndn_DynamicUCharArray to hold a shared_ptr<vector<unsigned char> > for use with
+ * C functions which need an ndn_DynamicUCharArray.
+ */
+class DynamicUCharVector : ndn_DynamicUCharArray {
+public:
+ /**
+ * Create a new DynamicUCharVector with an initial length.
+ * @param initialLength The initial size of the allocated vector.
+ */
+ DynamicUCharVector(unsigned int initialLength);
+
+ /**
+ * Get the shared_ptr to the allocated vector.
+ * @return The shared_ptr to the allocated vector.
+ */
+ const ptr_lib::shared_ptr<std::vector<unsigned char> > &get() { return vector_; }
+
+private:
+ /**
+ * Implement the static realloc function using vector reserve.
+ * @param self A pointer to this object.
+ * @param array Should be the front of the vector.
+ * @param length The new length for the vector.
+ * @return The front of the allocated vector.
+ */
+ static unsigned char *realloc(struct ndn_DynamicUCharArray *self, unsigned char *array, unsigned int length);
+
+ ndn::ptr_lib::shared_ptr<std::vector<unsigned char> > vector_;
+};
+
+}
+
+#endif