huge_file.h

Go to the documentation of this file.
00001 #ifndef HUGE_FILE_CLASS
00002 #define HUGE_FILE_CLASS
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : huge_file                                                         *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 2007-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00019 
00026 #include "byte_filer.h"
00027 
00028 #include <basis/object_base.h>
00029 #include <basis/outcome.h>
00030 
00031 class OPSYSTEM_CLASS_STYLE huge_file
00032 {
00033 public:
00034   huge_file(const istring &filename, const istring &permissions);
00036 
00038   virtual ~huge_file();
00039 
00040   IMPLEMENT_CLASS_NAME("huge_file");
00041 
00042   enum outcomes {
00043     OKAY = common::OKAY,
00044     FAILURE = common::FAILURE,
00045     ACCESS_DENIED = common::ACCESS_DENIED,
00046     BAD_INPUT = common::BAD_INPUT
00047   };
00048 
00049   bool good() const;
00051 
00052   bool eof() const;
00054 
00055   double length();
00057 
00058   double file_pointer() const { return _file_pointer; }
00060 
00061   outcome seek(double new_position,
00062           byte_filer::origins origin = byte_filer::FROM_CURRENT);
00064 
00068   outcome move_to(double absolute_posn);
00070 
00071   outcome read(byte_array &to_fill, int desired_size, int &size_read);
00073 
00075   outcome write(const byte_array &to_write, int &size_written);
00077 
00079   bool truncate();
00081 
00082   void flush();
00084 
00085 private:
00086   byte_filer *_real_file;  
00087   double _file_pointer;  
00088 };
00089 
00090 
00091 #endif
00092 

Generated on Fri Nov 28 04:29:26 2008 for HOOPLE Libraries by  doxygen 1.5.1