MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ArrayPool< T > Class Template Reference

#include <ArrayPool.hpp>

Inheritance diagram for ArrayPool< T >:
Collaboration diagram for ArrayPool< T >:

Classes

struct  Cache
struct  LockFun

Public Member Functions

bool setSize (Uint32 noOfElements, bool align=false, bool exit_on_error=true, bool guard=true, Uint32 paramId=0)
bool set (T *, Uint32 cnt, bool align=false)
void clear ()
Uint32 getNoOfFree () const
Uint32 getSize () const
Uint32 getUsed () const
Uint32 getUsedHi () const
void updateFreeMin (void)
void decNoFree (void)
void decNoFree (Uint32 cnt)
Uint32 getEntrySize () const
void getPtr (Ptr< T > &)
void getPtr (ConstPtr< T > &) const
void getPtr (Ptr< T > &, bool CrashOnBoundaryError)
void getPtr (ConstPtr< T > &, bool CrashOnBoundaryError) const
T * getPtr (Uint32 i)
const T * getConstPtr (Uint32 i) const
T * getPtr (Uint32 i, bool CrashOnBoundaryError)
const T * getConstPtr (Uint32 i, bool CrashOnBoundaryError) const
void getPtr (Ptr< T > &, Uint32 i)
void getPtr (ConstPtr< T > &, Uint32 i) const
void getPtr (Ptr< T > &, Uint32 i, bool CrashOnBoundaryError)
void getPtr (ConstPtr< T > &, Uint32 i, bool CrashOnBoundaryError) const
bool seize (Ptr< T > &)
bool seizeId (Ptr< T > &, Uint32 i)
bool findId (Uint32 i) const
void release (Uint32 i)
void release (Ptr< T > &)
bool seize (LockFun, Cache &, Ptr< T > &)
void release (LockFun, Cache &, Uint32 i)
void release (LockFun, Cache &, Ptr< T > &)
void releaseList (LockFun, Cache &, Uint32 n, Uint32 first, Uint32 last)
void setChunkSize (Uint32 sz)
void releaseList (Uint32 n, Uint32 first, Uint32 last)

Protected Member Functions

void releaseChunk (LockFun, Cache &, Uint32 n)
bool seizeChunk (Uint32 &n, Ptr< T > &)
void releaseChunk (Uint32 n, Uint32 first, Uint32 last)
Uint32 seizeN (Uint32 n)
void releaseN (Uint32 base, Uint32 n)

Protected Attributes

Uint32 firstFree
Uint32 size
Uint32 noOfFree
Uint32 noOfFreeMin
T * theArray
void * alloc_ptr

Friends

class Array< T >

Detailed Description

template<class T>
class ArrayPool< T >

Template class used for implementing an pool of object (in an array with a free list)

Definition at line 43 of file ArrayPool.hpp.

Member Function Documentation

template<class T >
bool ArrayPool< T >::findId ( Uint32  i) const
inline

Check if i is allocated.

Definition at line 808 of file ArrayPool.hpp.

Here is the caller graph for this function:

template<class T>
void ArrayPool< T >::getPtr ( Ptr< T > &  ptr)
inline

Update p value for ptr according to i value

Definition at line 439 of file ArrayPool.hpp.

Here is the call graph for this function:

template<class T>
T * ArrayPool< T >::getPtr ( Uint32  i)
inline

Get pointer for i value

Definition at line 531 of file ArrayPool.hpp.

Here is the call graph for this function:

template<class T>
void ArrayPool< T >::getPtr ( Ptr< T > &  ptr,
Uint32  i 
)
inline

Update p & i value for ptr according to i value

Definition at line 485 of file ArrayPool.hpp.

Here is the call graph for this function:

template<class T >
void ArrayPool< T >::release ( Uint32  _i)
inline

Return an object to pool

Reimplemented in SafeArrayPool< T >, and SafeArrayPool< GlobalPage >.

Definition at line 955 of file ArrayPool.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
void ArrayPool< T >::release ( Ptr< T > &  ptr)
inline

Return an object to pool

Reimplemented in SafeArrayPool< T >, and SafeArrayPool< GlobalPage >.

Definition at line 993 of file ArrayPool.hpp.

Here is the call graph for this function:

template<class T >
void ArrayPool< T >::releaseList ( Uint32  n,
Uint32  first,
Uint32  last 
)
inline

Release a singel linked list in o(1)

Parameters
firsti-value of first element in list
lasti-value of last element in list
Note
nextPool must be used as next pointer in list

Definition at line 911 of file ArrayPool.hpp.

Here is the call graph for this function:

template<class T >
void ArrayPool< T >::releaseN ( Uint32  base,
Uint32  n 
)
inlineprotected

Deallocate n consecutive object to pool starting from base

Definition at line 870 of file ArrayPool.hpp.

Here is the call graph for this function:

template<class T>
bool ArrayPool< T >::seize ( Ptr< T > &  ptr)
inline

Allocate an object from pool - update Ptr

Return i

Reimplemented in SafeArrayPool< T >, and SafeArrayPool< GlobalPage >.

Definition at line 723 of file ArrayPool.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T>
bool ArrayPool< T >::seizeId ( Ptr< T > &  ptr,
Uint32  i 
)
inline

Allocate object i from pool - update Ptr

Definition at line 761 of file ArrayPool.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:

template<class T >
Uint32 ArrayPool< T >::seizeN ( Uint32  n)
protected

Allocate n consecutive object from pool return base

Definition at line 820 of file ArrayPool.hpp.

Here is the call graph for this function:

template<class T >
bool ArrayPool< T >::setSize ( Uint32  noOfElements,
bool  align = false,
bool  exit_on_error = true,
bool  guard = true,
Uint32  paramId = 0 
)
inline

Set the size of the pool

Note, can currently only be called once

Set next pointers

Definition at line 302 of file ArrayPool.hpp.

Here is the call graph for this function:

Here is the caller graph for this function:


The documentation for this class was generated from the following file: