object: Switch code to use ndn-cxx
This commit also moves code to ndn::chronoshare namespace
Change-Id: I63817cce605620c3c68d98ac4e46e1a265dc3d3b
diff --git a/src/object-manager.hpp b/src/object-manager.hpp
index 51a5880..b00c846 100644
--- a/src/object-manager.hpp
+++ b/src/object-manager.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2016, Regents of the University of California.
+ * Copyright (c) 2013-2017, Regents of the University of California.
*
* This file is part of ChronoShare, a decentralized file sharing application over NDN.
*
@@ -18,48 +18,59 @@
* See AUTHORS.md for complete list of ChronoShare authors and contributors.
*/
-#ifndef OBJECT_MANAGER_H
-#define OBJECT_MANAGER_H
+#ifndef CHRONOSHARE_SRC_OBJECT_MANAGER_HPP
+#define CHRONOSHARE_SRC_OBJECT_MANAGER_HPP
+
+#include "core/chronoshare-common.hpp"
#include <boost/filesystem.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <ccnx-wrapper.h>
-#include <hash-helper.h>
-#include <string>
+
+#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/security/key-chain.hpp>
+#include <ndn-cxx/util/digest.hpp>
// everything related to managing object files
+namespace ndn {
+namespace chronoshare {
+
class ObjectManager
{
public:
- ObjectManager(Ccnx::CcnxWrapperPtr ccnx, const boost::filesystem::path& folder,
- const std::string& appName);
- virtual ~ObjectManager();
+ ObjectManager(Face& face, KeyChain& keyChain,
+ const boost::filesystem::path& folder, const std::string& appName);
+
+ virtual
+ ~ObjectManager();
/**
* @brief Creates and saves local file in a local database file
*
* Format: /<appname>/file/<hash>/<devicename>/<segment>
*/
- boost::tuple<HashPtr /*object-db name*/, size_t /* number of segments*/>
- localFileToObjects(const boost::filesystem::path& file, const Ccnx::Name& deviceName);
+ std::tuple<ConstBufferPtr /*object-db name*/, size_t /* number of segments*/>
+ localFileToObjects(const boost::filesystem::path& file, const Name& deviceName);
bool
- objectsToLocalFile(/*in*/ const Ccnx::Name& deviceName, /*in*/ const Hash& hash,
+ objectsToLocalFile(/*in*/ const Name& deviceName, /*in*/ const Buffer& hash,
/*out*/ const boost::filesystem::path& file);
private:
- Ndnx::NdnxWrapperPtr m_ndnx;
+ Face& m_face;
+ KeyChain& m_keyChain;
boost::filesystem::path m_folder;
std::string m_appName;
};
-typedef boost::shared_ptr<ObjectManager> ObjectManagerPtr;
+typedef shared_ptr<ObjectManager> ObjectManagerPtr;
-namespace Error {
+namespace error {
struct ObjectManager : virtual boost::exception, virtual std::exception
{
};
-}
+} // namespace error
-#endif // OBJECT_MANAGER_H
+} // namespace chronoshare
+} // namespace ndn
+
+#endif // CHRONOSHARE_SRC_OBJECT_MANAGER_HPP