21 #include <ndb_global.h>
22 #include <kernel_types.h>
35 #define RG_MASK ((1 << RG_BITS) - 1)
36 #define MAKE_TID(TID,RG) ((TID << RG_BITS) | RG)
41 #define POOL_RECORD_BITS 13
42 #define POOL_RECORD_MASK ((1 << POOL_RECORD_BITS) - 1)
52 Uint16 m_offset_next_pool;
53 Uint16 m_offset_magic;
107 void*
alloc_pages(Uint32 type_id, Uint32 *i, Uint32 *cnt, Uint32 min =1);
124 template <
typename T>
129 inline bool isNull()
const {
return i == RNIL; }
130 inline void setNull() { i = RNIL; }
133 template <
typename T>
138 inline bool isNull()
const {
return i == RNIL; }
139 inline void setNull() { i = RNIL; }
142 #ifdef XX_DOCUMENTATION_XX
156 void * getPtr(Uint32
i);
163 template <
typename T,
typename P>
170 void wo_pool_init(Uint32 type_id,
const Pool_context& pc);
183 const T * getConstPtr(Uint32 i)
const;
216 template <
typename T,
typename P>
222 template <
typename T,
typename P>
228 const char * off_base = (
char*)&tmp;
229 const char * off_next = (
char*)&tmp.nextPool;
230 const char * off_magic = (
char*)&tmp.m_magic;
233 ri.m_size =
sizeof(T);
234 ri.m_offset_next_pool = Uint32(off_next - off_base);
235 ri.m_offset_magic = Uint32(off_magic - off_base);
236 ri.m_type_id = type_id;
240 template <
typename T,
typename P>
246 const char * off_base = (
char*)&tmp;
247 const char * off_magic = (
char*)&tmp.m_magic;
250 ri.m_size =
sizeof(T);
251 ri.m_offset_next_pool = 0;
252 ri.m_offset_magic = Uint32(off_magic - off_base);
253 ri.m_type_id = type_id;
257 template <
typename T,
typename P>
264 const char * off_base = (
char*)&tmp;
265 const char * off_next = (
char*)&tmp.nextPool;
266 const char * off_magic = (
char*)&tmp.m_magic;
269 ri.m_size =
sizeof(T);
270 ri.m_offset_next_pool = Uint32(off_next - off_base);
271 ri.m_offset_magic = Uint32(off_magic - off_base);
272 ri.m_type_id = type_id;
273 m_pool.init(alloc, ri, pc);
277 template <
typename T,
typename P>
284 template <
typename T,
typename P>
289 ptr.p =
static_cast<T*
>(m_pool.getPtr(ptr.i));
292 template <
typename T,
typename P>
297 ptr.p =
static_cast<const T*
>(m_pool.getPtr(ptr.i));
300 template <
typename T,
typename P>
306 ptr.p =
static_cast<T*
>(m_pool.getPtr(ptr.i));
309 template <
typename T,
typename P>
315 ptr.p =
static_cast<const T*
>(m_pool.getPtr(ptr.i));
318 template <
typename T,
typename P>
323 return static_cast<T*
>(m_pool.getPtr(i));
326 template <
typename T,
typename P>
331 return static_cast<const T*
>(m_pool.getPtr(i));
334 template <
typename T,
typename P>
340 bool ret = m_pool.seize(tmp);
344 ptr.p =
static_cast<T*
>(tmp.p);
349 template <
typename T,
typename P>
355 bool ret = m_pool.seize(ah, tmp);
359 ptr.p =
static_cast<T*
>(tmp.p);
364 template <
typename T,
typename P>
371 ptr.p = m_pool.getPtr(i);
375 template <
typename T,
typename P>