QMCPACK
ParamClass Class Reference
+ Collaboration diagram for ParamClass:

Public Member Functions

std::string GetName ()
 
std::string GetArg ()
 
std::string GetArg (int arg)
 
void SetArg (std::string arg)
 
 ParamClass (std::string name, int numArgs)
 
 ParamClass (std::string name, bool needsArg)
 
 ParamClass ()
 

Private Attributes

std::string Name
 
std::vector< std::string > Args
 
bool Found
 
int NumArgsNeeded
 

Friends

class CommandLineParserClass
 

Detailed Description

Definition at line 27 of file ParseCommand.h.

Constructor & Destructor Documentation

◆ ParamClass() [1/3]

ParamClass ( std::string  name,
int  numArgs 
)
inline

Definition at line 59 of file ParseCommand.h.

References Found, Name, and NumArgsNeeded.

60  {
61  Name = name;
62  NumArgsNeeded = numArgs;
63  Found = false;
64  }
std::string Name
Definition: ParseCommand.h:30
int NumArgsNeeded
Definition: ParseCommand.h:33

◆ ParamClass() [2/3]

ParamClass ( std::string  name,
bool  needsArg 
)
inline

Definition at line 66 of file ParseCommand.h.

References Found, Name, and NumArgsNeeded.

67  {
68  Name = name;
69  NumArgsNeeded = needsArg ? 1 : 0;
70  Found = false;
71  }
std::string Name
Definition: ParseCommand.h:30
int NumArgsNeeded
Definition: ParseCommand.h:33

◆ ParamClass() [3/3]

ParamClass ( )
inline

Definition at line 73 of file ParseCommand.h.

References Found, and NumArgsNeeded.

74  {
75  NumArgsNeeded = 0;
76  Found = false;
77  }
int NumArgsNeeded
Definition: ParseCommand.h:33

Member Function Documentation

◆ GetArg() [1/2]

std::string GetArg ( )
inline

Definition at line 42 of file ParseCommand.h.

References Args, and NumArgsNeeded.

43  {
44  assert(NumArgsNeeded == 1);
45  return Args[0];
46  }
std::vector< std::string > Args
Definition: ParseCommand.h:31
int NumArgsNeeded
Definition: ParseCommand.h:33

◆ GetArg() [2/2]

std::string GetArg ( int  arg)
inline

Definition at line 48 of file ParseCommand.h.

References Args.

48 { return Args[arg]; }
std::vector< std::string > Args
Definition: ParseCommand.h:31

◆ GetName()

std::string GetName ( )
inline

Definition at line 40 of file ParseCommand.h.

References Name.

40 { return Name; }
std::string Name
Definition: ParseCommand.h:30

◆ SetArg()

void SetArg ( std::string  arg)
inline

Definition at line 50 of file ParseCommand.h.

References Args, and NumArgsNeeded.

51  {
52  assert(Args.size() < NumArgsNeeded);
53  Args.push_back(arg);
54  }
std::vector< std::string > Args
Definition: ParseCommand.h:31
int NumArgsNeeded
Definition: ParseCommand.h:33

Friends And Related Function Documentation

◆ CommandLineParserClass

friend class CommandLineParserClass
friend

Definition at line 34 of file ParseCommand.h.

Member Data Documentation

◆ Args

std::vector<std::string> Args
private

Definition at line 31 of file ParseCommand.h.

Referenced by GetArg(), and SetArg().

◆ Found

bool Found
private

Definition at line 32 of file ParseCommand.h.

Referenced by ParamClass().

◆ Name

std::string Name
private

Definition at line 30 of file ParseCommand.h.

Referenced by GetName(), and ParamClass().

◆ NumArgsNeeded

int NumArgsNeeded
private

Definition at line 33 of file ParseCommand.h.

Referenced by GetArg(), ParamClass(), and SetArg().


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