CUBRID Engine
latest
Main Page
Namespaces
Classes
Files
File List
File Members
pinnable_buffer.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2008 Search Solution Corporation
3
* Copyright 2016 CUBRID Corporation
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*/
18
19
/*
20
* pinnable_buffer.hpp
21
*/
22
23
#ifndef _PINNABLE_BUFFER_HPP_
24
#define _PINNABLE_BUFFER_HPP_
25
26
#ident "$Id$"
27
28
#include "
dbtype.h
"
29
#include "
pinning.hpp
"
30
#include <atomic>
31
#include <vector>
32
33
/*
34
* This should serve as storage for packing / unpacking objects
35
* This is not intended to be used as character stream, but as bulk operations: users of it
36
* reserve / allocate parts of it; there are objects which deal of byte level operations (see : packer)
37
*/
38
namespace
cubmem
39
{
40
41
class
pinnable_buffer
:
public
cubbase::pinnable
42
{
43
public
:
44
pinnable_buffer
()
45
{
46
m_storage
=
NULL
;
47
m_end_ptr
=
NULL
;
48
};
49
50
pinnable_buffer
(
char
*ptr,
const
size_t
buf_size)
51
{
52
init
(ptr, buf_size,
NULL
);
53
};
54
55
~pinnable_buffer
()
56
{
57
assert
(
get_pin_count
() == 0);
58
};
59
60
char
*
get_buffer
(
void
)
61
{
62
return
m_storage
;
63
};
64
65
size_t
get_buffer_size
(
void
)
66
{
67
return
m_end_ptr
-
m_storage
;
68
};
69
70
int
init
(
char
*ptr,
const
size_t
buf_size,
cubbase::pinner
*referencer);
71
72
protected
:
73
74
/* start of allocated memory */
75
char
*
m_storage
;
76
/* end of allocated memory */
77
char
*
m_end_ptr
;
78
};
79
80
}
/* namespace mem */
81
82
#endif
/* _PINNABLE_BUFFER_HPP_ */
cubmem::pinnable_buffer::pinnable_buffer
pinnable_buffer(char *ptr, const size_t buf_size)
Definition:
pinnable_buffer.hpp:50
dbtype.h
cubmem
Definition:
extensible_array.hpp:31
cubmem::pinnable_buffer::init
int init(char *ptr, const size_t buf_size, cubbase::pinner *referencer)
Definition:
pinnable_buffer.cpp:31
cubmem::pinnable_buffer::m_storage
char * m_storage
Definition:
pinnable_buffer.hpp:75
cubbase::pinnable::get_pin_count
int get_pin_count(void)
Definition:
pinning.hpp:74
cubbase::pinnable
Definition:
pinning.hpp:59
assert
#define assert(x)
Definition:
malloc_2_8_3.c:1204
cubmem::pinnable_buffer::pinnable_buffer
pinnable_buffer()
Definition:
pinnable_buffer.hpp:44
NULL
#define NULL
Definition:
freelistheap.h:34
pinning.hpp
cubmem::pinnable_buffer
Definition:
pinnable_buffer.hpp:41
cubmem::pinnable_buffer::~pinnable_buffer
~pinnable_buffer()
Definition:
pinnable_buffer.hpp:55
cubbase::pinner
Definition:
pinning.hpp:37
cubmem::pinnable_buffer::get_buffer_size
size_t get_buffer_size(void)
Definition:
pinnable_buffer.hpp:65
cubmem::pinnable_buffer::get_buffer
char * get_buffer(void)
Definition:
pinnable_buffer.hpp:60
cubmem::pinnable_buffer::m_end_ptr
char * m_end_ptr
Definition:
pinnable_buffer.hpp:77
src
base
pinnable_buffer.hpp
Generated by
1.8.11