blob: 1b431c04368c9d736fed6abb7c152189502a8e00 [file] [log] [blame]
Colm Donelan366023f2019-09-05 10:03:56 +01001//
2// Copyright © 2019 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "CommandLineProcessor.hpp"
7
8#include <boost/program_options.hpp>
9
10#include <iostream>
11
12namespace armnn
13{
14namespace gatordmock
15{
16
17bool CommandLineProcessor::ProcessCommandLine(int argc, char *argv[])
18{
19 namespace po = boost::program_options;
20
21 po::options_description desc("Options");
22 try
23 {
Colm Donelana85e2152019-09-09 11:59:08 +010024 desc.add_options()
25 ("help,h", "Display help messages")
26 ("namespace,n", po::value<std::string>(&m_UdsNamespace)->default_value("gatord_namespace"),
27 "The Unix domain socket namespace this server will bind to.\n"
28 "This will always be prepended with \\0 to use the abstract namespace");
Colm Donelan366023f2019-09-05 10:03:56 +010029 }
30 catch (const std::exception& e)
31 {
32 std::cerr << "Fatal internal error: [" << e.what() << "]" << std::endl;
33 return false;
34 }
35
36 po::variables_map vm;
37 try
38 {
39 po::store(po::parse_command_line(argc, argv, desc), vm);
40
Colm Donelana85e2152019-09-09 11:59:08 +010041 if (vm.count("help"))
Colm Donelan366023f2019-09-05 10:03:56 +010042 {
43 std::cout << "Simulate a Gatord server to interact with ArmNN external profiling." << std::endl;
44 std::cout << std::endl;
45 std::cout << desc << std::endl;
46 return false;
47 }
48
49 po::notify(vm);
50 }
51 catch (const po::error& e)
52 {
53 std::cerr << e.what() << std::endl << std::endl;
54 std::cerr << desc << std::endl;
55 return false;
56 }
57
58 return true;
59}
60
61} // namespace gatordmock
62
63} // namespace armnn