Lines 57-75
Link Here
|
57 |
// Will give good sorting for up to e^10 items. |
57 |
// Will give good sorting for up to e^10 items. |
58 |
|
58 |
|
59 |
public: |
59 |
public: |
60 |
typedef Allocator<Node,HEADERCHUNK> Allocator; |
60 |
typedef Allocator<Node,HEADERCHUNK> NodeAllocator; |
61 |
// The type of node allocator to use. |
61 |
// The type of node allocator to use. |
62 |
|
62 |
|
63 |
static Allocator sm_oNodeAllocator; |
63 |
static NodeAllocator sm_oNodeAllocator; |
64 |
// The default node allocator. |
64 |
// The default node allocator. |
65 |
|
65 |
|
66 |
SkipList (const PRED &a_rPred = PRED(), |
66 |
SkipList (const PRED &a_rPred = PRED(), |
67 |
Allocator &a_rAlloc = sm_oNodeAllocator); |
67 |
NodeAllocator &a_rAlloc = sm_oNodeAllocator); |
68 |
// Default constructor. Must be followed by Init(). |
68 |
// Default constructor. Must be followed by Init(). |
69 |
|
69 |
|
70 |
SkipList (Status_t &a_reStatus, bool a_bAllowDuplicates, |
70 |
SkipList (Status_t &a_reStatus, bool a_bAllowDuplicates, |
71 |
uint32_t a_nRandSeed, const PRED &a_rPred = PRED(), |
71 |
uint32_t a_nRandSeed, const PRED &a_rPred = PRED(), |
72 |
Allocator &a_rAlloc = sm_oNodeAllocator); |
72 |
NodeAllocator &a_rAlloc = sm_oNodeAllocator); |
73 |
// Constructor. Specify whether or not duplicates are allowed, |
73 |
// Constructor. Specify whether or not duplicates are allowed, |
74 |
// and provide a random number seed. |
74 |
// and provide a random number seed. |
75 |
|
75 |
|
Lines 255-261
Link Here
|
255 |
|
255 |
|
256 |
private: |
256 |
private: |
257 |
|
257 |
|
258 |
Allocator &m_rNodeAllocator; |
258 |
NodeAllocator &m_rNodeAllocator; |
259 |
// Where we get memory to allocate nodes. |
259 |
// Where we get memory to allocate nodes. |
260 |
|
260 |
|
261 |
bool m_bAllowDuplicates; |
261 |
bool m_bAllowDuplicates; |
Lines 337-343
Link Here
|
337 |
|
337 |
|
338 |
// The default node allocator. Allocates 64K at a time. |
338 |
// The default node allocator. Allocates 64K at a time. |
339 |
template <class KEY, class VALUE, class KEYFN, class PRED> |
339 |
template <class KEY, class VALUE, class KEYFN, class PRED> |
340 |
typename SkipList<KEY,VALUE,KEYFN,PRED>::Allocator |
340 |
typename SkipList<KEY,VALUE,KEYFN,PRED>::NodeAllocator |
341 |
SkipList<KEY,VALUE,KEYFN,PRED>::sm_oNodeAllocator (65536); |
341 |
SkipList<KEY,VALUE,KEYFN,PRED>::sm_oNodeAllocator (65536); |
342 |
|
342 |
|
343 |
|
343 |
|
Lines 345-351
Link Here
|
345 |
// Default constructor. Must be followed by Init(). |
345 |
// Default constructor. Must be followed by Init(). |
346 |
template <class KEY, class VALUE, class KEYFN, class PRED> |
346 |
template <class KEY, class VALUE, class KEYFN, class PRED> |
347 |
SkipList<KEY,VALUE,KEYFN,PRED>::SkipList (const PRED &a_rPred, |
347 |
SkipList<KEY,VALUE,KEYFN,PRED>::SkipList (const PRED &a_rPred, |
348 |
Allocator &a_rAlloc) |
348 |
NodeAllocator &a_rAlloc) |
349 |
: m_rNodeAllocator (a_rAlloc), m_oPred (a_rPred) |
349 |
: m_rNodeAllocator (a_rAlloc), m_oPred (a_rPred) |
350 |
{ |
350 |
{ |
351 |
// Set up some defaults. |
351 |
// Set up some defaults. |
Lines 371-377
Link Here
|
371 |
template <class KEY, class VALUE, class KEYFN, class PRED> |
371 |
template <class KEY, class VALUE, class KEYFN, class PRED> |
372 |
SkipList<KEY,VALUE,KEYFN,PRED>::SkipList (Status_t &a_reStatus, |
372 |
SkipList<KEY,VALUE,KEYFN,PRED>::SkipList (Status_t &a_reStatus, |
373 |
bool a_bAllowDuplicates, uint32_t a_nRandSeed, |
373 |
bool a_bAllowDuplicates, uint32_t a_nRandSeed, |
374 |
const PRED &a_rPred, Allocator &a_rAlloc) |
374 |
const PRED &a_rPred, NodeAllocator &a_rAlloc) |
375 |
: m_rNodeAllocator (a_rAlloc), m_oPred (a_rPred) |
375 |
: m_rNodeAllocator (a_rAlloc), m_oPred (a_rPred) |
376 |
{ |
376 |
{ |
377 |
// Make sure they didn't start us off with an error. |
377 |
// Make sure they didn't start us off with an error. |