Below is the list of changes that have just been committed into a local
5.1 repository of jonas. When jonas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2068 06/01/31 06:54:20 jonas@eel.(none) +8 -0
wl1497 - ndb mem - patch 2/3 -
Make pool type template argument to container classes
This so that ArrayPool and RecordPool can co-exist
storage/ndb/src/kernel/vm/SLList.hpp
1.6 06/01/31 06:54:15 jonas@eel.(none) +56 -40
Make pool type template argument
storage/ndb/src/kernel/vm/KeyTable.hpp
1.3 06/01/31 06:54:15 jonas@eel.(none) +14 -6
Make pool type template argument
storage/ndb/src/kernel/vm/DLList.hpp
1.6 06/01/31 06:54:15 jonas@eel.(none) +64 -48
Make pool type template argument
storage/ndb/src/kernel/vm/DLHashTable2.hpp
1.5 06/01/31 06:54:15 jonas@eel.(none) +53 -45
Make pool type template argument
storage/ndb/src/kernel/vm/DLHashTable.hpp
1.6 06/01/31 06:54:15 jonas@eel.(none) +52 -44
Make pool type template argument
storage/ndb/src/kernel/vm/DLFifoList.hpp
1.6 06/01/31 06:54:15 jonas@eel.(none) +66 -50
Make pool type template argument
storage/ndb/src/kernel/vm/DLCHashTable.hpp
1.2 06/01/31 06:54:15 jonas@eel.(none) +21 -12
Make pool type template argument
storage/ndb/src/kernel/vm/DLCFifoList.hpp
1.2 06/01/31 06:54:15 jonas@eel.(none) +37 -20
Make pool type template argument
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jonas
# Host: eel.(none)
# Root: /home/jonas/src/51-ndb
--- 1.1/storage/ndb/src/kernel/vm/DLCFifoList.hpp 2005-11-07 12:19:16 +01:00
+++ 1.2/storage/ndb/src/kernel/vm/DLCFifoList.hpp 2006-01-31 06:54:15 +01:00
@@ -21,18 +21,18 @@
#include <NdbOut.hpp>
// Adds "count" to DLFifoList
-template <class T, class U = T>
-class DLCFifoList : public DLFifoList<T, U> {
+template <typename P, typename T, typename U = T>
+class DLCFifoListImpl : public DLFifoListImpl<P, T, U> {
public:
// List head
- struct Head : public DLFifoList<T, U>::Head {
+ struct Head : public DLFifoListImpl<P, T, U>::Head {
Head() : m_count(0) {}
Uint32 m_count;
};
// Ctor
- DLCFifoList(ArrayPool<T> & thePool) :
- DLFifoList<T, U>(thePool)
+ DLCFifoListImpl(P & thePool) :
+ DLFifoListImpl<P, T, U>(thePool)
{}
// Get count
@@ -41,7 +41,7 @@
// Redefine methods which do add or remove
bool seize(Ptr<T>& ptr) {
- if (DLFifoList<T, U>::seize(ptr)) {
+ if (DLFifoListImpl<P, T, U>::seize(ptr)) {
head.m_count++;
return true;
}
@@ -49,7 +49,7 @@
}
bool seizeId(Ptr<T>& ptr, Uint32 i) {
- if (DLFifoList<T, U>::seizeId(ptr)) {
+ if (DLFifoListImpl<P, T, U>::seizeId(ptr)) {
head.m_count++;
return true;
}
@@ -57,31 +57,31 @@
}
void add(Ptr<T>& ptr) {
- DLFifoList<T, U>::add(ptr);
+ DLFifoListImpl<P, T, U>::add(ptr);
head.m_count++;
}
void remove(Ptr<T>& ptr) {
- DLFifoList<T, U>::remove(ptr);
+ DLFifoListImpl<P, T, U>::remove(ptr);
head.m_count--;
}
void release(Uint32 i) {
- DLFifoList<T, U>::release(i);
+ DLFifoListImpl<P, T, U>::release(i);
head.m_count--;
}
void release(Ptr<T>& ptr) {
- DLFifoList<T, U>::release(ptr);
+ DLFifoListImpl<P, T, U>::release(ptr);
head.m_count--;
}
void release() {
- DLFifoList<T, U>::release();
+ DLFifoListImpl<P, T, U>::release();
head.m_count = 0;
}
- DLCFifoList<T>& operator=(const DLCFifoList<T>& src){
+ DLCFifoListImpl<P, T, U>& operator=(const DLCFifoListImpl<P,T,U>& src){
assert(&this->thePool == &src.thePool);
this->head = src.head;
return * this;
@@ -92,12 +92,12 @@
};
// Local variant
-template <class T, class U = T>
-class LocalDLCFifoList : public DLCFifoList<T, U> {
+template <typename P, typename T, typename U = T>
+class LocalDLCFifoListImpl : public DLCFifoListImpl<P, T, U> {
public:
- LocalDLCFifoList(ArrayPool<T> & thePool,
- typename DLCFifoList<T, U>::Head &_src)
- : DLCFifoList<T, U>(thePool), src(_src)
+ LocalDLCFifoListImpl(P & thePool,
+ typename DLCFifoListImpl<P, T, U>::Head &_src)
+ : DLCFifoListImpl<P, T, U>(thePool), src(_src)
{
this->head = src;
#ifdef VM_TRACE
@@ -106,14 +106,31 @@
#endif
}
- ~LocalDLCFifoList() {
+ ~LocalDLCFifoListImpl() {
#ifdef VM_TRACE
assert(src.in_use == true);
#endif
src = this->head;
}
private:
- typename DLCFifoList<T, U>::Head & src;
+ typename DLCFifoListImpl<P, T, U>::Head & src;
};
+
+// Specializations
+
+template <typename T, typename U = T>
+class DLCFifoList : public DLCFifoListImpl<ArrayPool<T>, T, U>
+{
+public:
+ DLCFifoList(ArrayPool<T>& p) : DLCFifoListImpl<ArrayPool<T>, T, U>(p) {}
+};
+
+template <typename T, typename U = T>
+class LocalDLCFifoList : public LocalDLCFifoListImpl<ArrayPool<T>,T,U> {
+public:
+ LocalDLCFifoList(ArrayPool<T> & p, typename DLCFifoList<T,U>::Head & _src)
+ : LocalDLCFifoListImpl<ArrayPool<T>, T,U>(p, _src) {}
+};
+
#endif
--- 1.1/storage/ndb/src/kernel/vm/DLCHashTable.hpp 2005-11-07 12:19:16 +01:00
+++ 1.2/storage/ndb/src/kernel/vm/DLCHashTable.hpp 2006-01-31 06:54:15 +01:00
@@ -21,12 +21,12 @@
#include "DLHashTable.hpp"
// Adds "count" to DLHashTable
-template <class T, class U = T>
-class DLCHashTable : public DLHashTable<T, U> {
+template <typename P, typename T, typename U = T>
+class DLCHashTableImpl : public DLHashTableImpl<P, T, U> {
public:
// Ctor
- DLCHashTable(ArrayPool<T> & thePool) :
- DLHashTable<T, U>(thePool),
+ DLCHashTableImpl(P & thePool) :
+ DLHashTableImpl<P, T, U>(thePool),
m_count(0)
{}
@@ -36,47 +36,56 @@
// Redefine methods which do add or remove
void add(Ptr<T>& ptr) {
- DLHashTable<T, U>::add(ptr);
+ DLHashTableImpl<P, T, U>::add(ptr);
m_count++;
}
void remove(Ptr<T>& ptr, const T & key) {
- DLHashTable<T, U>::remove(ptr, key);
+ DLHashTableImpl<P, T, U>::remove(ptr, key);
m_count--;
}
void remove(Uint32 i) {
- DLHashTable<T, U>::remove(i);
+ DLHashTableImpl<P, T, U>::remove(i);
m_count--;
}
void remove(Ptr<T>& ptr) {
- DLHashTable<T, U>::remove(ptr);
+ DLHashTableImpl<P, T, U>::remove(ptr);
m_count--;
}
void removeAll() {
- DLHashTable<T, U>::removeAll();
+ DLHashTableImpl<P, T, U>::removeAll();
m_count = 0;
}
void release(Ptr<T>& ptr, const T & key) {
- DLHashTable<T, U>::release(ptr, key);
+ DLHashTableImpl<P, T, U>::release(ptr, key);
m_count--;
}
void release(Uint32 i) {
- DLHashTable<T, U>::release(i);
+ DLHashTableImpl<P, T, U>::release(i);
m_count--;
}
void release(Ptr<T>& ptr) {
- DLHashTable<T, U>::release(ptr);
+ DLHashTableImpl<P, T, U>::release(ptr);
m_count--;
}
private:
Uint32 m_count;
+};
+
+// Specializations
+
+template <typename T, typename U = T>
+class DLCHashTable : public DLCHashTableImpl<ArrayPool<T>, T, U>
+{
+public:
+ DLCHashTable(ArrayPool<T> & p) : DLCHashTableImpl<ArrayPool<T>, T, U>(p){}
};
#endif
--- 1.5/storage/ndb/src/kernel/vm/DLFifoList.hpp 2005-11-07 12:19:08 +01:00
+++ 1.6/storage/ndb/src/kernel/vm/DLFifoList.hpp 2006-01-31 06:54:15 +01:00
@@ -24,8 +24,8 @@
* Template class used for implementing an
* list of object retreived from a pool
*/
-template <class T, class U = T>
-class DLFifoList {
+template <typename P, typename T, typename U = T>
+class DLFifoListImpl {
public:
/**
* List head
@@ -42,7 +42,7 @@
inline bool isEmpty() const { return firstItem == RNIL;}
};
- DLFifoList(ArrayPool<T> & thePool);
+ DLFifoListImpl(P & thePool);
/**
* Allocate an object from pool - update Ptr
@@ -180,7 +180,7 @@
* Copy list (head)
* Will construct to identical lists
*/
- DLFifoList<T>& operator=(const DLFifoList<T>& src){
+ DLFifoListImpl<P,T,U>& operator=(const DLFifoListImpl<P,T,U>& src){
assert(&thePool == &src.thePool);
this->head = src.head;
return * this;
@@ -188,14 +188,14 @@
protected:
Head head;
- ArrayPool<T> & thePool;
+ P & thePool;
};
-template <class T, class U = T>
-class LocalDLFifoList : public DLFifoList<T,U> {
+template <typename P, typename T, typename U = T>
+class LocalDLFifoListImpl : public DLFifoListImpl<P,T,U> {
public:
- LocalDLFifoList(ArrayPool<T> & thePool, typename DLFifoList<T,U>::Head &_src)
- : DLFifoList<T,U>(thePool), src(_src)
+ LocalDLFifoListImpl(P & thePool, typename DLFifoListImpl<P,T,U>::Head &_src)
+ : DLFifoListImpl<P,T,U>(thePool), src(_src)
{
this->head = src;
#ifdef VM_TRACE
@@ -204,25 +204,25 @@
#endif
}
- ~LocalDLFifoList(){
+ ~LocalDLFifoListImpl(){
#ifdef VM_TRACE
assert(src.in_use == true);
#endif
src = this->head;
}
private:
- typename DLFifoList<T,U>::Head & src;
+ typename DLFifoListImpl<P,T,U>::Head & src;
};
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
-DLFifoList<T,U>::DLFifoList(ArrayPool<T> & _pool):
+DLFifoListImpl<P,T,U>::DLFifoListImpl(P & _pool):
thePool(_pool){
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
-DLFifoList<T,U>::Head::Head(){
+DLFifoListImpl<P,T,U>::Head::Head(){
firstItem = RNIL;
lastItem = RNIL;
#ifdef VM_TRACE
@@ -235,10 +235,10 @@
*
* Return i
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLFifoList<T,U>::seize(Ptr<T> & p){
+DLFifoListImpl<P,T,U>::seize(Ptr<T> & p){
thePool.seize(p);
if (p.i != RNIL) {
add(p);
@@ -253,10 +253,10 @@
*
* Return i
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLFifoList<T,U>::seizeId(Ptr<T> & p, Uint32 ir){
+DLFifoListImpl<P,T,U>::seizeId(Ptr<T> & p, Uint32 ir){
thePool.seizeId(p, ir);
if(p.i != RNIL){
add(p);
@@ -266,15 +266,15 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLFifoList<T,U>::add(Ptr<T> & p){
+DLFifoListImpl<P,T,U>::add(Ptr<T> & p){
T * t = p.p;
Uint32 last = head.lastItem;
if(p.i == RNIL)
- ErrorReporter::handleAssert("DLFifoList<T,U>::add", __FILE__, __LINE__);
+ ErrorReporter::handleAssert("DLFifoListImpl<P,T,U>::add", __FILE__, __LINE__);
t->U::nextList = RNIL;
t->U::prevList = last;
@@ -288,10 +288,10 @@
}
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLFifoList<T,U>::insert(Ptr<T> & ptr, Ptr<T> & loc){
+DLFifoListImpl<P,T,U>::insert(Ptr<T> & ptr, Ptr<T> & loc){
Uint32 prev= loc.p->U::prevList;
if(loc.i == head.firstItem)
{
@@ -312,20 +312,20 @@
/**
* Return an object to pool
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLFifoList<T,U>::release(Uint32 i){
+DLFifoListImpl<P,T,U>::release(Uint32 i){
Ptr<T> p;
p.i = i;
p.p = thePool.getPtr(i);
release(p);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLFifoList<T,U>::remove(Ptr<T> & p){
+DLFifoListImpl<P,T,U>::remove(Ptr<T> & p){
T * t = p.p;
Uint32 ni = t->U::nextList;
Uint32 pi = t->U::prevList;
@@ -350,18 +350,18 @@
/**
* Return an object to pool
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLFifoList<T,U>::release(Ptr<T> & p){
+DLFifoListImpl<P,T,U>::release(Ptr<T> & p){
remove(p);
thePool.release(p.i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLFifoList<T,U>::release(){
+DLFifoListImpl<P,T,U>::release(){
Ptr<T> p;
while(head.firstItem != RNIL){
p.i = head.firstItem;
@@ -372,25 +372,25 @@
}
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLFifoList<T,U>::getPtr(Ptr<T> & p, Uint32 i) const {
+DLFifoListImpl<P,T,U>::getPtr(Ptr<T> & p, Uint32 i) const {
p.i = i;
p.p = thePool.getPtr(i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLFifoList<T,U>::getPtr(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::getPtr(Ptr<T> & p) const {
thePool.getPtr(p);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
T *
-DLFifoList<T,U>::getPtr(Uint32 i) const {
+DLFifoListImpl<P,T,U>::getPtr(Uint32 i) const {
return thePool.getPtr(i);
}
@@ -399,10 +399,10 @@
*
* Return i
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLFifoList<T,U>::first(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::first(Ptr<T> & p) const {
p.i = head.firstItem;
if(p.i != RNIL){
p.p = thePool.getPtr(p.i);
@@ -412,10 +412,10 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLFifoList<T,U>::last(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::last(Ptr<T> & p) const {
p.i = head.lastItem;
if(p.i != RNIL){
p.p = thePool.getPtr(p.i);
@@ -425,10 +425,10 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLFifoList<T,U>::next(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::next(Ptr<T> & p) const {
p.i = p.p->U::nextList;
if(p.i != RNIL){
p.p = thePool.getPtr(p.i);
@@ -438,10 +438,10 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLFifoList<T,U>::prev(Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::prev(Ptr<T> & p) const {
p.i = p.p->U::prevList;
if(p.i != RNIL){
p.p = thePool.getPtr(p.i);
@@ -451,18 +451,34 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLFifoList<T,U>::hasNext(const Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::hasNext(const Ptr<T> & p) const {
return p.p->U::nextList != RNIL;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLFifoList<T,U>::hasPrev(const Ptr<T> & p) const {
+DLFifoListImpl<P,T,U>::hasPrev(const Ptr<T> & p) const {
return p.p->U::prevList != RNIL;
}
+
+// Specializations
+
+template <typename T, typename U = T>
+class DLFifoList : public DLFifoListImpl<ArrayPool<T>, T, U>
+{
+public:
+ DLFifoList(ArrayPool<T> & p) : DLFifoListImpl<ArrayPool<T>, T, U>(p) {}
+};
+
+template <typename T, typename U = T>
+class LocalDLFifoList : public LocalDLFifoListImpl<ArrayPool<T>,T,U> {
+public:
+ LocalDLFifoList(ArrayPool<T> & p, typename DLFifoList<T,U>::Head & _src)
+ : LocalDLFifoListImpl<ArrayPool<T>,T,U>(p, _src) {}
+};
#endif
--- 1.5/storage/ndb/src/kernel/vm/DLHashTable.hpp 2005-11-07 12:19:08 +01:00
+++ 1.6/storage/ndb/src/kernel/vm/DLHashTable.hpp 2006-01-31 06:54:15 +01:00
@@ -18,7 +18,7 @@
#define DL_HASHTABLE_HPP
#include <ndb_global.h>
-#include "ArrayList.hpp"
+#include "ArrayPool.hpp"
/**
* DLHashTable implements a hashtable using chaining
@@ -30,11 +30,11 @@
* -# Uint32 hashValue() const;
* Which should return a 32 bit hashvalue
*/
-template <class T, class U = T>
-class DLHashTable {
+template <typename P, typename T, typename U = T>
+class DLHashTableImpl {
public:
- DLHashTable(ArrayPool<T> & thePool);
- ~DLHashTable();
+ DLHashTableImpl(P & thePool);
+ ~DLHashTableImpl();
/**
* Set the no of bucket in the hashtable
@@ -153,29 +153,29 @@
private:
Uint32 mask;
Uint32 * hashValues;
- ArrayPool<T> & thePool;
+ P & thePool;
};
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
-DLHashTable<T,U>::DLHashTable(ArrayPool<T> & _pool)
+DLHashTableImpl<P,T,U>::DLHashTableImpl(P & _pool)
: thePool(_pool)
{
mask = 0;
hashValues = 0;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
-DLHashTable<T,U>::~DLHashTable(){
+DLHashTableImpl<P,T,U>::~DLHashTableImpl(){
if(hashValues != 0)
delete [] hashValues;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLHashTable<T,U>::setSize(Uint32 size){
+DLHashTableImpl<P,T,U>::setSize(Uint32 size){
Uint32 i = 1;
while(i < size) i *= 2;
@@ -201,10 +201,10 @@
return true;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::add(Ptr<T> & obj){
+DLHashTableImpl<P,T,U>::add(Ptr<T> & obj){
const Uint32 hv = obj.p->hashValue() & mask;
const Uint32 i = hashValues[hv];
@@ -226,10 +226,10 @@
/**
* First element
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLHashTable<T,U>::first(Iterator & iter) const {
+DLHashTableImpl<P,T,U>::first(Iterator & iter) const {
Uint32 i = 0;
while(i <= mask && hashValues[i] == RNIL) i++;
if(i <= mask){
@@ -243,10 +243,10 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLHashTable<T,U>::next(Iterator & iter) const {
+DLHashTableImpl<P,T,U>::next(Iterator & iter) const {
if(iter.curr.p->U::nextHash == RNIL){
Uint32 i = iter.bucket + 1;
while(i <= mask && hashValues[i] == RNIL) i++;
@@ -266,10 +266,10 @@
return true;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::remove(Ptr<T> & ptr, const T & key){
+DLHashTableImpl<P,T,U>::remove(Ptr<T> & ptr, const T & key){
const Uint32 hv = key.hashValue() & mask;
Uint32 i;
@@ -304,10 +304,10 @@
ptr.i = RNIL;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::release(Ptr<T> & ptr, const T & key){
+DLHashTableImpl<P,T,U>::release(Ptr<T> & ptr, const T & key){
const Uint32 hv = key.hashValue() & mask;
Uint32 i;
@@ -343,30 +343,30 @@
ptr.i = RNIL;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::remove(Uint32 i){
+DLHashTableImpl<P,T,U>::remove(Uint32 i){
Ptr<T> tmp;
tmp.i = i;
tmp.p = thePool.getPtr(i);
remove(tmp);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::release(Uint32 i){
+DLHashTableImpl<P,T,U>::release(Uint32 i){
Ptr<T> tmp;
tmp.i = i;
tmp.p = thePool.getPtr(i);
release(tmp);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::remove(Ptr<T> & ptr){
+DLHashTableImpl<P,T,U>::remove(Ptr<T> & ptr){
const Uint32 next = ptr.p->U::nextHash;
const Uint32 prev = ptr.p->U::prevHash;
@@ -384,10 +384,10 @@
}
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::release(Ptr<T> & ptr){
+DLHashTableImpl<P,T,U>::release(Ptr<T> & ptr){
const Uint32 next = ptr.p->U::nextHash;
const Uint32 prev = ptr.p->U::prevHash;
@@ -407,18 +407,18 @@
thePool.release(ptr.i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::removeAll(){
+DLHashTableImpl<P,T,U>::removeAll(){
for(Uint32 i = 0; i<=mask; i++)
hashValues[i] = RNIL;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLHashTable<T,U>::next(Uint32 bucket, Iterator & iter) const {
+DLHashTableImpl<P,T,U>::next(Uint32 bucket, Iterator & iter) const {
while (bucket <= mask && hashValues[bucket] == RNIL)
bucket++;
@@ -434,10 +434,10 @@
return true;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLHashTable<T,U>::seize(Ptr<T> & ptr){
+DLHashTableImpl<P,T,U>::seize(Ptr<T> & ptr){
if(thePool.seize(ptr)){
ptr.p->U::nextHash = ptr.p->U::prevHash = RNIL;
return true;
@@ -445,32 +445,32 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::getPtr(Ptr<T> & ptr, Uint32 i) const {
+DLHashTableImpl<P,T,U>::getPtr(Ptr<T> & ptr, Uint32 i) const {
ptr.i = i;
ptr.p = thePool.getPtr(i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLHashTable<T,U>::getPtr(Ptr<T> & ptr) const {
+DLHashTableImpl<P,T,U>::getPtr(Ptr<T> & ptr) const {
thePool.getPtr(ptr);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
T *
-DLHashTable<T,U>::getPtr(Uint32 i) const {
+DLHashTableImpl<P,T,U>::getPtr(Uint32 i) const {
return thePool.getPtr(i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLHashTable<T,U>::find(Ptr<T> & ptr, const T & key) const {
+DLHashTableImpl<P,T,U>::find(Ptr<T> & ptr, const T & key) const {
const Uint32 hv = key.hashValue() & mask;
Uint32 i;
@@ -490,4 +490,12 @@
ptr.p = NULL;
return false;
}
+
+template <typename T, typename U = T>
+class DLHashTable : public DLHashTableImpl<ArrayPool<T>, T, U>
+{
+public:
+ DLHashTable(ArrayPool<T> & p) : DLHashTableImpl<ArrayPool<T>, T, U>(p){}
+};
+
#endif
--- 1.4/storage/ndb/src/kernel/vm/DLHashTable2.hpp 2005-04-08 02:44:06 +02:00
+++ 1.5/storage/ndb/src/kernel/vm/DLHashTable2.hpp 2006-01-31 06:54:15 +01:00
@@ -19,8 +19,6 @@
#include <ndb_global.h>
-#include "ArrayList.hpp"
-
/**
* DLHashTable2 is a DLHashTable variant meant for cases where different
* DLHashTable instances share a common pool (based on a union U).
@@ -28,11 +26,11 @@
* Calls T constructor after seize from pool and T destructor before
* release (in all forms) into pool.
*/
-template <class T, class U>
-class DLHashTable2 {
+template <typename P, typename T, typename U>
+class DLHashTable2Impl {
public:
- DLHashTable2(ArrayPool<U> & thePool);
- ~DLHashTable2();
+ DLHashTable2Impl(P & thePool);
+ ~DLHashTable2Impl();
/**
* Set the no of bucket in the hashtable
@@ -151,29 +149,29 @@
private:
Uint32 mask;
Uint32 * hashValues;
- ArrayPool<U> & thePool;
+ P & thePool;
};
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
-DLHashTable2<T, U>::DLHashTable2(ArrayPool<U> & _pool)
+DLHashTable2Impl<P, T, U>::DLHashTable2Impl(P & _pool)
: thePool(_pool)
{
mask = 0;
hashValues = 0;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
-DLHashTable2<T, U>::~DLHashTable2(){
+DLHashTable2Impl<P, T, U>::~DLHashTable2Impl(){
if(hashValues != 0)
delete [] hashValues;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
bool
-DLHashTable2<T, U>::setSize(Uint32 size){
+DLHashTable2Impl<P, T, U>::setSize(Uint32 size){
Uint32 i = 1;
while(i < size) i *= 2;
@@ -199,10 +197,10 @@
return true;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::add(Ptr<T> & obj){
+DLHashTable2Impl<P, T, U>::add(Ptr<T> & obj){
const Uint32 hv = obj.p->hashValue() & mask;
const Uint32 i = hashValues[hv];
@@ -224,10 +222,10 @@
/**
* First element
*/
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
bool
-DLHashTable2<T, U>::first(Iterator & iter) const {
+DLHashTable2Impl<P, T, U>::first(Iterator & iter) const {
Uint32 i = 0;
while(i <= mask && hashValues[i] == RNIL) i++;
if(i <= mask){
@@ -241,10 +239,10 @@
return false;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
bool
-DLHashTable2<T, U>::next(Iterator & iter) const {
+DLHashTable2Impl<P, T, U>::next(Iterator & iter) const {
if(iter.curr.p->nextHash == RNIL){
Uint32 i = iter.bucket + 1;
while(i <= mask && hashValues[i] == RNIL) i++;
@@ -264,10 +262,10 @@
return true;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::remove(Ptr<T> & ptr, const T & key){
+DLHashTable2Impl<P, T, U>::remove(Ptr<T> & ptr, const T & key){
const Uint32 hv = key.hashValue() & mask;
Uint32 i;
@@ -302,10 +300,10 @@
ptr.i = RNIL;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::release(Ptr<T> & ptr, const T & key){
+DLHashTable2Impl<P, T, U>::release(Ptr<T> & ptr, const T & key){
const Uint32 hv = key.hashValue() & mask;
Uint32 i;
@@ -342,30 +340,30 @@
ptr.i = RNIL;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::remove(Uint32 i){
+DLHashTable2Impl<P, T, U>::remove(Uint32 i){
Ptr<T> tmp;
tmp.i = i;
tmp.p = (T*)thePool.getPtr(i); // cast
remove(tmp);
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::release(Uint32 i){
+DLHashTable2Impl<P, T, U>::release(Uint32 i){
Ptr<T> tmp;
tmp.i = i;
tmp.p = (T*)thePool.getPtr(i); // cast
release(tmp);
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::remove(Ptr<T> & ptr){
+DLHashTable2Impl<P, T, U>::remove(Ptr<T> & ptr){
const Uint32 next = ptr.p->nextHash;
const Uint32 prev = ptr.p->prevHash;
@@ -383,10 +381,10 @@
}
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::release(Ptr<T> & ptr){
+DLHashTable2Impl<P, T, U>::release(Ptr<T> & ptr){
const Uint32 next = ptr.p->nextHash;
const Uint32 prev = ptr.p->prevHash;
@@ -406,18 +404,18 @@
thePool.release(ptr.i);
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::removeAll(){
+DLHashTable2Impl<P, T, U>::removeAll(){
for(Uint32 i = 0; i<=mask; i++)
hashValues[i] = RNIL;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
bool
-DLHashTable2<T, U>::next(Uint32 bucket, Iterator & iter) const {
+DLHashTable2Impl<P, T, U>::next(Uint32 bucket, Iterator & iter) const {
while (bucket <= mask && hashValues[bucket] == RNIL)
bucket++;
@@ -433,10 +431,10 @@
return true;
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
bool
-DLHashTable2<T, U>::seize(Ptr<T> & ptr){
+DLHashTable2Impl<P, T, U>::seize(Ptr<T> & ptr){
Ptr<U> ptr2;
thePool.seize(ptr2);
ptr.i = ptr2.i;
@@ -449,35 +447,35 @@
return !ptr.isNull();
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::getPtr(Ptr<T> & ptr, Uint32 i) const {
+DLHashTable2Impl<P, T, U>::getPtr(Ptr<T> & ptr, Uint32 i) const {
ptr.i = i;
ptr.p = (T*)thePool.getPtr(i); // cast
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
void
-DLHashTable2<T, U>::getPtr(Ptr<T> & ptr) const {
+DLHashTable2Impl<P, T, U>::getPtr(Ptr<T> & ptr) const {
Ptr<U> ptr2;
thePool.getPtr(ptr2);
ptr.i = ptr2.i;
ptr.p = (T*)ptr2.p; // cast
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
T *
-DLHashTable2<T, U>::getPtr(Uint32 i) const {
+DLHashTable2Impl<P, T, U>::getPtr(Uint32 i) const {
return (T*)thePool.getPtr(i); // cast
}
-template<class T, class U>
+template<typename P, typename T, typename U>
inline
bool
-DLHashTable2<T, U>::find(Ptr<T> & ptr, const T & key) const {
+DLHashTable2Impl<P, T, U>::find(Ptr<T> & ptr, const T & key) const {
const Uint32 hv = key.hashValue() & mask;
Uint32 i;
@@ -497,4 +495,14 @@
ptr.p = NULL;
return false;
}
+
+// Specializations
+
+template <typename T, typename U>
+class DLHashTable2 : public DLHashTable2Impl<ArrayPool<U>, T, U>
+{
+public:
+ DLHashTable2(ArrayPool<U>&p) : DLHashTable2Impl<ArrayPool<U>,T,U>(p) {}
+};
+
#endif
--- 1.5/storage/ndb/src/kernel/vm/DLList.hpp 2006-01-11 09:26:03 +01:00
+++ 1.6/storage/ndb/src/kernel/vm/DLList.hpp 2006-01-31 06:54:15 +01:00
@@ -24,8 +24,8 @@
* Template class used for implementing an
* list of object retreived from a pool
*/
-template <class T, class U = T>
-class DLList {
+template <typename P, typename T, typename U = T>
+class DLListImpl {
public:
/**
* List head
@@ -44,7 +44,7 @@
}
};
- DLList(ArrayPool<T> & thePool);
+ DLListImpl(P & thePool);
/**
* Allocate an object from pool - update Ptr
@@ -179,34 +179,34 @@
protected:
Head head;
- ArrayPool<T> & thePool;
+ P & thePool;
};
-template <class T, class U = T>
-class LocalDLList : public DLList<T,U> {
+template <typename P, typename T, typename U = T>
+class LocalDLListImpl : public DLListImpl<P,T,U> {
public:
- LocalDLList(ArrayPool<T> & thePool, typename DLList<T,U>::HeadPOD & _src)
- : DLList<T,U>(thePool), src(_src)
+ LocalDLListImpl(P & thePool, typename DLListImpl<P,T,U>::HeadPOD & _src)
+ : DLListImpl<P,T,U>(thePool), src(_src)
{
this->head = src;
}
- ~LocalDLList(){
+ ~LocalDLListImpl(){
src = this->head;
}
private:
- typename DLList<T,U>::HeadPOD & src;
+ typename DLListImpl<P,T,U>::HeadPOD & src;
};
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
-DLList<T,U>::DLList(ArrayPool<T> & _pool):
+DLListImpl<P,T,U>::DLListImpl(P & _pool):
thePool(_pool){
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
-DLList<T,U>::Head::Head(){
+DLListImpl<P,T,U>::Head::Head(){
this->init();
}
@@ -215,10 +215,10 @@
*
* Return i
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLList<T,U>::seize(Ptr<T> & p){
+DLListImpl<P,T,U>::seize(Ptr<T> & p){
if(thePool.seize(p)){
add(p);
return true;
@@ -231,10 +231,10 @@
*
* Return i
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLList<T,U>::seizeId(Ptr<T> & p, Uint32 ir){
+DLListImpl<P,T,U>::seizeId(Ptr<T> & p, Uint32 ir){
if(thePool.seizeId(p, ir)){
add(p);
return true;
@@ -242,17 +242,17 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLList<T,U>::findId(Uint32 i) const {
+DLListImpl<P,T,U>::findId(Uint32 i) const {
return thePool.findId(i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::add(Ptr<T> & p){
+DLListImpl<P,T,U>::add(Ptr<T> & p){
T * t = p.p;
Uint32 ff = head.firstItem;
@@ -266,10 +266,10 @@
}
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::add(Uint32 first, Ptr<T> & lastPtr)
+DLListImpl<P,T,U>::add(Uint32 first, Ptr<T> & lastPtr)
{
Uint32 ff = head.firstItem;
@@ -282,17 +282,17 @@
}
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::remove(Ptr<T> & p){
+DLListImpl<P,T,U>::remove(Ptr<T> & p){
remove(p.p);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::remove(T * p){
+DLListImpl<P,T,U>::remove(T * p){
T * t = p;
Uint32 ni = t->U::nextList;
Uint32 pi = t->U::prevList;
@@ -313,10 +313,10 @@
/**
* Return an object to pool
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::release(Uint32 i){
+DLListImpl<P,T,U>::release(Uint32 i){
Ptr<T> p;
p.i = i;
p.p = thePool.getPtr(i);
@@ -326,18 +326,18 @@
/**
* Return an object to pool
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::release(Ptr<T> & p){
+DLListImpl<P,T,U>::release(Ptr<T> & p){
remove(p);
thePool.release(p.i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::release(){
+DLListImpl<P,T,U>::release(){
while(head.firstItem != RNIL){
const T * t = thePool.getPtr(head.firstItem);
const Uint32 i = head.firstItem;
@@ -346,32 +346,32 @@
}
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::remove(){
+DLListImpl<P,T,U>::remove(){
head.firstItem = RNIL;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::getPtr(Ptr<T> & p, Uint32 i) const {
+DLListImpl<P,T,U>::getPtr(Ptr<T> & p, Uint32 i) const {
p.i = i;
p.p = thePool.getPtr(i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-DLList<T,U>::getPtr(Ptr<T> & p) const {
+DLListImpl<P,T,U>::getPtr(Ptr<T> & p) const {
thePool.getPtr(p);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
T *
-DLList<T,U>::getPtr(Uint32 i) const {
+DLListImpl<P,T,U>::getPtr(Uint32 i) const {
return thePool.getPtr(i);
}
@@ -380,10 +380,10 @@
*
* Return i
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLList<T,U>::first(Ptr<T> & p) const {
+DLListImpl<P,T,U>::first(Ptr<T> & p) const {
Uint32 i = head.firstItem;
p.i = i;
if(i != RNIL){
@@ -394,10 +394,10 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLList<T,U>::next(Ptr<T> & p) const {
+DLListImpl<P,T,U>::next(Ptr<T> & p) const {
Uint32 i = p.p->U::nextList;
p.i = i;
if(i != RNIL){
@@ -408,11 +408,27 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-DLList<T,U>::hasNext(const Ptr<T> & p) const {
+DLListImpl<P,T,U>::hasNext(const Ptr<T> & p) const {
return p.p->U::nextList != RNIL;
}
+
+// Specializations
+
+template <typename T, typename U = T>
+class DLList : public DLListImpl<ArrayPool<T>, T, U>
+{
+public:
+ DLList(ArrayPool<T>& pool) : DLListImpl<ArrayPool<T>, T, U>(pool){}
+};
+
+template <typename T, typename U = T>
+class LocalDLList : public LocalDLListImpl<ArrayPool<T>,T,U> {
+public:
+ LocalDLList(ArrayPool<T> & thePool, typename DLList<T,U>::HeadPOD & _src)
+ : LocalDLListImpl<ArrayPool<T>, T,U>(thePool, _src) {}
+};
#endif
--- 1.2/storage/ndb/src/kernel/vm/KeyTable.hpp 2005-04-08 02:44:07 +02:00
+++ 1.3/storage/ndb/src/kernel/vm/KeyTable.hpp 2006-01-31 06:54:15 +01:00
@@ -22,22 +22,30 @@
/**
* KeyTable2 is DLHashTable2 with hardcoded Uint32 key named "key".
*/
-template <class T>
-class KeyTable : public DLHashTable<T> {
+template <typename P, typename T>
+class KeyTableImpl : public DLHashTableImpl<P,T> {
public:
- KeyTable(ArrayPool<T>& pool) :
- DLHashTable<T>(pool) {
+ KeyTableImpl(P& pool) :
+ DLHashTableImpl<P,T>(pool) {
}
bool find(Ptr<T>& ptr, const T& rec) const {
- return DLHashTable<T>::find(ptr, rec);
+ return DLHashTableImpl<P,T>::find(ptr, rec);
}
bool find(Ptr<T>& ptr, Uint32 key) const {
T rec;
rec.key = key;
- return DLHashTable<T>::find(ptr, rec);
+ return DLHashTableImpl<P,T>::find(ptr, rec);
}
+};
+
+// Specializations
+template <typename T>
+class KeyTable : public KeyTableImpl<ArrayPool<T>, T>
+{
+public:
+ KeyTable(ArrayPool<T>& p) : KeyTableImpl<ArrayPool<T>,T>(p) {}
};
#endif
--- 1.5/storage/ndb/src/kernel/vm/SLList.hpp 2006-01-11 09:26:03 +01:00
+++ 1.6/storage/ndb/src/kernel/vm/SLList.hpp 2006-01-31 06:54:15 +01:00
@@ -24,8 +24,8 @@
* Template class used for implementing an
* list of object retreived from a pool
*/
-template <class T, class U = T>
-class SLList {
+template <typename P, typename T, typename U = T>
+class SLListImpl {
public:
/**
* List head
@@ -43,7 +43,7 @@
}
};
- SLList(ArrayPool<T> & thePool);
+ SLListImpl(P & thePool);
/**
* Allocate an object from pool - update Ptr
@@ -162,41 +162,41 @@
protected:
Head head;
- ArrayPool<T> & thePool;
+ P & thePool;
};
-template <class T, class U = T>
-class LocalSLList : public SLList<T,U> {
+template <typename P, typename T, typename U = T>
+class LocalSLListImpl : public SLListImpl<P,T,U> {
public:
- LocalSLList(ArrayPool<T> & thePool, typename SLList<T,U>::HeadPOD & _src)
- : SLList<T,U>(thePool), src(_src)
+ LocalSLListImpl(P & thePool, typename SLListImpl<P,T,U>::HeadPOD & _src)
+ : SLListImpl<P,T,U>(thePool), src(_src)
{
this->head = src;
}
- ~LocalSLList(){
+ ~LocalSLListImpl(){
src = this->head;
}
private:
- typename SLList<T,U>::HeadPOD & src;
+ typename SLListImpl<P,T,U>::HeadPOD & src;
};
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
-SLList<T,U>::SLList(ArrayPool<T> & _pool):
+SLListImpl<P,T,U>::SLListImpl(P & _pool):
thePool(_pool){
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
-SLList<T,U>::Head::Head(){
+SLListImpl<P,T,U>::Head::Head(){
this->init();
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-SLList<T,U>::seize(Ptr<T> & p){
+SLListImpl<P,T,U>::seize(Ptr<T> & p){
thePool.seize(p);
T * t = p.p;
Uint32 ff = head.firstItem;
@@ -208,10 +208,10 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-SLList<T,U>::seizeId(Ptr<T> & p, Uint32 ir){
+SLListImpl<P,T,U>::seizeId(Ptr<T> & p, Uint32 ir){
thePool.seizeId(p, ir);
T * t = p.p;
Uint32 ff = head.firstItem;
@@ -223,10 +223,10 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-SLList<T,U>::seizeN(Ptr<T> & p, Uint32 n){
+SLListImpl<P,T,U>::seizeN(Ptr<T> & p, Uint32 n){
for(Uint32 i = 0; i < n; i++){
if(seize(p) == RNIL){
/**
@@ -252,17 +252,17 @@
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-SLList<T,U>::remove(){
+SLListImpl<P,T,U>::remove(){
head.firstItem = RNIL;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-SLList<T,U>::remove_front(Ptr<T> & p){
+SLListImpl<P,T,U>::remove_front(Ptr<T> & p){
p.i = head.firstItem;
if (p.i != RNIL)
{
@@ -273,18 +273,18 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-SLList<T,U>::add(Uint32 first, Ptr<T> & last){
+SLListImpl<P,T,U>::add(Uint32 first, Ptr<T> & last){
last.p->U::nextList = head.firstItem;
head.firstItem = first;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-SLList<T,U>::release(){
+SLListImpl<P,T,U>::release(){
while(head.firstItem != RNIL){
const T * t = thePool.getPtr(head.firstItem);
const Uint32 i = head.firstItem;
@@ -293,25 +293,25 @@
}
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-SLList<T,U>::getPtr(Ptr<T> & p, Uint32 i) const {
+SLListImpl<P,T,U>::getPtr(Ptr<T> & p, Uint32 i) const {
p.i = i;
p.p = thePool.getPtr(i);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
void
-SLList<T,U>::getPtr(Ptr<T> & p) const {
+SLListImpl<P,T,U>::getPtr(Ptr<T> & p) const {
thePool.getPtr(p);
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
T *
-SLList<T,U>::getPtr(Uint32 i) const {
+SLListImpl<P,T,U>::getPtr(Uint32 i) const {
return thePool.getPtr(i);
}
@@ -320,10 +320,10 @@
*
* Return i
*/
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-SLList<T,U>::first(Ptr<T> & p) const {
+SLListImpl<P,T,U>::first(Ptr<T> & p) const {
Uint32 i = head.firstItem;
p.i = i;
if(i != RNIL){
@@ -334,10 +334,10 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-SLList<T,U>::next(Ptr<T> & p) const {
+SLListImpl<P,T,U>::next(Ptr<T> & p) const {
Uint32 i = p.p->U::nextList;
p.i = i;
if(i != RNIL){
@@ -348,11 +348,27 @@
return false;
}
-template <class T, class U>
+template <typename P, typename T, typename U>
inline
bool
-SLList<T,U>::hasNext(const Ptr<T> & p) const {
+SLListImpl<P,T,U>::hasNext(const Ptr<T> & p) const {
return p.p->U::nextList != RNIL;
}
+
+// Specializations
+
+template <typename T, typename U = T>
+class SLList : public SLListImpl<ArrayPool<T>, T, U>
+{
+public:
+ SLList(ArrayPool<T> & p) : SLListImpl<ArrayPool<T>, T, U> (p) {}
+};
+
+template <typename T, typename U = T>
+class LocalSLList : public LocalSLListImpl<ArrayPool<T>,T,U> {
+public:
+ LocalSLList(ArrayPool<T> & thePool, typename SLList<T,U>::HeadPOD & _src)
+ : LocalSLListImpl<ArrayPool<T>, T,U>(thePool, _src) {}
+};
#endif
| Thread |
|---|
| • bk commit into 5.1 tree (jonas:1.2068) | jonas | 31 Jan |