Jpp  15.0.1-rc.2-highQE
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Friends | List of all members
JEEP::JArgs Class Reference

Data structure to store command line arguments. More...

#include <JArgs.hh>

Inheritance diagram for JEEP::JArgs:
std::vector< std::string >

Public Member Functions

 JArgs ()
 Default constructor. More...
 
 JArgs (const int argc, const char *const argv[])
 Constructor. More...
 
 JArgs (const std::string &PID, JArgs::const_iterator __begin, JArgs::const_iterator __end)
 Constructor. More...
 
 JArgs (const std::string &buffer)
 Constructor. More...
 
std::string str (const char ws= ' ') const
 Convert to string consisting of sequence of tokens separated by given white space character. More...
 
const char * c_str (const char ws= ' ') const
 Convert to character array consisting of sequence of tokens separated by given white space character. More...
 

Public Attributes

std::string PID
 

Friends

std::istream & operator>> (std::istream &in, JArgs &args)
 Stream input. More...
 
std::ostream & operator<< (std::ostream &out, const JArgs &args)
 Stream output. More...
 

Detailed Description

Data structure to store command line arguments.

Definition at line 24 of file JArgs.hh.

Constructor & Destructor Documentation

JEEP::JArgs::JArgs ( )
inline

Default constructor.

Definition at line 31 of file JArgs.hh.

32  {}
JEEP::JArgs::JArgs ( const int  argc,
const char *const  argv[] 
)
inline

Constructor.


The first argument (if any) is assumed to be the process name (PID).

Parameters
argcnumber of command line arguments
argvarray of command line arguments

Definition at line 42 of file JArgs.hh.

43  {
44  if (argc > 0) {
45 
46  PID = argv[0];
47 
48  for (int i = 1; i != argc; ++i) {
49  push_back(argv[i]);
50  }
51 
52  } else {
53 
54  PID = "";
55  }
56  }
std::string PID
Definition: JArgs.hh:167
JEEP::JArgs::JArgs ( const std::string &  PID,
JArgs::const_iterator  __begin,
JArgs::const_iterator  __end 
)
inline

Constructor.


Parameters
PIDprocess identifier
__beginbegin of command line arguments
__endend of command line arguments

Definition at line 66 of file JArgs.hh.

67  {
68  this->PID = PID;
69 
70  for (const_iterator i = __begin; i != __end; ++i) {
71  push_back(*i);
72  }
73  }
std::string PID
Definition: JArgs.hh:167
JEEP::JArgs::JArgs ( const std::string &  buffer)
inline

Constructor.

Parameters
bufferinput

Definition at line 81 of file JArgs.hh.

82  {
83  using namespace std;
84 
85  istringstream is(buffer);
86 
87  PID = "";
88 
89  for (string word; is >> word; ) {
90  push_back(word);
91  }
92  }
is
Definition: JDAQCHSM.chsm:167
std::string PID
Definition: JArgs.hh:167

Member Function Documentation

std::string JEEP::JArgs::str ( const char  ws = ' ') const
inline

Convert to string consisting of sequence of tokens separated by given white space character.

Parameters
wswhite space character
Returns
string

Definition at line 101 of file JArgs.hh.

102  {
103  std::string buffer = PID;
104 
105  for (const_iterator i = this->begin(); i != this->end(); ++i) {
106  buffer += ws;
107  buffer += *i;
108  }
109 
110  return buffer;
111  }
std::string PID
Definition: JArgs.hh:167
const char* JEEP::JArgs::c_str ( const char  ws = ' ') const
inline

Convert to character array consisting of sequence of tokens separated by given white space character.

Parameters
wswhite space character
Returns
character array

Definition at line 120 of file JArgs.hh.

121  {
122  static std::string buffer;
123 
124  buffer = this->str(ws);
125 
126  return buffer.c_str();
127  }
std::string str(const char ws= ' ') const
Convert to string consisting of sequence of tokens separated by given white space character...
Definition: JArgs.hh:101

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JArgs args 
)
friend

Stream input.

Parameters
ininput stream
argsargs
Returns
input stream

Definition at line 137 of file JArgs.hh.

138  {
139  //in >> args.PID;
140 
141  for (std::string buffer; in >> buffer; ) {
142  args.push_back(buffer);
143  }
144 
145  return in;
146  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
std::ostream& operator<< ( std::ostream &  out,
const JArgs args 
)
friend

Stream output.

Parameters
outoutput stream
argsargs
Returns
output stream

Definition at line 156 of file JArgs.hh.

157  {
158  out << args.PID;
159 
160  for (JArgs::const_iterator i = args.begin(); i != args.end(); ++i) {
161  out << ' ' << *i;
162  }
163 
164  return out;
165  }
std::string PID
Definition: JArgs.hh:167

Member Data Documentation

std::string JEEP::JArgs::PID

Definition at line 167 of file JArgs.hh.


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