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 }
00060
00061
#endif