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 #include "../../basic/config.h" 20 #include "output_stream_buffer.h" 21 OutputStreamBuffer(StreamEntity * prev)22OutputStreamBuffer::OutputStreamBuffer(StreamEntity* prev): 23 StreamEntity(prev), 24 buf_size_(prev->file_name().empty() ? STDOUT_BUF_SIZE : config.file_buffer_size), 25 buf_(new char[buf_size_]) 26 {} 27 write_buffer()28pair<char*, char*> OutputStreamBuffer::write_buffer() 29 { 30 return std::make_pair(buf_.get(), buf_.get() + buf_size_); 31 } 32 flush(size_t count)33void OutputStreamBuffer::flush(size_t count) 34 { 35 prev_->write(buf_.get(), count); 36 } 37 seek(size_t pos)38void OutputStreamBuffer::seek(size_t pos) 39 { 40 prev_->seek(pos); 41 } 42 rewind()43void OutputStreamBuffer::rewind() 44 { 45 prev_->rewind(); 46 } 47 tell()48size_t OutputStreamBuffer::tell() 49 { 50 return prev_->tell(); 51 } 52