Groonga 3.0.9 Source Code Document
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Pages
groonga
lib
dat
file-impl.hpp
Go to the documentation of this file.
1
/* -*- c-basic-offset: 2 -*- */
2
/* Copyright(C) 2011-2012 Brazil
3
4
This library is free software; you can redistribute it and/or
5
modify it under the terms of the GNU Lesser General Public
6
License version 2.1 as published by the Free Software Foundation.
7
8
This library is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
Lesser General Public License for more details.
12
13
You should have received a copy of the GNU Lesser General Public
14
License along with this library; if not, write to the Free Software
15
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
*/
17
18
#ifndef GRN_DAT_FILE_IMPL_HPP_
19
#define GRN_DAT_FILE_IMPL_HPP_
20
21
#ifdef WIN32
22
# include <windows.h>
23
#endif // WIN32
24
25
#include "
dat.hpp
"
26
27
namespace
grn {
28
namespace
dat {
29
30
class
FileImpl
{
31
public
:
32
FileImpl
();
33
~FileImpl
();
34
35
void
create
(
const
char
*path,
UInt64
size
);
36
void
open
(
const
char
*path);
37
void
close
();
38
39
void
*
ptr
()
const
{
40
return
ptr_;
41
}
42
UInt64
size
()
const
{
43
return
size_;
44
}
45
46
void
swap
(
FileImpl
*rhs);
47
48
private
:
49
void
*ptr_;
50
UInt64
size_;
51
52
#ifdef WIN32
53
HANDLE file_;
54
HANDLE map_;
55
LPVOID addr_;
56
#else // WIN32
57
int
fd_;
58
void
*addr_;
59
::size_t length_;
60
#endif // WIN32
61
62
void
create_(
const
char
*path,
UInt64
size);
63
void
open_(
const
char
*path);
64
65
// Disallows copy and assignment.
66
FileImpl
(
const
FileImpl
&);
67
FileImpl
&operator=(
const
FileImpl
&);
68
};
69
70
}
// namespace dat
71
}
// namespace grn
72
73
#endif // GRN_DAT_FILE_IMPL_HPP_
Generated on Sun Nov 10 2013 09:49:02 for Groonga 3.0.9 Source Code Document by
1.8.1.2