-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathInOutStreams.h
49 lines (39 loc) · 1.36 KB
/
InOutStreams.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef INOUTSTREAMS_DEF
#define INOUTSTREAMS_DEF
#include <ios>
#include <ostream>
#include "IncludeDefine.h"
#include SAMTOOLS_BGZF_H
template<class charT, class traits = std::char_traits<charT> >
class NullBuf: public std::basic_streambuf<charT, traits> {
inline typename traits::int_type overflow(typename traits::int_type c) override {
return traits::not_eof(c);
}
};
template<class charT = char, class traits = std::char_traits<charT> >
class NullStream: public std::basic_ostream<charT, traits> {
public:
inline NullStream():
std::basic_ios<charT, traits>(&nullbuf),
std::basic_ostream<charT, traits>(&nullbuf)
{ std::basic_ios<charT, traits>::init(&nullbuf); }
inline void open(const char*, std::ios_base::openmode = std::ios_base::out) {}
inline void close() {}
private:
NullBuf<charT, traits> nullbuf;
};
class InOutStreams {
public:
ostream *logStdOut, *outSAM;
ofstream outSAMfile;
BGZF *outBAMfileUnsorted, *outBAMfileCoord, *outQuantBAMfile;
ofstream outChimSAM, outChimJunction, logFinal, outUnmappedReadsStream[MAX_N_MATES];
ifstream readIn[MAX_N_MATES];
//send logs to nothing
NullStream<> logStdOutFile, logMain, logProgress;
//compilation-optional streams
ofstream outLocalChains;
InOutStreams();
~InOutStreams();
};
#endif