src: Small source reorganization
Change-Id: I442f3ad0392ef4220e6435fc48e6d69acbd02076
diff --git a/AUTHORS b/AUTHORS
deleted file mode 100644
index c4c1781..0000000
--- a/AUTHORS
+++ /dev/null
@@ -1,4 +0,0 @@
-Shuo Chen <chenatu2006@gmail.com>
-Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
-Junxiao Shi <http://www.cs.arizona.edu/people/shijunxiao/>
-Hang Zhang <http://netlab.bit.edu.cn/z_hang>
diff --git a/AUTHORS.md b/AUTHORS.md
index 4b9e531..8c6db34 100644
--- a/AUTHORS.md
+++ b/AUTHORS.md
@@ -1,3 +1,4 @@
Shuo Chen <chenatu2006@gmail.com>
Alexander Afanasyev <http://lasr.cs.ucla.edu/afanasyev/index.html>
Junxiao Shi <http://www.cs.arizona.edu/people/shijunxiao/>
+Hang Zhang <http://netlab.bit.edu.cn/z_hang>
diff --git a/ndn-handle/ndn-handle-common.hpp b/src/common.hpp
similarity index 77%
rename from ndn-handle/ndn-handle-common.hpp
rename to src/common.hpp
index 600b4d5..70d959f 100644
--- a/ndn-handle/ndn-handle-common.hpp
+++ b/src/common.hpp
@@ -17,47 +17,56 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_NDN_HANDLE_NDN_HANDLE_COMMON_HPP
-#define REPO_NDN_HANDLE_NDN_HANDLE_COMMON_HPP
+#ifndef REPO_COMMON_HPP
+#define REPO_COMMON_HPP
-
-#include "../storage/storage-handle.hpp"
-#include "../helpers/repo-command-response.hpp"
-#include "../helpers/repo-command-parameter.hpp"
-
-#include <cstdlib>
-#include <sstream>
-#include <iostream>
-#include <time.h>
-#include <unistd.h>
#include <ndn-cxx/face.hpp>
+#include <ndn-cxx/interest.hpp>
+#include <ndn-cxx/name.hpp>
+#include <ndn-cxx/data.hpp>
+#include <ndn-cxx/selectors.hpp>
+#include <ndn-cxx/key-locator.hpp>
#include <ndn-cxx/security/key-chain.hpp>
#include <ndn-cxx/util/command-interest-validator.hpp>
#include <ndn-cxx/util/time.hpp>
#include <ndn-cxx/util/scheduler.hpp>
+
+#include <boost/utility.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int_distribution.hpp>
+
#include <map>
+#include <string>
+#include <vector>
#include <algorithm>
namespace repo {
using ndn::Face;
+using ndn::Block;
using ndn::Name;
using ndn::Interest;
-using ndn::KeyChain;
using ndn::Selectors;
-using ndn::bind;
+using ndn::Exclude;
+using ndn::Data;
+using ndn::KeyLocator;
+using ndn::KeyChain;
using ndn::CommandInterestValidator;
using ndn::Scheduler;
+using ndn::bind;
using ndn::shared_ptr;
using ndn::make_shared;
using ndn::enable_shared_from_this;
+using std::vector;
+using std::string;
+
+using boost::noncopyable;
+
typedef uint64_t ProcessId;
typedef uint64_t SegmentNo;
-}
+} // namespace repo
-#endif // REPO_NDN_HANDLE_NDN_HANDLE_COMMON_HPP
+#endif // REPO_COMMON_HPP
diff --git a/ndn-handle/base-handle.cpp b/src/handles/base-handle.cpp
similarity index 100%
rename from ndn-handle/base-handle.cpp
rename to src/handles/base-handle.cpp
diff --git a/ndn-handle/base-handle.hpp b/src/handles/base-handle.hpp
similarity index 90%
rename from ndn-handle/base-handle.hpp
rename to src/handles/base-handle.hpp
index 7df409b..3223940 100644
--- a/ndn-handle/base-handle.hpp
+++ b/src/handles/base-handle.hpp
@@ -17,10 +17,14 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_NDN_HANDLE_BASE_HANDLE_HPP
-#define REPO_NDN_HANDLE_BASE_HANDLE_HPP
+#ifndef REPO_HANDLES_BASE_HANDLE_HPP
+#define REPO_HANDLES_BASE_HANDLE_HPP
-#include "ndn-handle-common.hpp"
+#include "common.hpp"
+
+#include "storage/storage-handle.hpp"
+#include "repo-command-response.hpp"
+#include "repo-command-parameter.hpp"
namespace repo {
@@ -111,6 +115,6 @@
parameter.wireDecode(interest.getName().get(prefix.size()).blockFromValue());
}
-} //namespace repo
+} // namespace repo
-#endif // REPO_NDN_HANDLE_BASE_HANDLE_HPP
+#endif // REPO_HANDLES_BASE_HANDLE_HPP
diff --git a/ndn-handle/delete-handle.cpp b/src/handles/delete-handle.cpp
similarity index 100%
rename from ndn-handle/delete-handle.cpp
rename to src/handles/delete-handle.cpp
diff --git a/ndn-handle/delete-handle.hpp b/src/handles/delete-handle.hpp
similarity index 93%
rename from ndn-handle/delete-handle.hpp
rename to src/handles/delete-handle.hpp
index 9e64b3d..680e8dc 100644
--- a/ndn-handle/delete-handle.hpp
+++ b/src/handles/delete-handle.hpp
@@ -17,10 +17,9 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_NDN_HANDLE_DELETE_HANDLE_HPP
-#define REPO_NDN_HANDLE_DELETE_HANDLE_HPP
+#ifndef REPO_HANDLES_DELETE_HANDLE_HPP
+#define REPO_HANDLES_DELETE_HANDLE_HPP
-#include "ndn-handle-common.hpp"
#include "base-handle.hpp"
namespace repo {
@@ -91,6 +90,6 @@
};
-} //namespace repo
+} // namespace repo
-#endif // REPO_NDN_HANDLE_DELETE_HANDLE_HPP
+#endif // REPO_HANDLES_DELETE_HANDLE_HPP
diff --git a/ndn-handle/read-handle.cpp b/src/handles/read-handle.cpp
similarity index 100%
rename from ndn-handle/read-handle.cpp
rename to src/handles/read-handle.cpp
diff --git a/ndn-handle/read-handle.hpp b/src/handles/read-handle.hpp
similarity index 90%
rename from ndn-handle/read-handle.hpp
rename to src/handles/read-handle.hpp
index 2e13b43..93468c0 100644
--- a/ndn-handle/read-handle.hpp
+++ b/src/handles/read-handle.hpp
@@ -17,8 +17,8 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_NDN_HANDLE_READ_HANDLE_HPP
-#define REPO_NDN_HANDLE_READ_HANDLE_HPP
+#ifndef REPO_HANDLES_READ_HANDLE_HPP
+#define REPO_HANDLES_READ_HANDLE_HPP
#include "base-handle.hpp"
@@ -47,6 +47,6 @@
onRegisterFailed(const Name& prefix, const std::string& reason);
};
-} //namespace repo
+} // namespace repo
-#endif // REPO_NDN_HANDLE_READ_HANDLE_HPP
+#endif // REPO_HANDLES_READ_HANDLE_HPP
diff --git a/ndn-handle/tcp-bulk-insert-handle.cpp b/src/handles/tcp-bulk-insert-handle.cpp
similarity index 100%
rename from ndn-handle/tcp-bulk-insert-handle.cpp
rename to src/handles/tcp-bulk-insert-handle.cpp
diff --git a/ndn-handle/tcp-bulk-insert-handle.hpp b/src/handles/tcp-bulk-insert-handle.hpp
similarity index 89%
rename from ndn-handle/tcp-bulk-insert-handle.hpp
rename to src/handles/tcp-bulk-insert-handle.hpp
index fa020ef..17233f4 100644
--- a/ndn-handle/tcp-bulk-insert-handle.hpp
+++ b/src/handles/tcp-bulk-insert-handle.hpp
@@ -17,10 +17,12 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_NDN_HANDLE_WRITE_TCP_BACKDOOR_HPP
-#define REPO_NDN_HANDLE_WRITE_TCP_BACKDOOR_HPP
+#ifndef REPO_HANDLES_TCP_BULK_INSERT_HANDLE_HPP
+#define REPO_HANDLES_TCP_BULK_INSERT_HANDLE_HPP
-#include "ndn-handle-common.hpp"
+#include "common.hpp"
+#include "storage/storage-handle.hpp"
+
#include <boost/asio.hpp>
namespace repo {
@@ -67,4 +69,4 @@
} // namespace repo
-#endif // REPO_NDN_HANDLE_WRITE_TCP_BACKDOOR_HPP
+#endif // REPO_HANDLES_TCP_BULK_INSERT_HANDLE_HPP
diff --git a/ndn-handle/write-handle.cpp b/src/handles/write-handle.cpp
similarity index 100%
rename from ndn-handle/write-handle.cpp
rename to src/handles/write-handle.cpp
diff --git a/ndn-handle/write-handle.hpp b/src/handles/write-handle.hpp
similarity index 97%
rename from ndn-handle/write-handle.hpp
rename to src/handles/write-handle.hpp
index f2c8f0e..075e78c 100644
--- a/ndn-handle/write-handle.hpp
+++ b/src/handles/write-handle.hpp
@@ -17,11 +17,11 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_NDN_HANDLE_WRITE_HANDLE_HPP
-#define REPO_NDN_HANDLE_WRITE_HANDLE_HPP
+#ifndef REPO_HANDLES_WRITE_HANDLE_HPP
+#define REPO_HANDLES_WRITE_HANDLE_HPP
-#include "ndn-handle-common.hpp"
#include "base-handle.hpp"
+
#include <queue>
namespace repo {
@@ -222,4 +222,4 @@
} // namespace repo
-#endif // REPO_NDN_HANDLE_WRITE_HANDLE_HPP
+#endif // REPO_HANDLES_WRITE_HANDLE_HPP
diff --git a/server/server.cpp b/src/main.cpp
similarity index 100%
rename from server/server.cpp
rename to src/main.cpp
diff --git a/helpers/repo-command-parameter.hpp b/src/repo-command-parameter.hpp
similarity index 97%
rename from helpers/repo-command-parameter.hpp
rename to src/repo-command-parameter.hpp
index 3cdd0fa..8a8c4bb 100644
--- a/helpers/repo-command-parameter.hpp
+++ b/src/repo-command-parameter.hpp
@@ -17,8 +17,8 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_HELPERS_REPO_COMMAND_PARAMETER_HPP
-#define REPO_HELPERS_REPO_COMMAND_PARAMETER_HPP
+#ifndef REPO_REPO_COMMAND_PARAMETER_HPP
+#define REPO_REPO_COMMAND_PARAMETER_HPP
#include <ndn-cxx/encoding/encoding-buffer.hpp>
#include <ndn-cxx/name.hpp>
@@ -339,6 +339,6 @@
return os;
}
-} //namespace repo
+} // namespace repo
-#endif
+#endif // REPO_REPO_COMMAND_PARAMETER_HPP
diff --git a/helpers/repo-command-response.hpp b/src/repo-command-response.hpp
similarity index 97%
rename from helpers/repo-command-response.hpp
rename to src/repo-command-response.hpp
index 32fc2b6..0eb4f1d 100644
--- a/helpers/repo-command-response.hpp
+++ b/src/repo-command-response.hpp
@@ -17,8 +17,8 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_HELPERS_REPO_COMMAND_RESPONSE_HPP
-#define REPO_HELPERS_REPO_COMMAND_RESPONSE_HPP
+#ifndef REPO_REPO_COMMAND_RESPONSE_HPP
+#define REPO_REPO_COMMAND_RESPONSE_HPP
#include <ndn-cxx/encoding/block.hpp>
#include <ndn-cxx/encoding/encoding-buffer.hpp>
@@ -391,5 +391,7 @@
os << " )";
return os;
}
-} //namespace repo
-#endif
+
+} // namespace repo
+
+#endif // REPO_REPO_COMMAND_RESPONSE_HPP
diff --git a/helpers/repo-tlv.hpp b/src/repo-tlv.hpp
similarity index 92%
rename from helpers/repo-tlv.hpp
rename to src/repo-tlv.hpp
index 3c08a45..7d917e1 100644
--- a/helpers/repo-tlv.hpp
+++ b/src/repo-tlv.hpp
@@ -17,8 +17,8 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_HELPERS_REPO_TLV_HPP
-#define REPO_HELPERS_REPO_TLV_HPP
+#ifndef REPO_REPO_TLV_HPP
+#define REPO_REPO_TLV_HPP
#include <ndn-cxx/encoding/tlv.hpp>
@@ -41,4 +41,4 @@
} // tlv
} // repo
-#endif // REPO_HELPERS_REPO_TLV_HPP
+#endif // REPO_REPO_TLV_HPP
diff --git a/server/repo.cpp b/src/repo.cpp
similarity index 100%
rename from server/repo.cpp
rename to src/repo.cpp
diff --git a/server/repo.hpp b/src/repo.hpp
similarity index 84%
rename from server/repo.hpp
rename to src/repo.hpp
index 9338ef7..a92eb7d 100644
--- a/server/repo.hpp
+++ b/src/repo.hpp
@@ -17,22 +17,20 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_SERVER_REPO_HPP
-#define REPO_SERVER_REPO_HPP
+#ifndef REPO_REPO_HPP
+#define REPO_REPO_HPP
-#include "../storage/storage-handle.hpp"
-#include "../storage/sqlite/sqlite-handle.hpp"
-#include "../ndn-handle/read-handle.hpp"
-#include "../ndn-handle/write-handle.hpp"
-#include "../ndn-handle/delete-handle.hpp"
-#include "../ndn-handle/tcp-bulk-insert-handle.hpp"
+#include "storage/storage-handle.hpp"
+#include "storage/sqlite-handle.hpp"
-#include <string>
-#include <iostream>
-#include <fstream>
-#include <vector>
+#include "handles/read-handle.hpp"
+#include "handles/write-handle.hpp"
+#include "handles/delete-handle.hpp"
+#include "handles/tcp-bulk-insert-handle.hpp"
+
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/util/command-interest-validator.hpp>
+
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/info_parser.hpp>
@@ -96,4 +94,4 @@
} // namespace repo
-#endif // REPO_SERVER_REPO_HPP
+#endif // REPO_REPO_HPP
diff --git a/storage/sqlite/sqlite-handle.cpp b/src/storage/sqlite-handle.cpp
similarity index 100%
rename from storage/sqlite/sqlite-handle.cpp
rename to src/storage/sqlite-handle.cpp
diff --git a/storage/sqlite/sqlite-handle.hpp b/src/storage/sqlite-handle.hpp
similarity index 95%
rename from storage/sqlite/sqlite-handle.hpp
rename to src/storage/sqlite-handle.hpp
index 19c5db0..a0fbb1c 100644
--- a/storage/sqlite/sqlite-handle.hpp
+++ b/src/storage/sqlite-handle.hpp
@@ -17,10 +17,10 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef REPO_STORAGE_SQLITE_SQLITE_HANDLE_HPP
-#define REPO_STORAGE_SQLITE_SQLITE_HANDLE_HPP
+#ifndef REPO_STORAGE_SQLITE_HANDLE_HPP
+#define REPO_STORAGE_SQLITE_HANDLE_HPP
-#include "../storage-handle.hpp"
+#include "storage-handle.hpp"
#include <string>
#include <iostream>
@@ -141,4 +141,4 @@
} // namespace repo
-#endif
+#endif // REPO_STORAGE_SQLITE_HANDLE_HPP
diff --git a/storage/storage-handle.hpp b/src/storage/storage-handle.hpp
similarity index 88%
rename from storage/storage-handle.hpp
rename to src/storage/storage-handle.hpp
index 281e4b4..b75de2c 100644
--- a/storage/storage-handle.hpp
+++ b/src/storage/storage-handle.hpp
@@ -20,31 +20,11 @@
#ifndef REPO_STORAGE_STORAGE_HANDLE_HPP
#define REPO_STORAGE_STORAGE_HANDLE_HPP
-#include <string>
-#include <stdexcept>
-
-#include <ndn-cxx/interest.hpp>
-#include <ndn-cxx/name.hpp>
-#include <ndn-cxx/data.hpp>
-#include <ndn-cxx/selectors.hpp>
-#include <ndn-cxx/key-locator.hpp>
-
+#include "common.hpp"
#include "storage-method.hpp"
namespace repo {
-using ndn::Interest;
-using ndn::Name;
-using ndn::Data;
-using ndn::Selectors;
-using ndn::KeyLocator;
-using ndn::Block;
-using ndn::Exclude;
-
-using std::vector;
-using std::string;
-using boost::noncopyable;
-
/**
* @brief this class defines handles to read, insert and delete data packets in storage media
*/
diff --git a/storage/storage-method.hpp b/src/storage/storage-method.hpp
similarity index 91%
rename from storage/storage-method.hpp
rename to src/storage/storage-method.hpp
index 96ebdd5..219be7e 100644
--- a/storage/storage-method.hpp
+++ b/src/storage/storage-method.hpp
@@ -23,9 +23,9 @@
namespace repo {
enum StorageMethod {
- STORAGE_METHOD_SQLITE = 1
+ STORAGE_METHOD_SQLITE = 1
};
-} //namespace repo
+} // namespace repo
-#endif
+#endif // REPO_STORAGE_STORAGE_METHOD_HPP
diff --git a/tests/repo-command-parameter.cpp b/tests/repo-command-parameter.cpp
index 89ceaf0..ac74d51 100644
--- a/tests/repo-command-parameter.cpp
+++ b/tests/repo-command-parameter.cpp
@@ -17,7 +17,7 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../helpers/repo-command-parameter.hpp"
+#include "repo-command-parameter.hpp"
#include <ndn-cxx/selectors.hpp>
#include <boost/test/unit_test.hpp>
diff --git a/tests/repo-command-response.cpp b/tests/repo-command-response.cpp
index 560a76d..6192473 100644
--- a/tests/repo-command-response.cpp
+++ b/tests/repo-command-response.cpp
@@ -17,7 +17,7 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../helpers/repo-command-response.hpp"
+#include "repo-command-response.hpp"
#include <boost/test/unit_test.hpp>
diff --git a/tests/sqlite-fixture.hpp b/tests/sqlite-fixture.hpp
index 13a8eed..141fdc5 100644
--- a/tests/sqlite-fixture.hpp
+++ b/tests/sqlite-fixture.hpp
@@ -20,7 +20,7 @@
#ifndef REPO_TESTS_SQLITE_FIXTURE_HPP
#define REPO_TESTS_SQLITE_FIXTURE_HPP
-#include "../storage/sqlite/sqlite-handle.hpp"
+#include "storage/sqlite-handle.hpp"
#include <boost/filesystem.hpp>
#include <boost/test/unit_test.hpp>
diff --git a/tests/sqlite-handle.cpp b/tests/sqlite-handle.cpp
index 88b3ce9..76192c2 100644
--- a/tests/sqlite-handle.cpp
+++ b/tests/sqlite-handle.cpp
@@ -17,7 +17,7 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../storage/sqlite/sqlite-handle.hpp"
+#include "storage/sqlite-handle.hpp"
#include "sqlite-fixture.hpp"
#include "dataset-fixtures.hpp"
diff --git a/tests/tcp-bulk-insert-handle.cpp b/tests/tcp-bulk-insert-handle.cpp
index 7910dcf..1eca27c 100644
--- a/tests/tcp-bulk-insert-handle.cpp
+++ b/tests/tcp-bulk-insert-handle.cpp
@@ -17,7 +17,7 @@
* repo-ng, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "../ndn-handle/tcp-bulk-insert-handle.hpp"
+#include "handles/tcp-bulk-insert-handle.hpp"
#include "sqlite-fixture.hpp"
#include "dataset-fixtures.hpp"
diff --git a/tools/ndnputfile.cpp b/tools/ndnputfile.cpp
index b094d03..1c56934 100644
--- a/tools/ndnputfile.cpp
+++ b/tools/ndnputfile.cpp
@@ -17,8 +17,8 @@
* repo-ng, e.g., in COPYING.md file. if (not, see <http://www.gnu.org/licenses/>.
*/
-#include "helpers/repo-command-parameter.hpp"
-#include "helpers/repo-command-response.hpp"
+#include "../src/repo-command-parameter.hpp"
+#include "../src/repo-command-response.hpp"
#include <ndn-cxx/face.hpp>
#include <ndn-cxx/security/key-chain.hpp>
diff --git a/tools/wscript b/tools/wscript
index 4fb6050..41f1ea8 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -8,5 +8,4 @@
target='%s' % (str(app.change_ext('', '.cpp'))),
source=app,
use='NDN_CXX',
- includes='..',
)
diff --git a/wscript b/wscript
index 7c3300b..0f77911 100644
--- a/wscript
+++ b/wscript
@@ -29,7 +29,7 @@
conf.env['WITH_TOOLS'] = conf.options.with_tools
- USED_BOOST_LIBS = ['system', 'iostreams', 'filesystem', 'thread']
+ USED_BOOST_LIBS = ['system', 'iostreams', 'filesystem']
if conf.env['WITH_TESTS']:
USED_BOOST_LIBS += ['unit_test_framework']
conf.check_boost(lib=USED_BOOST_LIBS, mandatory=True)
@@ -44,26 +44,23 @@
if not conf.options.with_sqlite_locking:
conf.define('DISABLE_SQLITE3_FS_LOCKING', 1)
- conf.write_config_header('config.hpp')
+ conf.write_config_header('src/config.hpp')
def build(bld):
bld(target="ndn-repo-objects",
name="ndn-repo-objects",
features=["cxx"],
- source=bld.path.ant_glob(['ndn-handle/*.cpp',
- 'storage/**/*.cpp',
- 'helpers/*.cpp',
- 'server/*.cpp'],
- excl=['server/server.cpp']),
+ source=bld.path.ant_glob(['src/**/*.cpp'],
+ excl=['src/main.cpp']),
use='NDN_CXX BOOST SQLITE3',
- includes=".",
+ includes="src",
+ export_includes="src",
)
bld(target="ndn-repo-ng",
features=["cxx", "cxxprogram"],
- source=bld.path.ant_glob(['server/server.cpp']),
+ source=bld.path.ant_glob(['src/main.cpp']),
use='ndn-repo-objects',
- includes=".",
)
# Unit tests