QMCPACK
OhmmsAsciiParser Struct Reference
+ Inheritance diagram for OhmmsAsciiParser:
+ Collaboration diagram for OhmmsAsciiParser:

Public Member Functions

void skiplines (std::istream &is, int n)
 
template<class T >
void getValue (std::istream &is, T &aval)
 
template<class T1 , class T2 >
void getValue (std::istream &is, T1 &aval, T2 &bval)
 
template<class IT >
void getValues (std::istream &is, IT first, IT last)
 
int search (std::istream &is, const std::string &keyword)
 
int search (std::istream &is, const std::string &keyword, std::string &the_line)
 
bool lookFor (std::istream &is, const std::string &keyword)
 
bool lookFor (std::istream &is, const std::string &keyword, std::string &the_line)
 

Public Attributes

char dbuffer [bufferSize]
 
std::vector< std::string > currentWords
 

Static Public Attributes

static const int bufferSize = 200
 

Detailed Description

Definition at line 45 of file SimpleParser.h.

Member Function Documentation

◆ getValue() [1/2]

void getValue ( std::istream &  is,
T &  aval 
)
inline

Definition at line 60 of file SimpleParser.h.

References bufferSize, and dbuffer.

61  {
62  is.getline(dbuffer, bufferSize);
63  std::istringstream a(dbuffer);
64  a >> aval;
65  }
char dbuffer[bufferSize]
Definition: SimpleParser.h:48
static const int bufferSize
Definition: SimpleParser.h:47

◆ getValue() [2/2]

void getValue ( std::istream &  is,
T1 &  aval,
T2 &  bval 
)
inline

Definition at line 68 of file SimpleParser.h.

References bufferSize, and dbuffer.

69  {
70  is.getline(dbuffer, bufferSize);
71  std::istringstream a(dbuffer);
72  a >> aval >> bval;
73  }
char dbuffer[bufferSize]
Definition: SimpleParser.h:48
static const int bufferSize
Definition: SimpleParser.h:47

◆ getValues()

void getValues ( std::istream &  is,
IT  first,
IT  last 
)
inline

Definition at line 76 of file SimpleParser.h.

References bufferSize, and dbuffer.

Referenced by GaussianFCHKParser::getGaussianCenters(), GaussianFCHKParser::getGeometry(), and GaussianFCHKParser::parse().

77  {
78  while (first != last)
79  {
80  is.getline(dbuffer, bufferSize);
81  std::istringstream a(dbuffer);
82  while (first != last && a >> *first)
83  {
84  first++;
85  }
86  }
87  }
char dbuffer[bufferSize]
Definition: SimpleParser.h:48
static const int bufferSize
Definition: SimpleParser.h:47

◆ lookFor() [1/2]

bool lookFor ( std::istream &  is,
const std::string &  keyword 
)
inline

Definition at line 130 of file SimpleParser.h.

Referenced by DiracParser::getCOSCI(), GamesAsciiParser::getCSF(), QPParser::getGaussianCenters(), DiracParser::getGeometry(), GamesAsciiParser::getORMAS(), DiracParser::getSpinors(), DiracParser::getWF(), GaussianFCHKParser::parse(), GamesAsciiParser::parse(), DiracParser::parse(), and DiracParser::parseCOSCIOrbInfo().

131  {
132  bool notfound = true;
133  while (notfound)
134  {
135  std::string aline;
136  getline(is, aline, '\n');
137  if (aline.find(keyword) != std::string::npos)
138  // < aline.size()) {
139  {
140  notfound = false;
141  }
142  //if(! is){
143  if (is.eof())
144  {
145  return false;
146  }
147  }
148  return true;
149  }

◆ lookFor() [2/2]

bool lookFor ( std::istream &  is,
const std::string &  keyword,
std::string &  the_line 
)
inline

Definition at line 151 of file SimpleParser.h.

152  {
153  bool notfound = true;
154  while (notfound)
155  {
156  std::string aline;
157  getline(is, aline, '\n');
158  if (aline.find(keyword) != std::string::npos)
159  // < aline.size()) {
160  {
161  notfound = false;
162  the_line = aline;
163  }
164  //if(! is){
165  if (is.eof())
166  {
167  return false;
168  }
169  }
170  return true;
171  }

◆ search() [1/2]

int search ( std::istream &  is,
const std::string &  keyword 
)
inline

Definition at line 89 of file SimpleParser.h.

Referenced by DiracParser::getCOSCI(), GaussianFCHKParser::getGaussianCenters(), DiracParser::getGaussianCenters(), GaussianFCHKParser::getGeometry(), DiracParser::getGeometry(), QPParser::getMO(), GamesAsciiParser::getMO(), DiracParser::getSpinors(), GaussianFCHKParser::parse(), QPParser::parse(), GamesAsciiParser::parse(), DiracParser::parse(), and DiracParser::parseCOSCIOrbInfo().

90  {
91  bool notfound = true;
92  while (notfound)
93  {
94  std::string aline;
95  getline(is, aline, '\n');
96  if (!is)
97  {
98  std::cout << "KEYWORD " << keyword << " : NOT FOUND. " << std::endl;
99  abort();
100  }
101  if (aline.find(keyword) < aline.size())
102  {
103  notfound = false;
104  }
105  }
106  return 1;
107  }

◆ search() [2/2]

int search ( std::istream &  is,
const std::string &  keyword,
std::string &  the_line 
)
inline

Definition at line 109 of file SimpleParser.h.

110  {
111  bool notfound = true;
112  while (notfound)
113  {
114  std::string aline;
115  getline(is, aline, '\n');
116  if (!is)
117  {
118  std::cout << "KEYWORD " << keyword << " : NOT FOUND. " << std::endl;
119  abort();
120  }
121  if (aline.find(keyword) < aline.size())
122  {
123  notfound = false;
124  the_line = aline;
125  }
126  }
127  return 1;
128  }

◆ skiplines()

void skiplines ( std::istream &  is,
int  n 
)
inline

Definition at line 51 of file SimpleParser.h.

References bufferSize, dbuffer, and qmcplusplus::n.

Referenced by DiracParser::getCOSCI(), DiracParser::getGaussianCenters(), DiracParser::getGeometry(), DiracParser::getSpinors(), DiracParser::parse(), and DiracParser::parseCOSCIOrbInfo().

52  {
53  while (n > 0)
54  {
55  is.getline(dbuffer, bufferSize);
56  --n;
57  }
58  }
char dbuffer[bufferSize]
Definition: SimpleParser.h:48
static const int bufferSize
Definition: SimpleParser.h:47

Member Data Documentation

◆ bufferSize

const int bufferSize = 200
static

Definition at line 47 of file SimpleParser.h.

Referenced by getValue(), getValues(), and skiplines().

◆ currentWords

◆ dbuffer

char dbuffer[bufferSize]

Definition at line 48 of file SimpleParser.h.

Referenced by getValue(), getValues(), and skiplines().


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