make: Global change: Move all public headers to include folder. Change source to including public headers using #include <ndn-cpp/*>. Split some header files to minimize exposing C .h files.
diff --git a/ndn-cpp/util/blob.cpp b/ndn-cpp/util/blob.cpp
new file mode 100644
index 0000000..4ce9598
--- /dev/null
+++ b/ndn-cpp/util/blob.cpp
@@ -0,0 +1,30 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/**
+ * Copyright (C) 2013 Regents of the University of California.
+ * @author: Jeff Thompson <jefft0@remap.ucla.edu>
+ * See COPYING for copyright and distribution information.
+ */
+
+#include "../c/util/blob.h"
+#include <ndn-cpp/util/blob.hpp>
+
+using namespace std;
+
+namespace ndn {
+
+Blob::Blob(const struct ndn_Blob& blobStruct)
+ : ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(blobStruct.value, blobStruct.value + blobStruct.length))
+{
+}
+
+void
+Blob::get(struct ndn_Blob& blobStruct) const
+{
+ blobStruct.length = size();
+ if (size() > 0)
+ blobStruct.value = (uint8_t*)buf();
+ else
+ blobStruct.value = 0;
+}
+
+}
diff --git a/ndn-cpp/util/blob.hpp b/ndn-cpp/util/blob.hpp
deleted file mode 100644
index 2c238a6..0000000
--- a/ndn-cpp/util/blob.hpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_BLOB_HPP
-#define NDN_BLOB_HPP
-
-#include "../common.hpp"
-#include "../c/util/blob.h"
-
-namespace ndn {
-
-/**
- * A Blob holds a pointer to an immutable byte array implemented as const std::vector<uint8_t>.
- * This is like a JavaScript string which is a pointer to an immutable string.
- * It is OK to pass a pointer to the string because the new owner can't change the bytes
- * of the string. However, like a JavaScript string, it is possible to change the pointer, and so this does allow
- * the copy constructor and assignment to change the pointer. Also remember that the pointer can be null.
- * (Note that we could have made Blob derive directly from vector<uint8_t> and then explicitly use
- * a pointer to it like shared_ptr<Blob>, but this does not enforce immutability because we can't declare
- * Blob as derived from const vector<uint8_t>.)
- */
-class Blob : public ptr_lib::shared_ptr<const std::vector<uint8_t> > {
-public:
- /**
- * Create a new Blob with a null pointer.
- */
- Blob()
- {
- }
-
- /**
- * Create a new Blob with an immutable copy of the given array.
- * @param value A pointer to the byte array which is copied.
- * @param valueLength The length of value.
- */
- Blob(const uint8_t* value, size_t valueLength)
- : ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(value, value + valueLength))
- {
- }
-
- /**
- * Create a new Blob with an immutable copy of the array in the given vector.
- * If you want to transfer the array without copying, the the vector has to start as a
- * ptr_lib::shared_ptr<std::vector<uint8_t> > and you can use the Blob constructor with this type.
- * @param value A reference to a vector which is copied.
- */
- Blob(const std::vector<uint8_t> &value)
- : ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(value))
- {
- }
-
- /**
- * Create a new Blob with an immutable copy of the array in the given Blob struct.
- * @param blobStruct The C ndn_Blob struct to receive the pointer.
- */
- Blob(const struct ndn_Blob& blobStruct)
- : ptr_lib::shared_ptr<const std::vector<uint8_t> >(new std::vector<uint8_t>(blobStruct.value, blobStruct.value + blobStruct.length))
- {
- }
-
- /**
- * Create a new Blob to point to an existing byte array. IMPORTANT: After calling this constructor,
- * if you keep a pointer to the array then you must treat the array as immutable and promise not to change it.
- * @param value A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
- */
- Blob(const ptr_lib::shared_ptr<std::vector<uint8_t> > &value)
- : ptr_lib::shared_ptr<const std::vector<uint8_t> >(value)
- {
- }
- Blob(const ptr_lib::shared_ptr<const std::vector<uint8_t> > &value)
- : ptr_lib::shared_ptr<const std::vector<uint8_t> >(value)
- {
- }
-
- /**
- * Return the length of the immutable byte array.
- */
- size_t
- size() const
- {
- if (*this)
- return (*this)->size();
- else
- return 0;
- }
-
- /**
- * Return a const pointer to the first byte of the immutable byte array, or 0 if the pointer is null.
- */
- const uint8_t*
- buf() const
- {
- if (*this)
- return &(*this)->front();
- else
- return 0;
- }
-
- /**
- * Set the blobStruct to point to this Blob's byte array, without copying any memory.
- * WARNING: The resulting pointer in blobStruct is invalid after a further use of this object which could reallocate memory.
- * @param blobStruct The C ndn_Blob struct to receive the pointer.
- */
- void
- get(struct ndn_Blob& blobStruct) const
- {
- blobStruct.length = size();
- if (size() > 0)
- blobStruct.value = (uint8_t*)buf();
- else
- blobStruct.value = 0;
- }
-};
-
-}
-
-#endif
diff --git a/ndn-cpp/util/changed-event.cpp b/ndn-cpp/util/changed-event.cpp
index 63b4569..08dcb98 100644
--- a/ndn-cpp/util/changed-event.cpp
+++ b/ndn-cpp/util/changed-event.cpp
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/**
* Copyright (C) 2013 Regents of the University of California.
* @author: Jeff Thompson <jefft0@remap.ucla.edu>
diff --git a/ndn-cpp/util/changed-event.hpp b/ndn-cpp/util/changed-event.hpp
index ce4b20f..71be366 100644
--- a/ndn-cpp/util/changed-event.hpp
+++ b/ndn-cpp/util/changed-event.hpp
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/**
* Copyright (C) 2013 Regents of the University of California.
* @author: Jeff Thompson <jefft0@remap.ucla.edu>
@@ -8,7 +9,7 @@
#define NDN_CHANGED_EVENT_HPP
#include <vector>
-#include "../common.hpp"
+#include <ndn-cpp/common.hpp>
namespace ndn {
diff --git a/ndn-cpp/util/dynamic-uint8-vector.cpp b/ndn-cpp/util/dynamic-uint8-vector.cpp
index ae1b621..197fc0e 100644
--- a/ndn-cpp/util/dynamic-uint8-vector.cpp
+++ b/ndn-cpp/util/dynamic-uint8-vector.cpp
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/**
* Copyright (C) 2013 Regents of the University of California.
* @author: Jeff Thompson <jefft0@remap.ucla.edu>
diff --git a/ndn-cpp/util/dynamic-uint8-vector.hpp b/ndn-cpp/util/dynamic-uint8-vector.hpp
index 9550899..b69606d 100644
--- a/ndn-cpp/util/dynamic-uint8-vector.hpp
+++ b/ndn-cpp/util/dynamic-uint8-vector.hpp
@@ -1,3 +1,4 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
/**
* Copyright (C) 2013 Regents of the University of California.
* @author: Jeff Thompson <jefft0@remap.ucla.edu>
@@ -8,7 +9,7 @@
#define NDN_DYNAMIC_UCHAR_VECTOR_HPP
#include <vector>
-#include "../common.hpp"
+#include <ndn-cpp/common.hpp>
#include "../c/util/dynamic-uint8-array.h"
namespace ndn {
diff --git a/ndn-cpp/util/logging.hpp b/ndn-cpp/util/logging.hpp
index 87d9ad5..f1afe72 100644
--- a/ndn-cpp/util/logging.hpp
+++ b/ndn-cpp/util/logging.hpp
@@ -9,7 +9,7 @@
#ifndef NDN_LOGGING_HPP
#define NDN_LOGGING_HPP
-#include "../common.hpp"
+#include <ndn-cpp//common.hpp>
#ifdef NDN_CPP_HAVE_LOG4CXX
diff --git a/ndn-cpp/util/signed-blob.hpp b/ndn-cpp/util/signed-blob.hpp
deleted file mode 100644
index dd94ae0..0000000
--- a/ndn-cpp/util/signed-blob.hpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Copyright (C) 2013 Regents of the University of California.
- * @author: Zhenkai Zhu <zhenkai@cs.ucla.edu>
- * @author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
- * @author: Jeff Thompson <jefft0@remap.ucla.edu>
- * See COPYING for copyright and distribution information.
- */
-
-#ifndef NDN_SIGNED_BLOB_HPP
-#define NDN_SIGNED_BLOB_HPP
-
-#include "blob.hpp"
-
-namespace ndn {
-
-/**
- * A SignedBlob extends Blob to keep the offsets of a signed portion (e.g., the bytes of Data packet).
- */
-class SignedBlob : public Blob {
-public:
- /**
- * Create a new SignedBlob with a null pointer.
- */
- SignedBlob()
- : signedPortionBeginOffset_(0), signedPortionEndOffset_(0)
- {
- }
-
- /**
- * Create a new SignedBlob with an immutable copy of the given array.
- * @param value A pointer to the byte array which is copied.
- * @param valueLength The length of value.
- * @param signedPortionBeginOffset The offset in the encoding of the beginning of the signed portion.
- * @param signedPortionEndOffset The offset in the encoding of the end of the signed portion.
- */
- SignedBlob
- (const uint8_t* value, size_t valueLength, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
- : Blob(value, valueLength), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
- {
- }
-
- /**
- * Create a new SignedBlob with an immutable copy of the array in the given vector.
- * If you want to transfer the array without copying, the the vector has to start as a
- * ptr_lib::shared_ptr<std::vector<uint8_t> > and you can use the SignedBlob constructor with this type.
- * @param value A reference to a vector which is copied.
- * @param signedPortionBeginOffset The offset in the encoding of the beginning of the signed portion.
- * @param signedPortionEndOffset The offset in the encoding of the end of the signed portion.
- */
- SignedBlob
- (const std::vector<uint8_t> &value, size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
- : Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
- {
- }
-
- /**
- * Create a new SignedBlob to point to an existing byte array. IMPORTANT: After calling this constructor,
- * if you keep a pointer to the array then you must treat the array as immutable and promise not to change it.
- * @param value A pointer to a vector with the byte array. This takes another reference and does not copy the bytes.
- * @param signedPortionBeginOffset The offset in the array of the beginning of the signed portion.
- * @param signedPortionEndOffset The offset in the array of the end of the signed portion.
- */
- SignedBlob
- (const ptr_lib::shared_ptr<std::vector<uint8_t> > &value,
- size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
- : Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
- {
- }
- SignedBlob
- (const ptr_lib::shared_ptr<const std::vector<uint8_t> > &value,
- size_t signedPortionBeginOffset, size_t signedPortionEndOffset)
- : Blob(value), signedPortionBeginOffset_(signedPortionBeginOffset), signedPortionEndOffset_(signedPortionEndOffset)
- {
- }
-
- /**
- * Return the length of the signed portion of the immutable byte array, or 0 of the pointer to the array is null.
- */
- size_t
- signedSize() const
- {
- if (*this)
- return signedPortionEndOffset_ - signedPortionBeginOffset_;
- else
- return 0;
- }
-
- /**
- * Return a const pointer to the first byte of the signed portion of the immutable byte array, or 0 if the
- * pointer to the array is null.
- */
- const uint8_t*
- signedBuf() const
- {
- if (*this)
- return &(*this)->front() + signedPortionBeginOffset_;
- else
- return 0;
- }
-
- /**
- * Return the offset in the array of the beginning of the signed portion.
- */
- size_t
- getSignedPortionBeginOffset() { return signedPortionBeginOffset_; }
-
- /**
- * Return the offset in the array of the end of the signed portion.
- */
- size_t
- getSignedPortionEndOffset() { return signedPortionEndOffset_; }
-
-private:
- size_t signedPortionBeginOffset_;
- size_t signedPortionEndOffset_;
-};
-
-}
-
-#endif