Repo Merge: Moving resource API down a directory
[platform/upstream/iotivity.git] / resource / examples / ocicuc / small_example.cpp
1 /* Example program illustrating how to work with the ocicuc driver program: */
2
3 #include "exec.hpp"
4
5 #include <iostream>
6
7 namespace Intel { namespace OCDemo {
8
9 /* exec() is essentially main(), and is where the driver will start your
10 program after command-line options have been parsed: */
11 int exec(const boost::program_options::variables_map& vm)
12 {
13  using std::cout;
14
15  cout << "This is the start of my wonderful program!\n";
16
17  cout << "My command-line options are:\n";
18
19  for(const auto& o : vm)
20   cout << o.first << " => " << o.second.as<std::string>() << '\n';
21
22  return 0;
23 }
24
25 /* make_description() is your opportunity to describe your program's help screen and command
26 line parameter types. Refer to the boost::program_options library for details on how to
27 add different kinds of command-line options: */
28 auto make_description()
29     -> boost::program_options::options_description
30 {
31  namespace po = boost::program_options;     // because boost::program_options is a lot to type!
32
33  po::options_description desc("My wonderful program's options! Run with \"--\" to simply use the defaults.");
34
35  desc.add_options()
36     ("param",   po::value<std::string>()->default_value("Hello, World!"),   "description of param")
37     ;
38
39  return desc;
40 }
41
42 }} // namespace Intel::OCDemo
43
44