00001 /*========================================================================== 00002 * Copyright (c) 2003 University of Massachusetts. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.cs.cmu.edu/~lemur/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 // 00014 // WriteBuffer 00015 // 00016 // tds - 13 November 2003 00017 // 00018 00019 #ifndef LEMUR_WRITEBUFFER_HPP 00020 #define LEMUR_WRITEBUFFER_HPP 00021 00022 #include "File.hpp" 00025 class WriteBuffer { 00026 private: 00027 char* _buffer; 00028 int _bufferSize; 00029 File& _file; 00030 int _position; 00031 File::offset_type _filePos; 00032 00033 public: 00034 WriteBuffer( File& file, int bufferSize ); 00035 ~WriteBuffer(); 00036 00040 void write( const char* data, int length ); 00041 00045 void flush(); 00046 00049 File::offset_type tellp() const; 00050 }; 00051 00052 #endif // LEMUR_WRITEBUFFER_HPP