PLearn 0.1
|
00001 00004 #ifndef MODULE_MEMORY_MAP 00005 #define MODULE_MEMORY_MAP 00006 00007 #include <cstdlib> 00008 #include <sys/stat.h> 00009 00010 namespace PLearn { 00011 using namespace std; 00012 00013 #if !(!defined(_MSC_VER) && !defined(_MINGW_)) 00014 00016 typedef void * tFileHandle; 00017 00018 const int STORAGE_UNUSED_HANDLE = 0; 00019 00021 00031 void * memoryMap(const char *filename, tFileHandle & file_handle, bool readonly=true, int offset_=0, int length=0); 00032 00034 00042 bool memoryUnmap(void * pointer, tFileHandle file_handle); 00043 00044 #else 00045 00047 typedef int tFileHandle; 00048 const int STORAGE_UNUSED_HANDLE = -1; 00049 00050 00053 void * MemoryMap(const char *filename,tFileHandle & handle, bool read_only, off_t & filesize); 00054 00055 void memoryUnmap(void * mapped_pointer, tFileHandle handle, int length); 00056 00057 #endif 00058 00059 } // end of namespace PLearn 00060 00061 #endif //!< MODULE_MEMORY_MAP 00062 00063 00064 /* 00065 Local Variables: 00066 mode:c++ 00067 c-basic-offset:4 00068 c-file-style:"stroustrup" 00069 c-file-offsets:((innamespace . 0)(inline-open . 0)) 00070 indent-tabs-mode:nil 00071 fill-column:79 00072 End: 00073 */ 00074 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=79 :