Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Static Protected Attributes | List of all members
JLANG::JAccessibleBinaryInputStream Class Reference

Accessible binary input stream. More...

#include <JAccessibleBinaryStream.hh>

Inheritance diagram for JLANG::JAccessibleBinaryInputStream:
JLANG::JAccessibleInputStream JLANG::JAccessible JLANG::JThrow< JAccessible > JIO::JBinaryFileReader< JPhotonPath > JIO::JBinaryFileReader< T > JMARKOV::JPhotonPathReader JSUPPORT::JDAQFileReader< T, true >

Public Member Functions

 JAccessibleBinaryInputStream ()
 Default constructor. More...
 
 JAccessibleBinaryInputStream (const char *file_name)
 Constructor. More...
 
virtual void open (const char *file_name) override
 Open file. More...
 
virtual bool is_open () const
 Check is file is open. More...
 
virtual void close ()
 Close file. More...
 

Static Public Member Functions

static void Throw (const bool option)
 Enable/disable throw option. More...
 
static int Throw (const JException &error, const int value=-1)
 Throw exception or return error. More...
 

Static Protected Attributes

static bool do_throw
 throw option More...
 

Detailed Description

Accessible binary input stream.

This class is a simple wrapper around the JAccessibleInputStream class. It re-implements the method open() of the JAccessible interface for binary I/O.

Definition at line 25 of file JAccessibleBinaryStream.hh.

Constructor & Destructor Documentation

JLANG::JAccessibleBinaryInputStream::JAccessibleBinaryInputStream ( )
inline

Default constructor.

Definition at line 32 of file JAccessibleBinaryStream.hh.

33  {}
JLANG::JAccessibleBinaryInputStream::JAccessibleBinaryInputStream ( const char *  file_name)
inline

Constructor.

Parameters
file_namefile name

Definition at line 41 of file JAccessibleBinaryStream.hh.

42  {
43  open(file_name);
44  }
virtual void open(const char *file_name) override
Open file.

Member Function Documentation

virtual void JLANG::JAccessibleBinaryInputStream::open ( const char *  file_name)
inlineoverridevirtual

Open file.

Parameters
file_namefile name

Reimplemented from JLANG::JAccessibleInputStream.

Definition at line 52 of file JAccessibleBinaryStream.hh.

53  {
54  std::ifstream::open(file_name, std::ios::binary);
55  }
T * open(const std::string &file_name)
Open file.
Definition: JeepToolkit.hh:306
virtual bool JLANG::JAccessibleInputStream::is_open ( ) const
inlinevirtualinherited

Check is file is open.

Returns
true if open; else false

Implements JLANG::JAccessible.

Definition at line 53 of file JAccessibleStream.hh.

54  {
55  return std::ifstream::is_open();
56  }
virtual void JLANG::JAccessibleInputStream::close ( )
inlinevirtualinherited

Close file.

Implements JLANG::JAccessible.

Definition at line 77 of file JAccessibleStream.hh.

78  {
80  }
void close(std::istream *pf)
Close file.
Definition: JeepToolkit.hh:346
static void JLANG::JThrow< JAccessible >::Throw ( const bool  option)
inlinestaticinherited

Enable/disable throw option.

Parameters
optiontrue enable; false disable

Definition at line 37 of file JThrow.hh.

38  {
39  do_throw = option;
40  }
static bool do_throw
throw option
Definition: JThrow.hh:28
static int JLANG::JThrow< JAccessible >::Throw ( const JException error,
const int  value = -1 
)
inlinestaticinherited

Throw exception or return error.

Parameters
errorexception
valuereturn code
Returns
return code

Definition at line 50 of file JThrow.hh.

51  {
52  using namespace std;
53 
54  if (do_throw) {
55  throw error;
56  }
57 
58  cerr << error.what() << endl;
59 
60  return value;
61  }
virtual const char * what() const override
Get error message.
Definition: JException.hh:48
static bool do_throw
throw option
Definition: JThrow.hh:28

Member Data Documentation

bool JLANG::JThrow< JAccessible >::do_throw
staticprotectedinherited

throw option

Set default throw option to true.

Definition at line 28 of file JThrow.hh.


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