OpenASIP  2.0
MachInfoCmdLineOptions.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2014 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file MachInfoCmdLineOptions.cc
26  *
27  * @author Pekka Jääskeläinen 2014
28  */
29 
30 #include <iostream>
32 #include "tce_config.h"
33 
34 using std::string;
35 using std::cout;
36 using std::endl;
37 
38 // Defines to avoid issues with global object (string) initialization order.
39 #define OUTPUTFN_PARAM_NAME "output-suffix"
40 #define OUTPUT_FORMAT_PARAM_NAME "output-format"
41 
43  CmdLineOptions("") {
44 
45  addOption(
48  "The suffix of the filenames of the produced documentation files.",
49  "s"));
50  addOption(
53  "The format of the produced documentation (only 'latex' supported "
54  "for now).", "f"));
55 
56 }
57 
58 
60 }
61 
64  if (!findOption(OUTPUTFN_PARAM_NAME)->isDefined()) {
65  if (numberOfArguments() == 1) return argument(1);
66  }
68 }
69 
72  if (!findOption(OUTPUT_FORMAT_PARAM_NAME)->isDefined())
73  return "latex";
75 }
76 
77 
78 /**
79  * Prints the version of the application.
80  */
81 void
83  std::cout << "machinfo - processor design documentation generator "
84  << Application::TCEVersionString() << std::endl;
85 }
86 
87 
88 void
90  printVersion();
91  cout << "Usage: machinfo [options] ADF" << endl;
93 }
MachInfoCmdLineOptions::printHelp
virtual void printHelp() const
Definition: MachInfoCmdLineOptions.cc:89
CmdLineParser::numberOfArguments
virtual int numberOfArguments() const
MachInfoCmdLineOptions::printVersion
virtual void printVersion() const
Definition: MachInfoCmdLineOptions.cc:82
CmdLineParser::addOption
void addOption(CmdLineOptionParser *opt)
MachInfoCmdLineOptions::outputFileNameSuffix
TCEString outputFileNameSuffix() const
Definition: MachInfoCmdLineOptions.cc:63
CmdLineOptions
Definition: CmdLineOptions.hh:54
CmdLineOptions::printHelp
virtual void printHelp() const
Definition: CmdLineOptions.cc:262
MachInfoCmdLineOptions::outputFormat
TCEString outputFormat() const
Definition: MachInfoCmdLineOptions.cc:71
CmdLineOptionParser::String
virtual std::string String(int index=0) const
Definition: CmdLineOptionParser.cc:102
MachInfoCmdLineOptions.hh
TCEString
Definition: TCEString.hh:53
MachInfoCmdLineOptions::MachInfoCmdLineOptions
MachInfoCmdLineOptions()
Definition: MachInfoCmdLineOptions.cc:42
OUTPUT_FORMAT_PARAM_NAME
#define OUTPUT_FORMAT_PARAM_NAME
Definition: MachInfoCmdLineOptions.cc:40
CmdLineParser::findOption
CmdLineOptionParser * findOption(std::string name) const
Definition: CmdLineParser.cc:160
CmdLineParser::argument
virtual std::string argument(int index) const
Application::TCEVersionString
static std::string TCEVersionString()
Definition: Application.cc:510
StringCmdLineOptionParser
Definition: CmdLineOptionParser.hh:180
OUTPUTFN_PARAM_NAME
#define OUTPUTFN_PARAM_NAME
Definition: MachInfoCmdLineOptions.cc:39
MachInfoCmdLineOptions::~MachInfoCmdLineOptions
virtual ~MachInfoCmdLineOptions()
Definition: MachInfoCmdLineOptions.cc:59