Loading [MathJax]/extensions/tex2jax.js
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PLMD::CLTool Class Referenceabstract

This is the abstract base class to use for implementing new command line tool, within it there is information as to how to go about implemneting a new tool. More...

#include <CLTool.h>

Inheritance diagram for PLMD::CLTool:

Public Types

enum  { unset , commandline , ifile }
 How is the input specified on the command line or in an input file. More...
 

Public Member Functions

 CLTool (const CLToolOptions &co)
 
virtual ~CLTool ()
 virtual destructor to allow inheritance
 
virtual std::string description () const
 virtual function returning a one-line descriptor for the tool
 
const std::map< std::string, std::string > & getInputData ()
 
virtual int main (FILE *in, FILE *out, Communicator &pc)=0
 virtual function mapping to the specific main for each tool
 
bool readInput (int argc, char **argv, FILE *in, FILE *out)
 Read the arguments from the command line.
 
void setInputData (const std::map< std::string, std::string > &inputData)
 Set the input data:
 

Static Public Member Functions

static void registerKeywords (Keywords &keys)
 Create the help keywords.
 

Public Attributes

enum PLMD::CLTool:: { ... }  inputdata
 How is the input specified on the command line or in an input file.
 

Protected Member Functions

void error (const std::string &msg)
 Crash the command line tool with an error.
 
template<class T>
bool parse (const std::string &key, T &t)
 Get the value of one of the command line arguments.
 
void parseFlag (const std::string &key, bool &t)
 Find out whether one of the command line flags is present or not.
 
template<class T>
bool parseVector (const std::string &key, std::vector< T > &t)
 

Private Member Functions

bool readCommandLineArgs (int argc, char **argv, FILE *out)
 Read the arguments from the command line.
 
bool readInputFile (int argc, char **argv, FILE *in, FILE *out)
 Read the arguments from an input file specified on the command line.
 
void setRemainingToDefault (FILE *out)
 Set arguments from the default options provided to Keywords.
 

Private Attributes

std::map< std::string, std::string > inputData
 The data read in from the command line stored in a map with the keywords.
 
const Keywordskeywords
 The list of keywords for this CLTool.
 
const std::string name
 The name of this command line tool.
 

Detailed Description

This is the abstract base class to use for implementing new command line tool, within it there is information as to how to go about implemneting a new tool.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

How is the input specified on the command line or in an input file.

Enumerator
unset 
commandline 
ifile 

Constructor & Destructor Documentation

◆ CLTool()

PLMD::CLTool::CLTool ( const CLToolOptions & co)
explicit

◆ ~CLTool()

virtual PLMD::CLTool::~CLTool ( )
inlinevirtual

virtual destructor to allow inheritance

Member Function Documentation

◆ description()

◆ error()

void PLMD::CLTool::error ( const std::string & msg)
protected

Crash the command line tool with an error.

◆ getInputData()

const std::map< std::string, std::string > & PLMD::CLTool::getInputData ( )
inline

◆ main()

◆ parse()

template<class T>
bool PLMD::CLTool::parse ( const std::string & key,
T & t )
protected

Get the value of one of the command line arguments.

◆ parseFlag()

void PLMD::CLTool::parseFlag ( const std::string & key,
bool & t )
protected

Find out whether one of the command line flags is present or not.

◆ parseVector()

template<class T>
bool PLMD::CLTool::parseVector ( const std::string & key,
std::vector< T > & t )
protected

◆ readCommandLineArgs()

bool PLMD::CLTool::readCommandLineArgs ( int argc,
char ** argv,
FILE * out )
private

Read the arguments from the command line.

◆ readInput()

bool PLMD::CLTool::readInput ( int argc,
char ** argv,
FILE * in,
FILE * out )

Read the arguments from the command line.

◆ readInputFile()

bool PLMD::CLTool::readInputFile ( int argc,
char ** argv,
FILE * in,
FILE * out )
private

Read the arguments from an input file specified on the command line.

◆ registerKeywords()

void PLMD::CLTool::registerKeywords ( Keywords & keys)
static

Create the help keywords.

◆ setInputData()

void PLMD::CLTool::setInputData ( const std::map< std::string, std::string > & inputData)
inline

Set the input data:

◆ setRemainingToDefault()

void PLMD::CLTool::setRemainingToDefault ( FILE * out)
private

Set arguments from the default options provided to Keywords.

Member Data Documentation

◆ inputData

std::map<std::string,std::string> PLMD::CLTool::inputData
private

The data read in from the command line stored in a map with the keywords.

◆ []

enum { ... } PLMD::CLTool::inputdata

How is the input specified on the command line or in an input file.

◆ keywords

const Keywords& PLMD::CLTool::keywords
private

The list of keywords for this CLTool.

◆ name

const std::string PLMD::CLTool::name
private

The name of this command line tool.


The documentation for this class was generated from the following files: