1 /****
2 DIAMOND protein aligner
3 Copyright (C) 2013-2018 Benjamin Buchfink <buchfink@gmail.com>
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 ****/
18 
19 #ifndef OUTPUT_STREAM_BUFFER_H_
20 #define OUTPUT_STREAM_BUFFER_H_
21 
22 #include <utility>
23 #include <memory>
24 #include "stream_entity.h"
25 
26 struct OutputStreamBuffer : public StreamEntity
27 {
28 	OutputStreamBuffer(StreamEntity* prev);
29 	virtual pair<char*, char*> write_buffer();
30 	virtual void flush(size_t count);
31 	virtual void seek(size_t pos);
32 	virtual void rewind();
33 	virtual size_t tell();
34 private:
35 
36 	static const size_t STDOUT_BUF_SIZE = 4096;
37 	const size_t buf_size_;
38 	std::unique_ptr<char[]> buf_;
39 };
40 
41 #endif