Public Member Functions | Private Member Functions | Private Attributes | List of all members
stan::io::dump_reader Class Reference

#include "stan/io/dump.hpp"

Public Member Functions

 dump_reader (std::istream &in)
 
 ~dump_reader ()
 
std::string name ()
 
std::vector< size_t > dims ()
 
bool is_int ()
 
std::vector< intint_values ()
 
std::vector< double > double_values ()
 
bool next ()
 

Private Member Functions

bool scan_single_char (char c_expected)
 
bool scan_optional_long ()
 
bool scan_char (char c_expected)
 
bool scan_name_unquoted ()
 
bool scan_name ()
 
bool scan_chars (const char *s, bool case_sensitive=true)
 
bool scan_chars (std::string s, bool case_sensitive=true)
 
size_t scan_dim ()
 
int scan_int ()
 
int get_int ()
 
double scan_double ()
 
void scan_number (bool negate_val)
 
void scan_number ()
 
bool scan_zero_integers ()
 
bool scan_zero_doubles ()
 
bool scan_seq_value ()
 
bool scan_struct_value ()
 
bool scan_value ()
 

Private Attributes

std::string buf_
 
std::string name_
 
std::vector< intstack_i_
 
std::vector< double > stack_r_
 
std::vector< size_t > dims_
 
std::istream & in_
 

Detailed Description

Reads data from S-plus dump format.

A dump_reader parses data from the S-plus dump format, a human-readable ASCII representation of arbitrarily dimensioned arrays of integers and arrays of floating point values.

Stan's dump reader is limited to reading integers, scalars and arrays of arbitrary dimensionality of integers and scalars. It is able to read from a file consisting of a sequence of dumped variables.

There cannot be any NA (i.e., undefined) values, because these cannot be represented as double values.

The dump reader class follows a standard scanner pattern. The method next() is called to scan the next input. The type, dimensions, and values of the input is then available through method calls. Here, the type is either double or integer, and the values are the name of the variable and its array of values. If there is a single value, the dimension array is empty. For a list, the dimension array contains a single entry for the number of values. For an array, the dimensions are the dimensions of the array.

Reads are performed in an "S-compatible" mode whereby a string such as "1" or "-127" denotes and integer, whereas a string such as "1." or "0.9e-5" represents a floating point value.

The dump reader treats "integer(x)" as an array of zeros (type being integer and length x), where x any non-negative integers and x can be omitted to indicate zero-length. So the following are all legitimate: * "x <- integer()", "x <- integer(0) ", and "x <- integer(3)". For array of zeros of type double, we can replace the above "integer" with "double". This is mainly for the purpose of supporting zero-size arrays such as "x <- structure(integer(0), .Dim = c(2, 0))".

For dumping, arrays are indexed in last-index major fashion, which corresponds to column-major order for matrices represented as two-dimensional arrays. As a result, the first indices change fastest. For instance, if there is an three-dimensional array x with dimensions [2,2,2], then there are 8 values, provided in the order

[0,0,0], [1,0,0], [0,1,0], [1,1,0], [0,0,1], [1,0,1], [0,1,1], [1,1,1].

definitions ::= definition+

definition ::= name ("<-" | '=') value optional_semicolon

name ::= char* | ''' char* ''' | '"' char* '"'

value ::= value<int> | value<double>

value<T> ::= T | seq<T> | zero_array<T> | "structure" '(' seq<T> ',' ".Dim" '=' seq<int> ')' | "structure" '(' zero_array<T> ',' ".Dim" '=' seq<int> ')'

seq<int> ::= int ':' int | cseq<int>

seq<double> ::= cseq<double>

cseq<T> ::= 'c' '(' vseq<T> ')'

vseq<T> ::= T | T ',' vseq<T>

zero_array<integer> ::= "integer"<non negative int?>

zero_array<double> ::= "double"<non negative int?>

Definition at line 116 of file dump.hpp.

Constructor & Destructor Documentation

stan::io::dump_reader::dump_reader ( std::istream &  in)
inlineexplicit

Construct a reader for the specified input stream.

Parameters
inInput stream reference from which to read.

Definition at line 488 of file dump.hpp.

488 : in_(in) { }
std::istream & in_
Definition: dump.hpp:123
ifstream in
Definition: comparison.C:7
stan::io::dump_reader::~dump_reader ( )
inline

Destroy this reader.

Definition at line 493 of file dump.hpp.

493 { }

Member Function Documentation

std::vector<size_t> stan::io::dump_reader::dims ( )
inline

Return the dimensions of the most recently read variable.

Returns
Last dimensions.

Definition at line 511 of file dump.hpp.

References dims_.

Referenced by stan::io::dump::dump(), and test_list2().

511  {
512  return dims_;
513  }
std::vector< size_t > dims_
Definition: dump.hpp:122
std::vector<double> stan::io::dump_reader::double_values ( )
inline

Returns the floating point values from the last item if the last item read contained floating point values and the empty vector otherwise.

Returns
Floating point values of last item.

Definition at line 544 of file dump.hpp.

References stack_r_.

Referenced by stan::io::dump::dump(), and test_list3().

544  {
545  return stack_r_;
546  }
std::vector< double > stack_r_
Definition: dump.hpp:121
int stan::io::dump_reader::get_int ( )
inlineprivate

Definition at line 265 of file dump.hpp.

References buf_, stan::math::invalid_argument(), lem_server::msg, and getGoodRuns4SAM::n.

Referenced by scan_int(), and scan_number().

265  {
266  int n = 0;
267  try {
268  n = boost::lexical_cast<int>(buf_);
269  }
270  catch ( const boost::bad_lexical_cast &exc ) {
271  std::string msg = "value " + buf_ + " beyond int range";
272  BOOST_THROW_EXCEPTION(std::invalid_argument(msg));
273  }
274  return n;
275  }
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
std::string buf_
Definition: dump.hpp:118
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
std::vector<int> stan::io::dump_reader::int_values ( )
inline

Returns the integer values from the last item if the last item read was an integer and the empty vector otherwise.

Returns
Integer values of last item.

Definition at line 533 of file dump.hpp.

References stack_i_.

Referenced by stan::io::dump::dump(), test_exception(), and test_list3().

533  {
534  return stack_i_;
535  }
std::vector< int > stack_i_
Definition: dump.hpp:120
bool stan::io::dump_reader::is_int ( )
inline

Checks if the last item read is integer.

Return true if the value(s) in the most recently read item are integer values and false if they are floating point.

Definition at line 522 of file dump.hpp.

Referenced by stan::io::dump::dump().

522  {
523  // return stack_i_.size() > 0;
524  return stack_r_.size() == 0;
525  }
std::vector< double > stack_r_
Definition: dump.hpp:121
std::string stan::io::dump_reader::name ( )
inline

Return the name of the most recently read variable.

Returns
Name of most recently read variable.

Definition at line 501 of file dump.hpp.

References name_.

Referenced by stan::io::dump::dump(), std_candles.StdCandlesPlotter::IsMC(), run_unfold_ppfx_multiprocess.Consumer::run(), run_unfold_systs_multiprocess.Consumer::run(), run_unfold_genie_multiprocess.Consumer::run(), TEST(), and test_list2().

501  {
502  return name_;
503  }
std::string name_
Definition: dump.hpp:119
bool stan::io::dump_reader::next ( )
inline

Read the next value from the input stream, returning true if successful and false if no further input may be read.

Returns
Return true if a fresh variable was read.
Exceptions
bad_castif bad number values encountered.

Definition at line 556 of file dump.hpp.

References e, stan::math::invalid_argument(), lem_server::msg, scan_char(), scan_name(), and scan_value().

Referenced by stan::io::dump::dump(), TEST(), test_exception(), and test_list2().

556  {
557  stack_r_.clear();
558  stack_i_.clear();
559  dims_.clear();
560  name_.erase();
561  if (!scan_name()) // set name
562  return false;
563  if (!scan_char('<')) // set <-
564  return false;
565  if (!scan_char('-'))
566  return false;
567  try {
568  bool okSyntax = scan_value(); // set stack_r_, stack_i_, dims_
569  if (!okSyntax) {
570  std::string msg = "syntax error";
571  BOOST_THROW_EXCEPTION(std::invalid_argument(msg));
572  }
573  }
574  catch (const std::invalid_argument &e) {
575  std::string msg = "data " + name_ + " " + e.what();
576  BOOST_THROW_EXCEPTION(std::invalid_argument(msg));
577  }
578  return true;
579  }
bool scan_char(char c_expected)
Definition: dump.hpp:144
std::string name_
Definition: dump.hpp:119
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
std::vector< double > stack_r_
Definition: dump.hpp:121
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
std::vector< int > stack_i_
Definition: dump.hpp:120
Float_t e
Definition: plot.C:35
std::vector< size_t > dims_
Definition: dump.hpp:122
bool stan::io::dump_reader::scan_char ( char  c_expected)
inlineprivate

Definition at line 144 of file dump.hpp.

References plot_validation_datamc::c.

Referenced by next(), scan_name(), scan_number(), scan_seq_value(), scan_struct_value(), scan_value(), scan_zero_doubles(), and scan_zero_integers().

144  {
145  char c;
146  in_ >> c;
147  if (in_.fail()) return false;
148  if (c != c_expected) {
149  in_.putback(c);
150  return false;
151  }
152  return true;
153  }
std::istream & in_
Definition: dump.hpp:123
bool stan::io::dump_reader::scan_chars ( const char *  s,
bool  case_sensitive = true 
)
inlineprivate

Definition at line 186 of file dump.hpp.

References plot_validation_datamc::c, MECModelEnuComparisons::i, and calib::j.

Referenced by scan_number(), scan_struct_value(), and scan_value().

186  {
187  for (size_t i = 0; s[i]; ++i) {
188  char c;
189  if (!(in_ >> c)) {
190  for (size_t j = 1; j < i; ++j)
191  in_.putback(s[i-j]);
192  return false;
193  }
194  // all ASCII, so toupper is OK
195  if ((case_sensitive && c != s[i])
196  || (!case_sensitive && ::toupper(c) != ::toupper(s[i]))) {
197  in_.putback(c);
198  for (size_t j = 1; j < i; ++j)
199  in_.putback(s[i-j]);
200  return false;
201  }
202  }
203  return true;
204  }
const XML_Char * s
Definition: expat.h:262
std::istream & in_
Definition: dump.hpp:123
const double j
Definition: BetheBloch.cxx:29
bool stan::io::dump_reader::scan_chars ( std::string  s,
bool  case_sensitive = true 
)
inlineprivate

Definition at line 206 of file dump.hpp.

References plot_validation_datamc::c, MECModelEnuComparisons::i, and calib::j.

206  {
207  for (size_t i = 0; i < s.size(); ++i) {
208  char c;
209  if (!(in_ >> c)) {
210  for (size_t j = 1; j < i; ++j)
211  in_.putback(s[i-j]);
212  return false;
213  }
214  // all ASCII, so toupper is OK
215  if ((case_sensitive && c != s[i])
216  || (!case_sensitive && ::toupper(c) != ::toupper(s[i]))) {
217  in_.putback(c);
218  for (size_t j = 1; j < i; ++j)
219  in_.putback(s[i-j]);
220  return false;
221  }
222  }
223  return true;
224  }
const XML_Char * s
Definition: expat.h:262
std::istream & in_
Definition: dump.hpp:123
const double j
Definition: BetheBloch.cxx:29
size_t stan::io::dump_reader::scan_dim ( )
inlineprivate

Definition at line 226 of file dump.hpp.

References buf_, plot_validation_datamc::c, d, stan::math::invalid_argument(), lem_server::msg, and scan_optional_long().

Referenced by scan_struct_value().

226  {
227  char c;
228  buf_.clear();
229  while (in_.get(c)) {
230  if (std::isspace(c)) continue;
231  if (std::isdigit(c)) {
232  buf_.push_back(c);
233  } else {
234  in_.putback(c);
235  break;
236  }
237  }
239  size_t d = 0;
240  try {
241  d = boost::lexical_cast<size_t>(buf_);
242  }
243  catch ( const boost::bad_lexical_cast &exc ) {
244  std::string msg = "value " + buf_ + " beyond array dimension range";
245  BOOST_THROW_EXCEPTION(std::invalid_argument(msg));
246  }
247  return d;
248  }
Float_t d
Definition: plot.C:236
std::istream & in_
Definition: dump.hpp:123
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
std::string buf_
Definition: dump.hpp:118
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
bool scan_optional_long()
Definition: dump.hpp:135
double stan::io::dump_reader::scan_double ( )
inlineprivate

Definition at line 277 of file dump.hpp.

References buf_, stan::math::invalid_argument(), lem_server::msg, stan::io::validate_zero_buf(), and submit_syst::x.

Referenced by scan_number().

277  {
278  double x = 0;
279  try {
280  x = boost::lexical_cast<double>(buf_);
281  if (x == 0)
283  }
284  catch ( const boost::bad_lexical_cast &exc ) {
285  std::string msg = "value " + buf_ + " beyond numeric range";
286  BOOST_THROW_EXCEPTION(std::invalid_argument(msg));
287  }
288  return x;
289  }
void invalid_argument(const char *function, const char *name, const T &y, const char *msg1, const char *msg2)
void validate_zero_buf(const B &buf)
std::string buf_
Definition: dump.hpp:118
::xsd::cxx::tree::string< char, simple_type > string
Definition: Database.h:154
int stan::io::dump_reader::scan_int ( )
inlineprivate

Definition at line 250 of file dump.hpp.

References plot_validation_datamc::c, and get_int().

Referenced by scan_struct_value(), scan_zero_doubles(), and scan_zero_integers().

250  {
251  char c;
252  buf_.clear();
253  while (in_.get(c)) {
254  if (std::isspace(c)) continue;
255  if (std::isdigit(c)) {
256  buf_.push_back(c);
257  } else {
258  in_.putback(c);
259  break;
260  }
261  }
262  return(get_int());
263  }
std::istream & in_
Definition: dump.hpp:123
std::string buf_
Definition: dump.hpp:118
bool stan::io::dump_reader::scan_name ( )
inlineprivate

Definition at line 172 of file dump.hpp.

References scan_char(), and scan_name_unquoted().

Referenced by next().

172  {
173  if (scan_char('"')) {
174  if (!scan_name_unquoted()) return false;
175  if (!scan_char('"')) return false;
176  } else if (scan_char('\'')) {
177  if (!scan_name_unquoted()) return false;
178  if (!scan_char('\'')) return false;
179  } else {
180  if (!scan_name_unquoted()) return false;
181  }
182  return true;
183  }
bool scan_char(char c_expected)
Definition: dump.hpp:144
bool scan_name_unquoted()
Definition: dump.hpp:155
bool stan::io::dump_reader::scan_name_unquoted ( )
inlineprivate

Definition at line 155 of file dump.hpp.

References plot_validation_datamc::c.

Referenced by scan_name().

155  {
156  char c;
157  in_ >> c;
158  if (in_.fail()) return false;
159  if (!std::isalpha(c)) return false;
160  name_.push_back(c);
161  while (in_.get(c)) { // get turns off auto space skip
162  if (std::isalpha(c) || std::isdigit(c) || c == '_' || c == '.') {
163  name_.push_back(c);
164  } else {
165  in_.putback(c);
166  return true;
167  }
168  }
169  return true; // but hit eos
170  }
std::string name_
Definition: dump.hpp:119
std::istream & in_
Definition: dump.hpp:123
void stan::io::dump_reader::scan_number ( bool  negate_val)
inlineprivate

Definition at line 294 of file dump.hpp.

References plot_validation_datamc::c, get_int(), calib::j, getGoodRuns4SAM::n, scan_chars(), scan_double(), scan_optional_long(), and submit_syst::x.

294  {
295  // must take longest first!
296  if (scan_chars("Inf")) {
297  scan_chars("inity"); // read past if there
298  stack_r_.push_back(negate_val
299  ? -std::numeric_limits<double>::infinity()
300  : std::numeric_limits<double>::infinity());
301  return;
302  }
303  if (scan_chars("NaN", false)) {
304  stack_r_.push_back(std::numeric_limits<double>::quiet_NaN());
305  return;
306  }
307 
308  char c;
309  bool is_double = false;
310  buf_.clear();
311  while (in_.get(c)) {
312  if (std::isdigit(c)) { // before pre-scan || c == '-' || c == '+') {
313  buf_.push_back(c);
314  } else if (c == '.'
315  || c == 'e'
316  || c == 'E'
317  || c == '-'
318  || c == '+') {
319  is_double = true;
320  buf_.push_back(c);
321  } else {
322  in_.putback(c);
323  break;
324  }
325  }
326  if (!is_double && stack_r_.size() == 0) {
327  int n = get_int();
328  stack_i_.push_back(negate_val ? -n : n);
330  } else {
331  for (size_t j = 0; j < stack_i_.size(); ++j)
332  stack_r_.push_back(static_cast<double>(stack_i_[j]));
333  stack_i_.clear();
334  double x = scan_double();
335  stack_r_.push_back(negate_val ? -x : x);
336  }
337  }
std::istream & in_
Definition: dump.hpp:123
const double j
Definition: BetheBloch.cxx:29
std::vector< double > stack_r_
Definition: dump.hpp:121
bool scan_chars(const char *s, bool case_sensitive=true)
Definition: dump.hpp:186
std::string buf_
Definition: dump.hpp:118
double scan_double()
Definition: dump.hpp:277
std::vector< int > stack_i_
Definition: dump.hpp:120
bool scan_optional_long()
Definition: dump.hpp:135
void stan::io::dump_reader::scan_number ( )
inlineprivate

Definition at line 339 of file dump.hpp.

References plot_validation_datamc::c, and scan_char().

Referenced by scan_seq_value(), and scan_value().

339  {
340  char c;
341  while (in_.get(c)) {
342  if (std::isspace(c)) continue;
343  in_.putback(c);
344  break;
345  }
346  bool negate_val = scan_char('-');
347  if (!negate_val) scan_char('+'); // flush leading +
348  return scan_number(negate_val);
349  }
bool scan_char(char c_expected)
Definition: dump.hpp:144
std::istream & in_
Definition: dump.hpp:123
bool stan::io::dump_reader::scan_optional_long ( )
inlineprivate

Definition at line 135 of file dump.hpp.

References scan_single_char().

Referenced by scan_dim(), and scan_number().

135  {
136  if (scan_single_char('l'))
137  return true;
138  else if (scan_single_char('L'))
139  return true;
140  else
141  return false;
142  }
bool scan_single_char(char c_expected)
Definition: dump.hpp:125
bool stan::io::dump_reader::scan_seq_value ( )
inlineprivate

Definition at line 384 of file dump.hpp.

References scan_char(), and scan_number().

Referenced by scan_struct_value(), and scan_value().

384  {
385  if (!scan_char('(')) return false;
386  if (scan_char(')')) {
387  dims_.push_back(0U);
388  return true;
389  }
390  scan_number(); // first entry
391  while (scan_char(',')) {
392  scan_number();
393  }
394  dims_.push_back(stack_r_.size() + stack_i_.size());
395  return scan_char(')');
396  }
bool scan_char(char c_expected)
Definition: dump.hpp:144
std::vector< double > stack_r_
Definition: dump.hpp:121
std::vector< int > stack_i_
Definition: dump.hpp:120
std::vector< size_t > dims_
Definition: dump.hpp:122
bool stan::io::dump_reader::scan_single_char ( char  c_expected)
inlineprivate

Definition at line 125 of file dump.hpp.

References plot_validation_datamc::c.

Referenced by scan_optional_long().

125  {
126  int c = in_.peek();
127  if (in_.fail()) return false;
128  if (c != c_expected)
129  return false;
130  char c_skip;
131  in_.get(c_skip);
132  return true;
133  }
std::istream & in_
Definition: dump.hpp:123
bool stan::io::dump_reader::scan_struct_value ( )
inlineprivate

Definition at line 398 of file dump.hpp.

References febshutoff_auto::end, MECModelEnuComparisons::i, scan_char(), scan_chars(), scan_dim(), scan_int(), scan_seq_value(), scan_zero_doubles(), scan_zero_integers(), and febshutoff_auto::start.

Referenced by scan_value().

398  {
399  if (!scan_char('(')) return false;
400  if (scan_chars("integer")) {
402  } else if (scan_chars("double")) {
404  } else if (scan_char('c')) {
405  scan_seq_value();
406  } else {
407  int start = scan_int();
408  if (!scan_char(':'))
409  return false;
410  int end = scan_int();
411  if (start <= end) {
412  for (int i = start; i <= end; ++i)
413  stack_i_.push_back(i);
414  } else {
415  for (int i = start; i >= end; --i)
416  stack_i_.push_back(i);
417  }
418  }
419  dims_.clear();
420  if (!scan_char(',')) return false;
421  if (!scan_char('.')) return false;
422  if (!scan_chars("Dim")) return false;
423  if (!scan_char('=')) return false;
424  if (scan_char('c')) {
425  if (!scan_char('(')) return false;
426  size_t dim = scan_dim();
427  dims_.push_back(dim);
428  while (scan_char(',')) {
429  dim = scan_dim();
430  dims_.push_back(dim);
431  }
432  if (!scan_char(')')) return false;
433  } else {
434  size_t start = scan_dim();
435  if (!scan_char(':'))
436  return false;
437  size_t end = scan_dim();
438  if (start < end) {
439  for (size_t i = start; i <= end; ++i)
440  dims_.push_back(i);
441  } else {
442  for (size_t i = start; i >= end; --i)
443  dims_.push_back(i);
444  }
445  }
446  if (!scan_char(')')) return false;
447  return true;
448  }
bool scan_zero_doubles()
Definition: dump.hpp:367
bool scan_seq_value()
Definition: dump.hpp:384
bool scan_char(char c_expected)
Definition: dump.hpp:144
bool scan_zero_integers()
Definition: dump.hpp:351
size_t scan_dim()
Definition: dump.hpp:226
bool scan_chars(const char *s, bool case_sensitive=true)
Definition: dump.hpp:186
std::vector< int > stack_i_
Definition: dump.hpp:120
std::vector< size_t > dims_
Definition: dump.hpp:122
bool stan::io::dump_reader::scan_value ( )
inlineprivate

Definition at line 450 of file dump.hpp.

References febshutoff_auto::end, MECModelEnuComparisons::i, scan_char(), scan_chars(), scan_number(), scan_seq_value(), scan_struct_value(), scan_zero_doubles(), scan_zero_integers(), and febshutoff_auto::start.

Referenced by next().

450  {
451  if (scan_char('c'))
452  return scan_seq_value();
453  if (scan_chars("integer"))
454  return scan_zero_integers();
455  if (scan_chars("double"))
456  return scan_zero_doubles();
457  if (scan_chars("structure"))
458  return scan_struct_value();
459  scan_number();
460  if (!scan_char(':'))
461  return true;
462  if (stack_i_.size() != 1)
463  return false;
464  scan_number();
465  if (stack_i_.size() != 2)
466  return false;
467  int start = stack_i_[0];
468  int end = stack_i_[1];
469  stack_i_.clear();
470  if (start <= end) {
471  for (int i = start; i <= end; ++i)
472  stack_i_.push_back(i);
473  } else {
474  for (int i = start; i >= end; --i)
475  stack_i_.push_back(i);
476  }
477  dims_.push_back(stack_i_.size());
478  return true;
479  }
bool scan_zero_doubles()
Definition: dump.hpp:367
bool scan_seq_value()
Definition: dump.hpp:384
bool scan_char(char c_expected)
Definition: dump.hpp:144
bool scan_zero_integers()
Definition: dump.hpp:351
bool scan_chars(const char *s, bool case_sensitive=true)
Definition: dump.hpp:186
bool scan_struct_value()
Definition: dump.hpp:398
std::vector< int > stack_i_
Definition: dump.hpp:120
std::vector< size_t > dims_
Definition: dump.hpp:122
bool stan::io::dump_reader::scan_zero_doubles ( )
inlineprivate

Definition at line 367 of file dump.hpp.

References MECModelEnuComparisons::i, scan_char(), and scan_int().

Referenced by scan_struct_value(), and scan_value().

367  {
368  if (!scan_char('(')) return false;
369  if (scan_char(')')) {
370  dims_.push_back(0U);
371  return true;
372  }
373  int s = scan_int();
374  if (s < 0) return false;
375  for (int i = 0; i < s; ++i) {
376  stack_r_.push_back(0);
377  }
378  if (!scan_char(')')) return false;
379  dims_.push_back(s);
380  return true;
381  }
bool scan_char(char c_expected)
Definition: dump.hpp:144
const XML_Char * s
Definition: expat.h:262
std::vector< double > stack_r_
Definition: dump.hpp:121
std::vector< size_t > dims_
Definition: dump.hpp:122
bool stan::io::dump_reader::scan_zero_integers ( )
inlineprivate

Definition at line 351 of file dump.hpp.

References MECModelEnuComparisons::i, scan_char(), and scan_int().

Referenced by scan_struct_value(), and scan_value().

351  {
352  if (!scan_char('(')) return false;
353  if (scan_char(')')) {
354  dims_.push_back(0U);
355  return true;
356  }
357  int s = scan_int();
358  if (s < 0) return false;
359  for (int i = 0; i < s; ++i) {
360  stack_i_.push_back(0);
361  }
362  if (!scan_char(')')) return false;
363  dims_.push_back(s);
364  return true;
365  }
bool scan_char(char c_expected)
Definition: dump.hpp:144
const XML_Char * s
Definition: expat.h:262
std::vector< int > stack_i_
Definition: dump.hpp:120
std::vector< size_t > dims_
Definition: dump.hpp:122

Member Data Documentation

std::string stan::io::dump_reader::buf_
private

Definition at line 118 of file dump.hpp.

Referenced by get_int(), scan_dim(), and scan_double().

std::vector<size_t> stan::io::dump_reader::dims_
private

Definition at line 122 of file dump.hpp.

Referenced by dims().

std::istream& stan::io::dump_reader::in_
private

Definition at line 123 of file dump.hpp.

std::string stan::io::dump_reader::name_
private

Definition at line 119 of file dump.hpp.

Referenced by name().

std::vector<int> stan::io::dump_reader::stack_i_
private

Definition at line 120 of file dump.hpp.

Referenced by int_values().

std::vector<double> stan::io::dump_reader::stack_r_
private

Definition at line 121 of file dump.hpp.

Referenced by double_values().


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