All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
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:
Inheritance graph
[legend]

Public Types

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

Public Member Functions

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

Static Public Member Functions

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

Public Attributes

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

Protected Member Functions

template<class T >
bool parse (const std::string &key, T &t)
 Get the value of one of the command line arguments. More...
 
void parseFlag (const std::string &key, bool &t)
 Find out whether one of the command line flags is present or not. More...
 
void error (const std::string &msg)
 Crash the command line tool with an error. More...
 
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. More...
 
bool readInputFile (int argc, char **argv, FILE *in, FILE *out)
 Read the arguments from an input file specified on the command line. More...
 
void setRemainingToDefault (FILE *out)
 Set arguments from the default options provided to Keywords. More...
 

Private Attributes

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

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.

Definition at line 55 of file CLTool.h.

Constructor & Destructor Documentation

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

Definition at line 44 of file CLTool.cpp.

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

virtual destructor to allow inheritance

Definition at line 100 of file CLTool.h.

Member Function Documentation

virtual std::string PLMD::CLTool::description ( ) const
inlinevirtual

virtual function returning a one-line descriptor for the tool

Reimplemented in PLMD::cltools::CLToolSumHills, PLMD::cltools::SimpleMD, PLMD::cltools::Driver< real >, PLMD::cltools::Manual, PLMD::cltools::GenTemplate, PLMD::cltools::Info, and PLMD::cltools::Driver< real >.

Definition at line 98 of file CLTool.h.

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

Crash the command line tool with an error.

Definition at line 206 of file CLTool.cpp.

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

Definition at line 74 of file CLTool.h.

virtual int PLMD::CLTool::main ( FILE *  in,
FILE *  out,
Communicator pc 
)
pure virtual
template<class T >
bool PLMD::CLTool::parse ( const std::string &  key,
T &  t 
)
protected

Get the value of one of the command line arguments.

Definition at line 104 of file CLTool.h.

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

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

Definition at line 51 of file CLTool.cpp.

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

Definition at line 118 of file CLTool.h.

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

Read the arguments from the command line.

Definition at line 70 of file CLTool.cpp.

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

Read the arguments from the command line.

Definition at line 60 of file CLTool.cpp.

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.

Definition at line 146 of file CLTool.cpp.

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

Create the help keywords.

Definition at line 40 of file CLTool.cpp.

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

Set the input data:

Definition at line 71 of file CLTool.h.

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

Set arguments from the default options provided to Keywords.

Definition at line 128 of file CLTool.cpp.

Member Data Documentation

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.

Definition at line 62 of file CLTool.h.

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

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

const Keywords& PLMD::CLTool::keywords
private

The list of keywords for this CLTool.

Definition at line 60 of file CLTool.h.

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

The name of this command line tool.

Definition at line 58 of file CLTool.h.


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