Revision: | 1.1 |
Committed: | Tue Mar 10 23:04:10 2009 UTC (16 years, 1 month ago) by kukartse |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | V00-03-01, ZMorph_BASE_20100408, gak040610_morphing, V00-02-02, gak011410, gak010310, ejterm2010_25nov2009, V00-02-01, V00-02-00, gak112409, CMSSW_22X_branch_base, segala101609, V00-01-15, V00-01-14, V00-01-13, V00-01-12, V00-01-11, V00-01-10, gak031009, HEAD |
Branch point for: | ZMorph-V00-03-01, CMSSW_22X_branch |
Error occurred while calculating annotation data. | |
Log Message: | test/ljmet.cc builds a binary that can take command line parameters |
# | Content |
---|---|
1 | #include <iostream> |
2 | #include <boost/program_options.hpp> |
3 | |
4 | namespace po = boost::program_options; |
5 | using namespace std; |
6 | |
7 | int main( int argc, char ** argv ) |
8 | { |
9 | po::options_description general("General options"); |
10 | general.add_options() |
11 | ("help", "produce help message") |
12 | ("test", po::value<string>(), "print test string") |
13 | ; |
14 | |
15 | po::variables_map vm; |
16 | po::store(po::parse_command_line(argc, argv, general), vm); |
17 | po::notify(vm); |
18 | |
19 | if (vm.count("help")) { |
20 | cout << general << "\n"; |
21 | return 1; |
22 | } |
23 | |
24 | if (vm.count("test")) { |
25 | cout << "Test: " |
26 | << vm["test"].as<string>() << ".\n"; |
27 | } |
28 | |
29 | else { |
30 | cout << "Test: Welcome to the desert of the real!\n"; |
31 | } |
32 | |
33 | return 0; |
34 | } |