/* Class declaration for the Random_IO class The Random_IO class can be used independently or as part of the MiniDB project. Copyright (C) 1995 Hossein Hakimzadeh Comments and bug fixes can be sent to hhakimza@iusb.edu This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *//*---------------------------------------------------------------*/ /* Random_IO.h */ /* ----------- */ /* Random Access I/O class (C++ version) */ /* This is a C++ implementation of the RandomIO class. The */ /* original RandomIO class was implemented in C. */ /*---------------------------------------------------------------*/ /* The following is a class for performing Random Access I/O. */ /* Feel free to use these functions for your current */ /* and future programs. */ /* */ /* Send bug reports as well as improvements to : */ /* */ /* e-mail: hhakimza@iusb.edu */ /* */ /* Author: Hossein Hakimzadeh and Paul Nixon */ /* Purpose: Utility functions */ /* Compiler: Borland or Turbo C++ */ /* Date: April 20, 1995 */ /* Update: Dec 4, 1996 (converted to C++) */ /* Aug 2, 2008 (converted to Visual C++) */ /*---------------------------------------------------------------*/ //-----------------------------------------------------------------------// #ifndef RANDOM_IO_H #define RANDOM_IO_H //-----------------------------------------------------------------------// #define OPEN 0 #define CLOSED 1 #define ON 1 #define OFF 0 //-----------------------------------------------------------------------// class Random_IO { fstream RandomFile; // Random access file int Status; // OPEN or CLOSED int Verbose; // Verbose flag (ON /OFF) public: Random_IO(void); ~Random_IO(void); void Initialize(long start_address, long size, char filler_char); int OpenRandom(char *file_name); void CloseRandom(void); void ReadRandom(long start_address, unsigned size, char *in_buffer); void WriteRandom(long start_address, unsigned size, char *out_buffer); void AppendRandom(unsigned size, char *out_buffer); unsigned long FileSize(); void DisplayRandom(long start_address, unsigned size); }; #endif