Overview   API Reference  

file.hpp

00001 #if !defined(__SYSTEM_FILE_HPP__)
00002 #define __SYSTEM_FILE_HPP__
00003 
00004 //
00005 // standard includes
00006 //
00007 #include <stdint.h>
00008 #include <string>
00009 
00010 //
00011 // local includes
00012 //
00013 #include "core/util/static_assert.hpp"
00014 #include "core/util/is_integer.hpp"
00015 
00019 struct file
00020 {
00024     typedef int32_t offset_t;
00025     static_assert(is_signed<offset_t>::conforms, "offset_t must be a signed integer");
00026 
00030     virtual inline ~file(void)
00031     {}
00032 
00033     //
00034     // open & close functions
00035     //
00036     virtual int open(const std::string &filename, bool readonly=false) = 0;
00037     virtual int close(void) = 0;
00038 
00039     //
00040     // query functions
00041     //
00042     virtual const char *name(void) const = 0;
00043     virtual bool is_open(void) const = 0;
00044     virtual bool is_readonly(void) const = 0;
00045     virtual offset_t size(void) const = 0;
00046 
00047     //
00048     // I/O functions
00049     //
00050     virtual offset_t read(uint8_t *buffer, offset_t offset, offset_t number) = 0;
00051     virtual offset_t write(uint8_t *buffer, offset_t offset, offset_t number) = 0;
00052     virtual int flush(void) = 0;
00053 };
00054 
00055 #endif
00056 
00057 // ***** end of source ***** //
00058 

L4vmm Reference Manual, written by Mario Schwalbe  © 2006-2008