Jpp  18.3.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JAccessibleBinaryStream.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JACCESSIBLEBINARYSTREAM__
2 #define __JLANG__JACCESSIBLEBINARYSTREAM__
3 
4 #include <fstream>
5 #include <ios>
6 
8 
9 
10 /**
11  * \author mdejong
12  */
13 
14 namespace JLANG {}
15 namespace JPP { using namespace JLANG; }
16 
17 namespace JLANG {
18 
19  /**
20  * Accessible binary input stream.
21  *
22  * This class is a simple wrapper around the JAccessibleInputStream class.
23  * It re-implements the method open() of the JAccessible interface for binary I/O.
24  */
27  {
28  public:
29  /**
30  * Default constructor.
31  */
33  {}
34 
35 
36  /**
37  * Constructor.
38  *
39  * \param file_name file name
40  */
41  JAccessibleBinaryInputStream(const char* file_name)
42  {
43  open(file_name);
44  }
45 
46 
47  /**
48  * Open file.
49  *
50  * \param file_name file name
51  */
52  virtual void open(const char* file_name) override
53  {
54  std::ifstream::open(file_name, std::ios::binary);
55  }
56  };
57 
58 
59  /**
60  * Accessible output stream.
61  *
62  * This class is a simple wrapper around the JAccessibleOutputStream class.
63  * It re-implements the method open() of the JAccessible interface for binary I/O.
64  */
67  {
68  public:
69  /**
70  * Default constructor.
71  */
73  {}
74 
75 
76  /**
77  * Constructor.
78  *
79  * \param file_name file name
80  */
81  JAccessibleBinaryOutputStream(const char* file_name)
82  {
83  open(file_name);
84  }
85 
86 
87  /**
88  * Open file.
89  *
90  * \param file_name file name
91  */
92  virtual void open(const char* file_name) override
93  {
94  std::ofstream::open(file_name, std::ios::binary);
95  }
96  };
97 }
98 
99 #endif
virtual void open(const char *file_name) override
Open file.
virtual void open(const char *file_name) override
Open file.
Accessible output stream.
JAccessibleBinaryOutputStream(const char *file_name)
Constructor.
JAccessibleBinaryOutputStream()
Default constructor.
JAccessibleBinaryInputStream()
Default constructor.
T * open(const std::string &file_name)
Open file.
Definition: JeepToolkit.hh:346
Accessible input stream.
JAccessibleBinaryInputStream(const char *file_name)
Constructor.
Accessible binary input stream.