Basic implementation of ObjectDb and ObjectManager. Local files can be
put as a set of fully formatted ContentObjects to the ObjectDb, and
extracted from this Db.
diff --git a/include/ccnx-common.h b/include/ccnx-common.h
index 031d27d..41d7814 100644
--- a/include/ccnx-common.h
+++ b/include/ccnx-common.h
@@ -38,6 +38,7 @@
#include <sstream>
#include <map>
#include <utility>
+#include <string.h>
using namespace std;
namespace Ccnx {
@@ -45,13 +46,45 @@
typedef vector<string>Comps;
typedef boost::shared_ptr<Bytes> BytesPtr;
-
-// --- Bytes operations start ---
-void
-readRaw(Bytes &bytes, const unsigned char *src, size_t len);
+inline
const unsigned char *
-head(const Bytes &bytes);
+head(const Bytes &bytes)
+{
+ return &bytes[0];
+}
+
+inline
+unsigned char *
+head (Bytes &bytes)
+{
+ return &bytes[0];
+}
+
+// --- Bytes operations start ---
+inline void
+readRaw(Bytes &bytes, const unsigned char *src, size_t len)
+{
+ if (len > 0)
+ {
+ bytes.resize(len);
+ memcpy (head (bytes), src, len);
+ }
+}
+
+inline BytesPtr
+readRawPtr (const unsigned char *src, size_t len)
+{
+ if (len > 0)
+ {
+ BytesPtr ret (new Bytes (len));
+ memcpy (head (*ret), src, len);
+
+ return ret;
+ }
+ else
+ return BytesPtr ();
+}
// --- Bytes operations end ---