SuPReMo  0.1.1
Loading...
Searching...
No Matches
CommandLineParser.h
1// ====================================================================================================
2//
3// SuPReMo: Surrogate Parameterised Respiratory Motion Model
4// An implementation of the generalised motion modelling and image registration framework
5//
6// Copyright (c) University College London (UCL). All rights reserved.
7//
8// This software is distributed WITHOUT ANY WARRANTY; without even
9// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
10// PURPOSE.
11//
12// See LICENSE.txt in the top level directory for details.
13//
14// ====================================================================================================
15
16
17
18
19#pragma once
20
21#include <map>
22#include <string>
23#include <vector>
24#include "Supremo.h"
25
29 unsigned int numberOfComponents;
30 bool required;
31 std::string description;
32 std::string format;
33};
34
35
42std::vector<std::string> splitStringbyDelimiter(const std::string & stringToSplitIn, const std::string & delimiter);
43
44
68void printFormattedCommandLineOptions(const std::map<std::string, CommandLineOption>& commandLineOptions,
69 const std::string& optionSectionHeading, const unsigned int maxWidth, const std::vector<std::string>& optionsToPrint );
70
71
78public:
79
88 CommandLineParser( int &argc, char **argv, const std::map<std::string, CommandLineOption> & allowedCommandLineOptionsIn );
89
103 const std::string& getCmdOptionAsString( const std::string &option, int skip = 0 ) const;
104
111 const int getCmdOptionAsInt( const std::string &option, int skip = 0 ) const;
112
119 const float getCmdOptionAsFloat( const std::string &option, int skip = 0 ) const;
120
126 bool cmdOptionExists( const std::string &option ) const;
127
132 std::string getCommandLine() const;
133
138
139
140private:
141 std::vector <std::string> tokens;
142 std::string executableName;
144};
145
Definition: CommandLineParser.h:77
std::vector< std::string > tokens
Vector with individual command line entries.
Definition: CommandLineParser.h:141
bool getAllReqreuiredParametersSet() const
Definition: CommandLineParser.h:137
const float getCmdOptionAsFloat(const std::string &option, int skip=0) const
Definition: CommandLineParser.cpp:281
bool cmdOptionExists(const std::string &option) const
Definition: CommandLineParser.cpp:304
const int getCmdOptionAsInt(const std::string &option, int skip=0) const
Definition: CommandLineParser.cpp:258
std::string executableName
The executable name contained on the command line.
Definition: CommandLineParser.h:142
const std::string & getCmdOptionAsString(const std::string &option, int skip=0) const
Definition: CommandLineParser.cpp:219
std::string getCommandLine() const
Definition: CommandLineParser.cpp:316
bool allRequiredParametersSet
Indicates if all required parameters were found. Use the getter funciton getAllReqreuiredParametersSe...
Definition: CommandLineParser.h:143
Definition: CommandLineParser.h:28
std::string description
Detailed description of the parameter. This will be used to generate the help message on the command ...
Definition: CommandLineParser.h:31
unsigned int numberOfComponents
Number of elements expected after this flag on the command line. A switch will be 0,...
Definition: CommandLineParser.h:29
std::string format
String describing the format of the parameter, e.g. <int>, <filename>, etc.
Definition: CommandLineParser.h:32
bool required
Indicating if this parameters is essential to run the program. If a given parameter marked by require...
Definition: CommandLineParser.h:30