MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
DLCFifoList.hpp
1
/*
2
Copyright (C) 2005, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
3
All rights reserved. Use is subject to license terms.
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; version 2 of the License.
8
9
This program is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with this program; if not, write to the Free Software
16
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
*/
18
19
#ifndef DLC_FIFOLIST_HPP
20
#define DLC_FIFOLIST_HPP
21
22
#include "DLFifoList.hpp"
23
#include <NdbOut.hpp>
24
25
// Adds "count" to DLFifoList
26
template
<
class
T,
class
U = T>
27
class
DLCFifoList
:
protected
DLFifoList
<T, U> {
28
public
:
29
// List head
30
struct
Head
:
public
DLFifoList
<T, U>
::Head
{
31
Head
() : m_count(0) {}
32
Uint32 m_count;
33
};
34
35
// Ctor
36
DLCFifoList
(
ArrayPool<T>
& thePool) :
37
DLFifoList
<T,
U
>(thePool)
38
{}
39
40
// Get count
41
Uint32 count()
const
{
return
head.m_count; }
42
43
// Redefine methods which do add or remove
44
45
bool
seize(
Ptr<T>
& ptr) {
46
if
(
DLFifoList<T, U>::seize
(ptr)) {
47
head.m_count++;
48
return
true
;
49
}
50
return
false
;
51
}
52
53
bool
seizeFirst(
Ptr<T>
& ptr) {
54
if
(
DLFifoList<T, U>::seizeFirst
(ptr)) {
55
head.m_count++;
56
return
true
;
57
}
58
return
false
;
59
}
60
bool
seizeLast(
Ptr<T>
& ptr) {
61
if
(
DLFifoList<T, U>::seizeLast
(ptr)) {
62
head.m_count++;
63
return
true
;
64
}
65
return
false
;
66
}
67
68
bool
seizeId(
Ptr<T>
& ptr, Uint32
i
) {
69
if
(
DLFifoList<T, U>::seizeId
(ptr)) {
70
head.m_count++;
71
return
true
;
72
}
73
return
false
;
74
}
75
76
void
add(
Ptr<T>
& ptr) {
77
DLFifoList<T, U>::add
(ptr);
78
head.m_count++;
79
}
80
81
void
addFirst(
Ptr<T>
& ptr) {
82
DLFifoList<T, U>::addFirst
(ptr);
83
head.m_count++;
84
}
85
86
void
addLast(
Ptr<T>
& ptr) {
87
DLFifoList<T, U>::addLast
(ptr);
88
head.m_count++;
89
}
90
91
void
insert
(
Ptr<T>
& ptr,
Ptr<T>
& loc) {
92
DLFifoList<T, U>::insert
(ptr, loc);
93
head.m_count++;
94
}
95
96
void
remove
(T* t) {
97
DLFifoList<T, U>::remove
(t);
98
head.m_count--;
99
}
100
101
void
remove
(
Ptr<T>
& ptr) {
102
DLFifoList<T, U>::remove
(ptr);
103
head.m_count--;
104
}
105
106
void
release(Uint32 i) {
107
DLFifoList<T, U>::release
(i);
108
head.m_count--;
109
}
110
111
void
release(
Ptr<T>
& ptr) {
112
DLFifoList<T, U>::release
(ptr);
113
head.m_count--;
114
}
115
116
void
release() {
117
DLFifoList<T, U>::release
();
118
head.m_count = 0;
119
}
120
121
void
getPtr
(
Ptr<T>
& ptr, Uint32 i)
const
{
122
DLFifoList<T, U>::getPtr
(ptr, i);
123
}
124
125
void
getPtr
(
Ptr<T>
& ptr)
const
{
126
DLFifoList<T, U>::getPtr
(ptr);
127
}
128
129
T *
getPtr
(Uint32 i)
const
{
130
return
DLFifoList<T, U>::getPtr
(i);
131
}
132
133
bool
first
(
Ptr<T>
& ptr)
const
{
134
return
DLFifoList<T, U>::first
(ptr);
135
}
136
137
bool
last
(
Ptr<T>
& ptr)
const
{
138
return
DLFifoList<T, U>::last
(ptr);
139
}
140
141
bool
next
(
Ptr<T>
& ptr)
const
{
142
return
DLFifoList<T, U>::next
(ptr);
143
}
144
145
bool
prev
(
Ptr<T>
& ptr)
const
{
146
return
DLFifoList<T, U>::prev
(ptr);
147
}
148
149
bool
hasNext
(
const
Ptr<T>
& ptr)
const
{
150
return
DLFifoList<T, U>::hasNext
(ptr);
151
}
152
153
bool
hasPrev
(
const
Ptr<T>
& ptr)
const
{
154
return
DLFifoList<T, U>::hasPrev
(ptr);
155
}
156
157
inline
bool
isEmpty()
const
{
158
return
DLFifoList<T, U>::isEmpty
();
159
}
160
161
DLCFifoList<T>
& operator=(
const
DLCFifoList<T>
& src){
162
assert(&this->thePool == &src.thePool);
163
this->head = src.head;
164
return
*
this
;
165
}
166
167
protected
:
168
Head head;
169
};
170
171
// Local variant
172
template
<
class
T,
class
U = T>
173
class
LocalDLCFifoList
:
public
DLCFifoList
<T, U> {
174
public
:
175
LocalDLCFifoList
(
ArrayPool<T>
& thePool,
176
typename
DLCFifoList<T, U>::Head
&_src)
177
:
DLCFifoList<T, U>
(thePool), src(_src)
178
{
179
this->head = src;
180
#ifdef VM_TRACE
181
assert(src.in_use ==
false
);
182
src.in_use =
true
;
183
#endif
184
}
185
186
~
LocalDLCFifoList
() {
187
#ifdef VM_TRACE
188
assert(src.in_use ==
true
);
189
#endif
190
src = this->head;
191
}
192
private
:
193
typename
DLCFifoList<T, U>::Head
& src;
194
};
195
196
#endif
storage
ndb
src
kernel
vm
DLCFifoList.hpp
Generated on Sat Nov 9 2013 01:27:57 for MySQL 5.6.14 Source Code Document by
1.8.1.2