|
|
// Will give good sorting for up to e^10 items. | // Will give good sorting for up to e^10 items. |
| |
public: | public: |
typedef Allocator<Node,HEADERCHUNK> Allocator; |
typedef Allocator<Node,HEADERCHUNK> Allocator_t; |
// The type of node allocator to use. | // The type of node allocator to use. |
| |
static Allocator sm_oNodeAllocator; |
static Allocator_t sm_oNodeAllocator; |
// The default node allocator. | // The default node allocator. |
| |
SkipList (const PRED &a_rPred = PRED(), | SkipList (const PRED &a_rPred = PRED(), |
Allocator &a_rAlloc = sm_oNodeAllocator); |
Allocator_t &a_rAlloc = sm_oNodeAllocator); |
// Default constructor. Must be followed by Init(). | // Default constructor. Must be followed by Init(). |
| |
SkipList (Status_t &a_reStatus, bool a_bAllowDuplicates, | SkipList (Status_t &a_reStatus, bool a_bAllowDuplicates, |
uint32_t a_nRandSeed, const PRED &a_rPred = PRED(), | uint32_t a_nRandSeed, const PRED &a_rPred = PRED(), |
Allocator &a_rAlloc = sm_oNodeAllocator); |
Allocator_t &a_rAlloc = sm_oNodeAllocator); |
// Constructor. Specify whether or not duplicates are allowed, | // Constructor. Specify whether or not duplicates are allowed, |
// and provide a random number seed. | // and provide a random number seed. |
| |
|
|
| |
private: | private: |
| |
Allocator &m_rNodeAllocator; |
Allocator_t &m_rNodeAllocator; |
// Where we get memory to allocate nodes. | // Where we get memory to allocate nodes. |
| |
bool m_bAllowDuplicates; | bool m_bAllowDuplicates; |
|
|
| |
// The default node allocator. Allocates 64K at a time. | // The default node allocator. Allocates 64K at a time. |
template <class KEY, class VALUE, class KEYFN, class PRED> | template <class KEY, class VALUE, class KEYFN, class PRED> |
typename SkipList<KEY,VALUE,KEYFN,PRED>::Allocator |
typename SkipList<KEY,VALUE,KEYFN,PRED>::Allocator_t |
SkipList<KEY,VALUE,KEYFN,PRED>::sm_oNodeAllocator (65536); | SkipList<KEY,VALUE,KEYFN,PRED>::sm_oNodeAllocator (65536); |
| |
| |
|
|
// Default constructor. Must be followed by Init(). | // Default constructor. Must be followed by Init(). |
template <class KEY, class VALUE, class KEYFN, class PRED> | template <class KEY, class VALUE, class KEYFN, class PRED> |
SkipList<KEY,VALUE,KEYFN,PRED>::SkipList (const PRED &a_rPred, | SkipList<KEY,VALUE,KEYFN,PRED>::SkipList (const PRED &a_rPred, |
Allocator &a_rAlloc) |
Allocator_t &a_rAlloc) |
: m_rNodeAllocator (a_rAlloc), m_oPred (a_rPred) | : m_rNodeAllocator (a_rAlloc), m_oPred (a_rPred) |
{ | { |
// Set up some defaults. | // Set up some defaults. |
|
|
template <class KEY, class VALUE, class KEYFN, class PRED> | template <class KEY, class VALUE, class KEYFN, class PRED> |
SkipList<KEY,VALUE,KEYFN,PRED>::SkipList (Status_t &a_reStatus, | SkipList<KEY,VALUE,KEYFN,PRED>::SkipList (Status_t &a_reStatus, |
bool a_bAllowDuplicates, uint32_t a_nRandSeed, | bool a_bAllowDuplicates, uint32_t a_nRandSeed, |
const PRED &a_rPred, Allocator &a_rAlloc) |
const PRED &a_rPred, Allocator_t &a_rAlloc) |
: m_rNodeAllocator (a_rAlloc), m_oPred (a_rPred) | : m_rNodeAllocator (a_rAlloc), m_oPred (a_rPred) |
{ | { |
// Make sure they didn't start us off with an error. | // Make sure they didn't start us off with an error. |