From 20587ac550cfcb2d7b3d6ec16e46ba1a8d0af869 Mon Sep 17 00:00:00 2001 From: Joe Zhao Date: Wed, 13 May 2015 13:35:03 +0800 Subject: added split --- split.cpp | 76 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 split.cpp (limited to 'split.cpp') diff --git a/split.cpp b/split.cpp new file mode 100644 index 0000000..be80545 --- /dev/null +++ b/split.cpp @@ -0,0 +1,76 @@ +// +// Created by joe on 5/13/15. +// + +#include +#include +#include "tools/dataProvider.h" +#include "tools/fileDataProvider.h" +#include +#include + +INITIALIZE_EASYLOGGINGPP + +using namespace std; +namespace po = boost::program_options; + +po::variables_map vm; + +int outputRid(vector a,int fsize,string fname) +{ + ofstream fout(fname.c_str()); + fout<qid; + for (int j=0;jfeature(j); + fout<(), "take number") + ("take,a", po::value(), "set output rid file 1(taken)") + ("left,b", po::value(), "set output rid file 2(left)") + ("input,i", po::value(), "set input Rid file"); + + po::store(po::parse_command_line(argc, argv, desc), vm); + po::notify(vm); + // Print help if necessary + if (vm.count("help")) { + cout << desc; + return 0; + } + + if (vm.count("query")){ + RidFileDP dp(vm["input"].as().c_str()); + dp.open(); + cout<().c_str()); + vector a; + vector b; + dp.open(); + dp.take(vm["count"].as(),a,b); + outputRid(a,dp.getfSize(),vm["take"].as()); + outputRid(b,dp.getfSize(),vm["left"].as()); + dp.close(); + return 0; +} \ No newline at end of file -- cgit v1.2.3-70-g09d2