ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/PrimerMatch/bufferedFile.h
Revision: 1.1.1.1 (vendor branch)
Committed: Wed Dec 22 21:37:17 2004 UTC (11 years, 9 months ago) by nje01
Branch: MAIN
CVS Tags: HEAD, RELEASE-20041222, HEAD
Changes since 1.1: +0 -0 lines
Log Message:
Initial primer_match import

Line File contents
1 /**************************************************************************
2 * This code is part of the supporting infrastructure for ATA Mapper.
3 * Copyright (C) 2002,2003,2004 Applera Corporation. All rights reserved.
4 * Author: Nathan Edwards
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received (LICENSE.txt) a copy of the GNU General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *************************************************************************/
20
21 //================================================================
22 // Modified Brian Walenz's code. Provides methods for buffered I/O.
23 // VB 9/18/00
24 //===============================================================
25
26 #ifndef IBPEP_MS_NDX_BUFFEREDFILE_H
27 #define IBPEP_MS_NDX_BUFFEREDFILE_H
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <iostream>
32 #include <fstream>
33 #include <string>
34 #include "types.h"
35
36 class BufferedFile {
37 private:
38 FILE* bufF;
39 char* _buffer;
40 int _bufferMax;
41 int _bufferLen;
42 int _readPos;
43 FILE_POSITION_TYPE _pos;
44 FILE_SIZE_TYPE _size;
45 public:
46 BufferedFile(std::string const &, int buffersize=1024*1024);
47 BufferedFile();
48 ~BufferedFile();
49
50 unsigned char getCharacter(void);
51 void openBuf(std::string const &fname);
52 bool isEndOfFile(void) const {
53 return(_pos>=_size);
54 }
55 FILE_POSITION_TYPE getPos() const ;
56 void setPos(FILE_POSITION_TYPE p);
57 FILE_SIZE_TYPE getSize() const {
58 return _size;
59 }
60 void reset();
61 };
62
63 #endif // BUFFEREDFILE_H