Jpp  master_rocky
the software that should make you happy
JFileStream.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JFILESTREAM__
2 #define __JLANG__JFILESTREAM__
3 
4 #include <istream>
5 #include <ostream>
6 
7 #include "JLang/JFile.hh"
9 
10 
11 /**
12  * \author mdejong
13  */
14 
15 namespace JLANG {}
16 namespace JPP { using namespace JLANG; }
17 
18 namespace JLANG {
19 
20 
21  /**
22  * Streaming of input.
23  */
25  protected JFileInputStreamBuffer,
26  public std::istream
27  {
28  public:
29  /**
30  * Constructor.
31  *
32  * \param file file
33  * \param size size of internal buffer
34  */
36  const std::size_t size = 65536) :
37  JFileInputStreamBuffer(file, size),
38  std::istream(this)
39  {}
40  };
41 
42 
43  /**
44  * Streaming of output.
45  */
47  protected JFileOutputStreamBuffer,
48  public std::ostream
49  {
50  public:
51  /**
52  * Constructor.
53  *
54  * \param file file
55  * \param size size of internal buffer
56  */
58  const std::size_t size = 65536) :
59  JFileOutputStreamBuffer(file, size),
60  std::ostream(this)
61  {}
62  };
63 
64 
65  /**
66  * Streaming of input and output.
67  */
68  class JFileStream :
69  protected JFileStreamBuffer,
70  public std::iostream
71  {
72  public:
73  /**
74  * Constructor.
75  *
76  * \param in input file
77  * \param out output file
78  * \param size size of internal buffer
79  */
81  const JAbstractFile& out,
82  const std::size_t size = 65536) :
83  JFileStreamBuffer (in, out, size),
84  std::iostream(this)
85  {}
86  };
87 }
88 
89 #endif
The JAbstractFile class encapsulates the c-style file descriptor.
Input file stream buffer.
Streaming of input.
Definition: JFileStream.hh:27
JFileInputStream(const JAbstractFile &file, const std::size_t size=65536)
Constructor.
Definition: JFileStream.hh:35
Output file stream buffer.
Streaming of output.
Definition: JFileStream.hh:49
JFileOutputStream(const JAbstractFile &file, const std::size_t size=65536)
Constructor.
Definition: JFileStream.hh:57
Input and output file stream buffer.
Streaming of input and output.
Definition: JFileStream.hh:71
JFileStream(const JAbstractFile &in, const JAbstractFile &out, const std::size_t size=65536)
Constructor.
Definition: JFileStream.hh:80
Auxiliary classes and methods for language specific functionality.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JSTDTypes.hh:14