CEBL  2.1
CEBLViewCLI.cpp
Go to the documentation of this file.
1 
9 #include "CEBLViewCLI.hpp"
10 #include <boost/program_options.hpp>
11 //namespaces
12 namespace po = boost::program_options;
13 
14 
15 //----------------------------------------------------------------------
16 // Constructors / Destructors
17 
18 CEBLViewCLI::CEBLViewCLI(CEBLModel *model, int ac, char ** av) : CEBLView(model)
19 {
20  this->ac = ac;
21  this->av = av;
22 
23 }
24 
25 
27 {
28 
29 }
30 
31 
32 //----------------------------------------------------------------------
33 // Start the view
34 
36 {
37 
38  //arguments
39  string session_file = "";
40 
41 
42  try
43  {
44  //create arguments
45  po::options_description cmdline_options("CEBL Options");
46  cmdline_options.add_options()
47  ("help", "Print Help")
48  ("version", "Print Version String")
49  ("session-file,f", po::value<string>(), "Specify Session File")
50  ;
51 
52  // process actual argv
53  po::variables_map vm;
54  po::store(po::command_line_parser(ac, av).
55  options(cmdline_options).run(), vm);
56  po::notify(vm);
57 
58  // go through each option and do something
59  if (vm.count("help"))
60  {
61  cout << cmdline_options << "\n";
62  return;
63  }
64  if (vm.count("version"))
65  {
66  cout << PACKAGE_STRING << endl;
67  return;
68  }
69  if (vm.count("session-file"))
70  {
71  session_file = vm["session-file"].as< string >();
72  cout << "Loading from session file <" << session_file << ">\n";
73  }
74 
75  }
76  catch(exception& e)
77  {
78  cerr << "Error parsing command line arguments: " << e.what() << "\n";
79  return;
80  }
81  catch(...)
82  {
83  cerr << "Error parsing command line arguments.\n";
84  return;
85  }
86 
87 
88  //----------------------------------------------------------------------
89 
90  cout << "* Searching for mindset...\n";
91  if(model->deviceExists())
92  {
93  cout << "Found mindset at " << model->deviceGetLocation() << "\n";
94  }
95  else
96  {
97  cout << model->deviceGetError() << "\n";
98  }
99 
100 
101 
102 
103 }
104 
105 
106