Jpp test-rotations-new
the software that should make you happy
Loading...
Searching...
No Matches
JLANG::JAccessibleBinaryOutputStream Class Reference

Accessible output stream. More...

#include <JAccessibleBinaryStream.hh>

Inheritance diagram for JLANG::JAccessibleBinaryOutputStream:
JLANG::JAccessibleOutputStream JLANG::JAccessible JLANG::JThrow< JAccessible > JIO::JBinaryFileWriter< JPhotonPath > JIO::JBinaryFileWriter< T > JSUPPORT::JDAQFileWriter< T > JMARKOV::JPhotonPathWriter

Public Member Functions

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

Static Public Member Functions

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

Static Protected Attributes

static bool do_throw
 throw option
 

Detailed Description

Accessible output stream.

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

Definition at line 65 of file JAccessibleBinaryStream.hh.

Constructor & Destructor Documentation

◆ JAccessibleBinaryOutputStream() [1/2]

JLANG::JAccessibleBinaryOutputStream::JAccessibleBinaryOutputStream ( )
inline

Default constructor.

Definition at line 72 of file JAccessibleBinaryStream.hh.

73 {}

◆ JAccessibleBinaryOutputStream() [2/2]

JLANG::JAccessibleBinaryOutputStream::JAccessibleBinaryOutputStream ( const char * file_name)
inline

Constructor.

Parameters
file_namefile name

Definition at line 81 of file JAccessibleBinaryStream.hh.

82 {
83 open(file_name);
84 }
virtual void open(const char *file_name) override
Open file.

Member Function Documentation

◆ open()

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

Open file.

Parameters
file_namefile name

Reimplemented from JLANG::JAccessibleOutputStream.

Definition at line 92 of file JAccessibleBinaryStream.hh.

93 {
94 std::ofstream::open(file_name, std::ios::binary);
95 }

◆ is_open()

virtual bool JLANG::JAccessibleOutputStream::is_open ( ) const
inlinevirtualinherited

Check is file is open.

Returns
true if open; else false

Implements JLANG::JAccessible.

Definition at line 118 of file JAccessibleStream.hh.

119 {
120 return std::ofstream::is_open();
121 }

◆ close()

virtual void JLANG::JAccessibleOutputStream::close ( )
inlinevirtualinherited

Close file.

Implements JLANG::JAccessible.

Definition at line 142 of file JAccessibleStream.hh.

143 {
144 std::ofstream::close();
145 }

◆ Throw() [1/2]

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 }

◆ Throw() [2/2]

static int JLANG::JThrow< JAccessible >::Throw ( const JException_t & error,
const int value = -1 )
inlinestaticinherited

Throw exception or return error.

Parameters
errorexception
valuereturn code
Returns
return code

Definition at line 51 of file JThrow.hh.

52 {
53 using namespace std;
54
55 if (do_throw) {
56 throw error;
57 }
58
59 cerr << error.what() << endl;
60
61 return value;
62 }

Member Data Documentation

◆ do_throw

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: