Nemo  2.3.46
BinaryFileParser Class Reference

Retrieves simulation parameters from a binary data file. More...

#include <fileparser.h>

+ Inheritance diagram for BinaryFileParser:
+ Collaboration diagram for BinaryFileParser:

Public Member Functions

 BinaryFileParser (const char *stream)
 
virtual ~BinaryFileParser ()
 
virtual bool read (const char *stream)
 
- Public Member Functions inherited from StreamParser
 StreamParser (const char *stream)
 
virtual ~StreamParser ()
 
virtual bool readArguments (istream &IN, int &l_count, string &args)
 
void replaceCR (string &stream, const char rpl= '\n')
 
- Public Member Functions inherited from ParamsParser
 ParamsParser (const char *name)
 
virtual ~ParamsParser ()
 
void setName (const char *name)
 
map< string, string > get_inputParams ()
 
map< string, vector< string > > & getParsedParameters (const char *stream_name)
 
map< string, vector< string > > & getParsedParameters ()
 
map< string, string > & getParameters (const char *stream_name)
 
map< string, string > & getParameters ()
 
void parse ()
 Builds the _parsedParams from the _inputParams. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from StreamParser
static bool removeComment (istream &IN, int &l_count)
 Recusively removes comments until the end of a line/of the file, or of a block comment is reached. More...
 
static bool removeSpaceAndComment (istream &IN, int &l_count, bool keepLast=false)
 Removes whitespace char on a line until a non-ws or EOL is reached. More...
 
static string readUntilCharacter (istream &IN, int &l_count, char &start_c, const char end_c)
 
static void eatLine (istream &IN, int &l_count)
 
- Static Public Member Functions inherited from ParamsParser
static void getBlockArgument (istream &IN, char &c, string &arg)
 
static void getArguments (string &arg_str, vector< string > &arg_vect)
 
- Protected Member Functions inherited from ParamsParser
void reset_inputParams ()
 
void add_inputParam (string &param, const string &arg)
 

Detailed Description

Retrieves simulation parameters from a binary data file.

The parameters are extracted from the binary file before being passed the StreamParser base class.

Constructor & Destructor Documentation

BinaryFileParser::BinaryFileParser ( const char *  stream)
inline
54 : StreamParser(stream) {}
StreamParser(const char *stream)
Definition: paramsparser.h:83
virtual BinaryFileParser::~BinaryFileParser ( )
inlinevirtual
55 {}

Member Function Documentation

bool BinaryFileParser::read ( const char *  stream)
virtual

Reimplemented from StreamParser.

References fatal(), and StreamParser::read().

59 {
60 // message("reading \"%s\"\n",stream);
61 
62  ifstream FILE(stream);
63  ostringstream OUT;
64  char c;
65 
66  //read by character until the first separator is encountered:
67  // '@' is now used in the init file for temporal parameters and external files as well
68  while( (FILE.get(c)) ) {
69  if(c != '@') OUT << c;
70  else if ( FILE.peek() != 'G' ) OUT << c; // '@G' is first delimiter found in binary file
71  else break;
72  }
73 
74  if( !(FILE) ) fatal("BinaryFileParser::read::get %s\n",strerror(errno));
75 
76  FILE.close();
77 
78  return StreamParser::read(OUT.str().c_str());
79 }
virtual bool read(const char *stream)
Definition: paramsparser.cc:179
void fatal(const char *str,...)
Definition: output.cc:90

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

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR