FileType.h

00001 /*
00002  *  Copyright (C) 2010  Regents of the University of Michigan
00003  *
00004  *   This program is free software: you can redistribute it and/or modify
00005  *   it under the terms of the GNU General Public License as published by
00006  *   the Free Software Foundation, either version 3 of the License, or
00007  *   (at your option) any later version.
00008  *
00009  *   This program is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *   GNU General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU General Public License
00015  *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00016  */
00017 
00018 #ifndef __FILETYPE_H__
00019 #define __FILETYPE_H__
00020 
00021 class FileType
00022 {
00023 public:
00024     FileType();
00025     virtual ~FileType();
00026 
00027     virtual bool operator == (void * rhs) = 0;
00028 
00029     virtual bool operator != (void * rhs) = 0;
00030 
00031     // Close the file.
00032     virtual int close() = 0;
00033 
00034     // Reset to the beginning of the file.
00035     virtual void rewind() = 0;
00036 
00037     // Check to see if we have reached the EOF.
00038     virtual int eof() = 0;
00039 
00040     // Check to see if the file is open.
00041     virtual bool isOpen() = 0;
00042 
00043     // Write to the file.
00044     virtual unsigned int write(const void * buffer, unsigned int size) = 0;
00045 
00046     // Read into a buffer from the file.
00047     virtual int read(void * buffer, unsigned int size) = 0;
00048 
00049     // Get current position in the file.
00050     // -1 return value indicates an error.
00051     virtual long int tell() = 0;
00052 
00053     // Seek to the specified offset from the origin.
00054     // origin can be any of the following:
00055     // Note: not all are valid for all filetypes.
00056     //   SEEK_SET - Beginning of file
00057     //   SEEK_CUR - Current position of the file pointer
00058     //   SEEK_END - End of file
00059     // Returns true on successful seek and false on a failed seek.
00060     virtual bool seek(long int offset, int origin) = 0;
00061 
00062 };
00063 
00064 #endif
00065 
Generated on Wed Nov 17 15:38:28 2010 for StatGen Software by  doxygen 1.6.3