Jpp  16.0.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 534 of file JProperties.hh.

Constructor & Destructor Documentation

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

Definition at line 536 of file JProperties.hh.

536  :
537  properties(__properties)
538  {}

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 547 of file JProperties.hh.

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

Read properties from file.

Parameters
file_namefile name

Definition at line 593 of file JProperties.hh.

594  {
595  std::ifstream in(file_name.c_str());
596 
597  if (!in) {
598  THROW(JFileOpenException, "JFileReader: error opening file " << file_name);
599  }
600 
601  properties.read(in);
602 
603  if (in.bad()) {
604  THROW(JFileReadException, "JFileReader: error reading file " << file_name);
605  }
606 
607  in.close();
608  }
bool read(const JEquation &equation)
Read equation.
Definition: JProperties.hh:677
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Definition: JException.hh:696
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:42

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 562 of file JProperties.hh.

563  {
564  std::string file_name;
565 
566  in >> file_name;
567 
568  fileReader.read(file_name);
569 
570  return in;
571  }
void read(const std::string &file_name)
Read properties from file.
Definition: JProperties.hh:593
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:42
std::ostream& operator<< ( std::ostream &  out,
const JProperties::JFileReader fileReader 
)
friend

Stream output.

Parameters
outoutput stream
fileReaderfile reader
Returns
output stream

Definition at line 581 of file JProperties.hh.

582  {
583  return out;
584  }

Member Data Documentation

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

Definition at line 611 of file JProperties.hh.


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