Jpp
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
JLANG::JFileStream
Streaming of input and output.
Definition: JFileStream.hh:68
JLANG::JFileOutputStream::JFileOutputStream
JFileOutputStream(const JAbstractFile &file, const std::size_t size=65536)
Constructor.
Definition: JFileStream.hh:57
JLANG::JFileOutputStreamBuffer::out
JFile out
Definition: JFileStreamBuffer.hh:215
JLANG::JAbstractFile
The JAbstractFile class encapsulates the c-style file descriptor.
Definition: JAbstractFile.hh:22
JLANG::JFileOutputStreamBuffer
Output file stream buffer.
Definition: JFileStreamBuffer.hh:108
JLANG::JFileStreamBuffer
Input and output file stream buffer.
Definition: JFileStreamBuffer.hh:223
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
JLANG::JFileInputStream
Streaming of input.
Definition: JFileStream.hh:24
JLANG::JFileInputStream::JFileInputStream
JFileInputStream(const JAbstractFile &file, const std::size_t size=65536)
Constructor.
Definition: JFileStream.hh:35
JFile.hh
JFileStreamBuffer.hh
std
Definition: jaanetDictionary.h:36
JLANG::JFileInputStreamBuffer::in
JFile in
Definition: JFileStreamBuffer.hh:100
JLANG::JFileOutputStream
Streaming of output.
Definition: JFileStream.hh:46
JLANG
Auxiliary classes and methods for language specific functionality.
Definition: JAbstractClass.hh:10
JLANG::JFileStream::JFileStream
JFileStream(const JAbstractFile &in, const JAbstractFile &out, const std::size_t size=65536)
Constructor.
Definition: JFileStream.hh:80
JLANG::JFileInputStreamBuffer
Input file stream buffer.
Definition: JFileStreamBuffer.hh:25