Skip to content

Commit

Permalink
add a file
Browse files Browse the repository at this point in the history
  • Loading branch information
Huiming Lv committed Apr 3, 2015
1 parent 873d134 commit 5592b98
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions headers/options_utils_convert.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**************************************************************************************************
* Authors:
* Zhiyuan Shao, Jian He, Huiming Lv
*
* Declaration:
* Program parameter parsing.
*
* Notes:
* 1.modify bfs::bfs_root to bfs::bfs-root by Huiming Lv 2014/12/21
*************************************************************************************************/

#ifndef __OPTIONS_UTILS_CONVERT_H__
#define __OPTIONS_UTILS_CONVERT_H__

#include <boost/program_options.hpp>
#include <iostream>

boost::program_options::options_description desc;
boost::program_options::variables_map vm;

static void setup_options_convert(int argc, const char* argv[])
{
desc.add_options()
( "help,h", "Display help message")
( "type,t", boost::program_options::value<std::string>()->required(), "Type of the snap file(edgelist or adjlist)")
( "graph,g", boost::program_options::value<std::string>()->required(), "Name of the graph in snap format")
( "destination,d", boost::program_options::value<std::string>()->required(), "Destination folder that will contain the index and edge file")
("out-type,o", boost::program_options::value<std::string>()->required(), "Type of out edge file, type1(with edge value) or type2(no edge value)")
("in-edge,i", boost::program_options::value<bool>()->default_value(false),"With or without in-edge, backtrace-algorithm(WCC, SCC) must be true!");
try {
boost::program_options::store(boost::program_options::parse_command_line(argc,
argv,
desc),
vm);
boost::program_options::notify(vm);
}
catch (boost::program_options::error &e) {
if(vm.count("help") || argc ==1) {
std::cerr << desc << "\n";
}
std::cerr << "Error:" << e.what() << std::endl;
std::cerr << "Try: " << argv[0] << " --help" << std::endl;
exit(-1);
}
}


#endif

0 comments on commit 5592b98

Please sign in to comment.