Jpp  18.4.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
JEEP::JProperties::JFileReader Class Reference

Auxiliary class to handle input from file. More...

#include <JProperties.hh>

Public Member Functions

 JFileReader (JProperties &__properties)
 
JFileReaderoperator= (const std::string &file_name)
 Assignment operator. More...
 

Private Member Functions

void read (const std::string &file_name)
 Read properties from file. More...
 

Private Attributes

JPropertiesproperties
 

Friends

std::istream & operator>> (std::istream &in, JProperties::JFileReader &fileReader)
 Stream input. More...
 
std::ostream & operator<< (std::ostream &out, const JProperties::JFileReader &fileReader)
 Stream output. More...
 

Detailed Description

Auxiliary class to handle input from file.

The assignment of a value will cause the file with the corresponding name to be opened and read. The contents of the file are processed in the same way as any input to the associated JProperties object.

Definition at line 535 of file JProperties.hh.

Constructor & Destructor Documentation

JEEP::JProperties::JFileReader::JFileReader ( JProperties __properties)
inline

Definition at line 537 of file JProperties.hh.

537  :
538  properties(__properties)
539  {}

Member Function Documentation

JFileReader& JEEP::JProperties::JFileReader::operator= ( const std::string file_name)
inline

Assignment operator.

Parameters
file_namefile name
Returns
this JFileReader

Definition at line 548 of file JProperties.hh.

549  {
550  read(file_name);
551 
552  return *this;
553  }
void read(const std::string &file_name)
Read properties from file.
Definition: JProperties.hh:594
void JEEP::JProperties::JFileReader::read ( const std::string file_name)
inlineprivate

Read properties from file.

Parameters
file_namefile name

Definition at line 594 of file JProperties.hh.

595  {
596  std::ifstream in(file_name.c_str());
597 
598  if (!in) {
599  THROW(JFileOpenException, "JFileReader: error opening file " << file_name);
600  }
601 
602  properties.read(in);
603 
604  if (in.bad()) {
605  THROW(JFileReadException, "JFileReader: error reading file " << file_name);
606  }
607 
608  in.close();
609  }
bool read(const JEquation &equation)
Read equation.
Definition: JProperties.hh:679
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:712
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 JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JProperties::JFileReader fileReader 
)
friend

Stream input.

Parameters
ininput stream
fileReaderfile reader object
Returns
input stream

Definition at line 563 of file JProperties.hh.

564  {
565  std::string file_name;
566 
567  in >> file_name;
568 
569  fileReader.read(file_name);
570 
571  return in;
572  }
then awk string
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 JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
void read(const std::string &file_name)
Read properties from file.
Definition: JProperties.hh:594
std::ostream& operator<< ( std::ostream &  out,
const JProperties::JFileReader fileReader 
)
friend

Stream output.

Parameters
outoutput stream
fileReaderfile reader
Returns
output stream

Definition at line 582 of file JProperties.hh.

583  {
584  return out;
585  }

Member Data Documentation

JProperties& JEEP::JProperties::JFileReader::properties
private

Definition at line 612 of file JProperties.hh.


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