Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb_skiplistlib::skip_list::HeadNode< T, _Compare > Class Template Reference

A HeadNode is a skip list. This is the single node leading to all other content Nodes. More...

Collaboration diagram for duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >:

Public Member Functions

 HeadNode (_Compare cmp=_Compare())
bool has (const T &value) const
const T & at (size_t index) const
void at (size_t index, size_t count, std::vector< T > &dest) const
size_t index (const T &value) const
size_t size () const
void insert (const T &value)
T remove (const T &value)
size_t height () const
size_t height (size_t idx) const
size_t width (size_t idx, size_t level) const
IntegrityCheck lacksIntegrity () const
size_t size_of () const
virtual ~HeadNode ()

Protected Member Functions

void _adjRemoveRefs (size_t level, Node< T, _Compare > *pNode)
const Node< T, _Compare > * _nodeAt (size_t idx) const
void _throwValueErrorNotFound (const T &value) const
void _throwIfValueDoesNotCompare (const T &value) const
IntegrityCheck _lacksIntegrityCyclicReferences () const
IntegrityCheck _lacksIntegrityWidthAccumulation () const
IntegrityCheck _lacksIntegrityNodeReferencesNotInList () const
IntegrityCheck _lacksIntegrityOrder () const

Protected Attributes

size_t _count
 Number of nodes in the list.
SwappableNodeRefStack< T, _Compare > _nodeRefs
 My node references, the size of this is the largest height in the list.
_Compare _compare
 Comparison function.
Node< T, _Compare >::_Pool _pool

Private Member Functions

 HeadNode (const HeadNode &that)
 Prevent cctor and operator=.
HeadNode & operator= (const HeadNode &that) const

Detailed Description

template<typename T, typename _Compare = std::less<T>>
class duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >

A HeadNode is a skip list. This is the single node leading to all other content Nodes.

HeadNode

Example:

OrderedStructs::SkipList::HeadNode<double> sl;
for (int i = 0; i < 100; ++i) {
sl.insert(i * 22.0 / 7.0);
}
sl.size(); // 100
sl.at(50); // Value of 50 pi
sl.remove(sl.at(50)); // Remove 50 pi

Created by Paul Ross on 03/12/2015.

Copyright (c) 2015-2023 Paul Ross. All rights reserved.

Template Parameters
TThe type of the Skip List Node values.
_CompareA comparison function for type T.

Constructor & Destructor Documentation

◆ HeadNode()

template<typename T, typename _Compare = std::less<T>>
duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::HeadNode ( _Compare cmp = _Compare())
inline

Constructor for and Empty Skip List.

Parameters
cmpThe comparison function for comparing Node values.
487227 : _count(0), _compare(cmp), _pool(cmp) {
487228#ifdef INCLUDE_METHODS_THAT_USE_STREAMS
487229 _dot_file_subgraph = 0;
487230#endif
A HeadNode is a skip list. This is the single node leading to all other content Nodes.
Definition duckdb.cpp:487219
size_t _count
Number of nodes in the list.
Definition duckdb.cpp:487294
_Compare _compare
Comparison function.
Definition duckdb.cpp:487298
Here is the caller graph for this function:

◆ ~HeadNode()

template<typename T, typename _Compare>
duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::~HeadNode ( )
virtual

Destructor. This deletes all Nodes.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
487942 {
487943 // Hmm could this deadlock?
487944#ifdef SKIPLIST_THREAD_SUPPORT
487946#endif
487947 if (_nodeRefs.height()) {
487948 // Traverse the lowest level list iteratively deleting as we go
487949 // Doing this recursivley could be expensive as we are at level 0.
487950 const Node<T, _Compare> *node = _nodeRefs[0].pNode;
487951 const Node<T, _Compare> *next;
487952 while (node) {
487953 next = node->next();
487954 delete node;
487955 --_count;
487956 node = next;
487957 }
487958 }
487959 assert(_count == 0);
SwappableNodeRefStack< T, _Compare > _nodeRefs
My node references, the size of this is the largest height in the list.
Definition duckdb.cpp:487296
#define assert(x)
Definition duckdb.cpp:486071
Here is the call graph for this function:

Member Function Documentation

◆ has()

template<typename T, typename _Compare>
bool duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::has ( const T & value) const

Returns true if the value is present in the skip list.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
valueValue to check if it is in the Skip List.
Returns
true if in the Skip List.
487321 {
487323#ifdef SKIPLIST_THREAD_SUPPORT
487325#endif
487326 for (size_t l = _nodeRefs.height(); l-- > 0;) {
487328 if (_nodeRefs[l].pNode->has(value)) {
487329 return true;
487330 }
487331 }
487332 return false;
void _throwIfValueDoesNotCompare(const T &value) const
Definition duckdb.cpp:487710
bool has(const T &value) const
Definition duckdb.cpp:487320
Here is the call graph for this function:

◆ at() [1/2]

template<typename T, typename _Compare>
const T & duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::at ( size_t index) const

Returns the value at a particular index. Will throw an OrderedStructs::SkipList::IndexError if index out of range.

If SKIPLIST_THREAD_SUPPORT is defined this will block.

See _throw_exceeds_size() that does the throw.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
indexThe index.
Returns
The value at that index.
487349 {
487350#ifdef SKIPLIST_THREAD_SUPPORT
487352#endif
487354 assert(pNode);
487355 return pNode->value();
const Node< T, _Compare > * _nodeAt(size_t idx) const
Definition duckdb.cpp:487497
size_t index(const T &value) const
Definition duckdb.cpp:487403
Here is the call graph for this function:

◆ at() [2/2]

template<typename T, typename _Compare>
void duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::at ( size_t index,
size_t count,
std::vector< T > & dest ) const

Find the count number of value starting at index and write them to dest.

Will throw a OrderedStructs::SkipList::IndexError if any index out of range.

This is useful for rolling median on even length lists where the caller might want to implement the mean of two values.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
indexThe index.
countThe number of values to retrieve.
destThe vector of values
487374 {
487375#ifdef SKIPLIST_THREAD_SUPPORT
487377#endif
487378 dest.clear();
487380 // _nodeAt will (should) throw an IndexError so this
487381 // assert should always be true
487382 assert(pNode);
487383 while (count) {
487384 if (! pNode) {
487386 }
487387 dest.push_back(pNode->value());
487388 pNode = pNode->next();
487389 --count;
487390 }
void _throw_exceeds_size(size_t index)
Definition duckdb.cpp:488105
Here is the call graph for this function:

◆ index()

template<typename T, typename _Compare>
size_t duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::index ( const T & value) const

Computes index of the first occurrence of a value Will throw a OrderedStructs::SkipList::ValueError if the value does not exist in the skip list Will throw a OrderedStructs::SkipList::FailedComparison if the value is not comparable.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
valueThe value to search for.
Returns
487404 {
487406 size_t idx;
487407
487408#ifdef SKIPLIST_THREAD_SUPPORT
487410#endif
487411 for (size_t l = _nodeRefs.height(); l-- > 0;) {
487413 if (_nodeRefs[l].pNode->index(value, idx, l)) {
487414 idx += _nodeRefs[l].width;
487415 assert(idx > 0);
487416 return idx - 1;
487417 }
487418 }
487420 return 0;
void _throwValueErrorNotFound(const T &value) const
Definition duckdb.cpp:487687
Here is the call graph for this function:
Here is the caller graph for this function:

◆ size()

template<typename T, typename _Compare>
size_t duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::size ( ) const

Return the number of values in the Skip List.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Returns
The number of values in the Skip List.
487431 {
487432 return _count;

◆ insert()

template<typename T, typename _Compare>
void duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::insert ( const T & value)

Insert a value.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
value
487524 {
487525#ifdef SKIPLIST_THREAD_SUPPORT
487527#ifdef SKIPLIST_THREAD_SUPPORT_TRACE
487528 std::cout << "HeadNode insert() thread: " << std::this_thread::get_id() << std::endl;
487529#endif
487530#endif
487531 Node<T, _Compare> *pNode = nullptr;
487532 size_t level = _nodeRefs.height();
487533
487535 while (level-- > 0) {
487537 pNode = _nodeRefs[level].pNode->insert(value);
487538 if (pNode) {
487539 break;
487540 }
487541 }
487542 if (! pNode) {
487543 pNode = _pool.Allocate(value);
487544 level = 0;
487545 }
487546 assert(pNode);
487548 if (thatRefs.canSwap()) {
487549 // Expand this to that
487550 while (_nodeRefs.height() < thatRefs.height()) {
487551 _nodeRefs.push_back(nullptr, _count + 1);
487552 }
487553 if (level < thatRefs.swapLevel()) {
487554 // Happens when we were originally, say 3 high (max height of any
487555 // previously seen node). Then a node is created
487556 // say 5 high. In that case this will be at level 2 and
487557 // thatRefs.swapLevel() will be 3
487558 assert(level + 1 == thatRefs.swapLevel());
487559 thatRefs[thatRefs.swapLevel()].width += _nodeRefs[level].width;
487560 ++level;
487561 }
487562 // Now swap
487563 while (level < _nodeRefs.height() && thatRefs.canSwap()) {
487564 assert(thatRefs.canSwap());
487565 assert(level == thatRefs.swapLevel());
487566 _nodeRefs[level].width -= thatRefs[level].width - 1;
487567 thatRefs.swap(_nodeRefs);
487568 if (thatRefs.canSwap()) {
487569 assert(thatRefs[thatRefs.swapLevel()].width == 0);
487570 thatRefs[thatRefs.swapLevel()].width = _nodeRefs[level].width;
487571 }
487572 ++level;
487573 }
487574 // Check all references swapped
487575 assert(! thatRefs.canSwap());
487576 // Check that all 'this' pointers created on construction have been moved
487577 assert(thatRefs.noNodePointerMatches(pNode));
487578 }
487579 if (level < thatRefs.swapLevel()) {
487580 // Happens when we are, say 5 high then a node is created
487581 // and consumed by the next node say 3 high. In that case this will be
487582 // at level 2 and thatRefs.swapLevel() will be 3
487583 assert(level + 1 == thatRefs.swapLevel());
487584 ++level;
487585 }
487586 // Increment my widths as my references are now going over the top of
487587 // pNode.
487588 while (level < _nodeRefs.height() && level >= thatRefs.height()) {
487589 _nodeRefs[level++].width += 1;
487590 }
487591 ++_count;
487592#ifdef SKIPLIST_THREAD_SUPPORT
487593#ifdef SKIPLIST_THREAD_SUPPORT_TRACE
487594 std::cout << "HeadNode insert() thread: " << std::this_thread::get_id() << " DONE" << std::endl;
487595#endif
487596#endif
size_t width(size_t idx, size_t level) const
Definition duckdb.cpp:487474
Here is the call graph for this function:

◆ remove()

template<typename T, typename _Compare>
T duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::remove ( const T & value)

Remove a Node with a value. May throw a ValueError if the value is not found.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
valueThe value in the Node to remove.
Returns
The value removed.
487649 {
487650#ifdef SKIPLIST_THREAD_SUPPORT
487652#ifdef SKIPLIST_THREAD_SUPPORT_TRACE
487653 std::cout << "HeadNode remove() thread: " << std::this_thread::get_id() << std::endl;
487654#endif
487655#endif
487656 Node<T, _Compare> *pNode = nullptr;
487657 size_t level;
487658
487660 for (level = _nodeRefs.height(); level-- > 0;) {
487662 pNode = _nodeRefs[level].pNode->remove(level, value);
487663 if (pNode) {
487664 break;
487665 }
487666 }
487667 if (! pNode) {
487669 }
487670 // Take swap level as some swaps will have been dealt with by the remove() above.
487671 _adjRemoveRefs(pNode->nodeRefs().swapLevel(), pNode);
487672 --_count;
487673 T ret_val = _pool.Release(pNode);
487674#ifdef SKIPLIST_THREAD_SUPPORT_TRACE
487675 std::cout << "HeadNode remove() thread: " << std::this_thread::get_id() << " DONE" << std::endl;
487676#endif
487677 return ret_val;
void _adjRemoveRefs(size_t level, Node< T, _Compare > *pNode)
Definition duckdb.cpp:487607
Here is the call graph for this function:

◆ height() [1/2]

template<typename T, typename _Compare>
size_t duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::height ( ) const
487436 {
487437#ifdef SKIPLIST_THREAD_SUPPORT
487439#endif
487440 size_t val = _nodeRefs.height();
487441 return val;

◆ height() [2/2]

template<typename T, typename _Compare>
size_t duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::height ( size_t idx) const

Return the number of linked lists that the node at index has.

Will throw a OrderedStructs::SkipList::IndexError if the index out of range.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
idxThe index of the Skip List node.
Returns
The number of linked lists that the node at the index has.
487455 {
487456#ifdef SKIPLIST_THREAD_SUPPORT
487458#endif
487460 assert(pNode);
487461 return pNode->height();
Here is the call graph for this function:

◆ width()

template<typename T, typename _Compare>
size_t duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::width ( size_t idx,
size_t level ) const

The skip width of the Node at index has at the given level. Will throw an IndexError if the index is out of range.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
idxThe index.
levelThe level.
Returns
Width of Node.
487475 {
487476#ifdef SKIPLIST_THREAD_SUPPORT
487478#endif
487479 // Will throw if out of range.
487481 assert(pNode);
487482 if (level >= pNode->height()) {
487483 _throw_exceeds_size(pNode->height());
487484 }
487485 return pNode->nodeRefs()[level].width;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ lacksIntegrity()

template<typename T, typename _Compare>
IntegrityCheck duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::lacksIntegrity ( ) const

Full integrity check. This calls the other integrity check functions.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Returns
An IntegrityCheck enum.
487858 {
487859#ifdef SKIPLIST_THREAD_SUPPORT
487861#endif
487862 if (_nodeRefs.height()) {
487863 IntegrityCheck result = _nodeRefs.lacksIntegrity();
487864 if (result) {
487865 return result;
487866 }
487867 if (! _nodeRefs.noNodePointerMatches(nullptr)) {
487868 return HEADNODE_CONTAINS_NULL;
487869 }
487870 // Check all nodes for integrity
487871 const Node<T, _Compare> *pNode = _nodeRefs[0].pNode;
487872 while (pNode) {
487873 result = pNode->lacksIntegrity(_nodeRefs.height());
487874 if (result) {
487875 return result;
487876 }
487877 pNode = pNode->next();
487878 }
487879 // Check count against total number of nodes
487880 pNode = _nodeRefs[0].pNode;
487881 size_t total = 0;
487882 while (pNode) {
487883 total += pNode->nodeRefs()[0].width;
487884 pNode = pNode->next();
487885 }
487886 if (total != _count) {
487888 }
487890 if (result) {
487891 return result;
487892 }
487894 if (result) {
487895 return result;
487896 }
487898 if (result) {
487899 return result;
487900 }
487902 if (result) {
487903 return result;
487904 }
487905 }
487906 return INTEGRITY_SUCCESS;
IntegrityCheck _lacksIntegrityNodeReferencesNotInList() const
Definition duckdb.cpp:487793
IntegrityCheck lacksIntegrity() const
Definition duckdb.cpp:487857
IntegrityCheck _lacksIntegrityOrder() const
Definition duckdb.cpp:487831
IntegrityCheck _lacksIntegrityCyclicReferences() const
Definition duckdb.cpp:487726
IntegrityCheck _lacksIntegrityWidthAccumulation() const
Definition duckdb.cpp:487756
Here is the call graph for this function:

◆ size_of()

template<typename T, typename _Compare>
size_t duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::size_of ( ) const

Returns an estimate of the memory usage of an instance.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Returns
The size of the memory estimate.
487917 {
487918#ifdef SKIPLIST_THREAD_SUPPORT
487920#endif
487921 // sizeof(*this) includes the size of _nodeRefs but _nodeRefs.size_of()
487922 // includes sizeof(_nodeRefs) so we need to subtract to avoid double counting
487923 size_t ret_val = sizeof(*this) + _nodeRefs.size_of() - sizeof(_nodeRefs);
487924 if (_nodeRefs.height()) {
487925 const Node<T, _Compare> *node = _nodeRefs[0].pNode;
487926 while (node) {
487927 ret_val += node->size_of();
487928 node = node->next();
487929 }
487930 }
487931 return ret_val;
size_t size_of() const
Definition duckdb.cpp:487916
Here is the call graph for this function:

◆ _adjRemoveRefs()

template<typename T, typename _Compare>
void duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::_adjRemoveRefs ( size_t level,
Node< T, _Compare > * pNode )
protected

Adjust references >= level for removal of the node pNode.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
levelCurrent level.
pNodeNode to swap references with.
487609 {
487610 assert(pNode);
487612
487613 // Swap all remaining levels
487614 // This assertion checks that if swapping can take place we must be at the
487615 // same level.
487616 assert(! thatRefs.canSwap() || level == thatRefs.swapLevel());
487617 while (level < _nodeRefs.height() && thatRefs.canSwap()) {
487618 assert(level == thatRefs.swapLevel());
487619 // Compute the new width for the new node
487620 thatRefs[level].width += _nodeRefs[level].width - 1;
487621 thatRefs.swap(_nodeRefs);
487622 ++level;
487623 if (! thatRefs.canSwap()) {
487624 break;
487625 }
487626 }
487627 assert(! thatRefs.canSwap());
487628 // Decrement my widths as my references are now going over the top of
487629 // pNode.
487630 while (level < _nodeRefs.height()) {
487631 _nodeRefs[level++].width -= 1;
487632 }
487633 // Decrement my stack while top has a NULL pointer.
487634 while (_nodeRefs.height() && ! _nodeRefs[_nodeRefs.height() - 1].pNode) {
487635 _nodeRefs.pop_back();
487636 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _nodeAt()

template<typename T, typename _Compare>
const Node< T, _Compare > * duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::_nodeAt ( size_t idx) const
protected

Find the Node at the given index. Will throw an IndexError if the index is out of range.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
idxThe index.
Returns
The Node.
487498 {
487499 if (idx < _count) {
487500 for (size_t l = _nodeRefs.height(); l-- > 0;) {
487501 if (_nodeRefs[l].pNode && _nodeRefs[l].width <= idx + 1) {
487502 size_t new_index = idx + 1 - _nodeRefs[l].width;
487503 const Node<T, _Compare> *pNode = _nodeRefs[l].pNode->at(new_index);
487504 if (pNode) {
487505 return pNode;
487506 }
487507 }
487508 }
487509 }
487510 assert(idx >= _count);
487512 // Should not get here as _throw_exceeds_size() will always throw.
487513 return NULL;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _throwValueErrorNotFound()

template<typename T, typename _Compare>
void duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::_throwValueErrorNotFound ( const T & value) const
protected

Throw a ValueError in a consistent fashion.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
valueThe value to put into the ValueError.
487688 {
487689#ifdef INCLUDE_METHODS_THAT_USE_STREAMS
487691 oss << "Value " << value << " not found.";
487692 std::string err_msg = oss.str();
487693#else
487694 std::string err_msg = "Value not found.";
487695#endif
487696 throw ValueError(err_msg);
Here is the caller graph for this function:

◆ _throwIfValueDoesNotCompare()

template<typename T, typename _Compare>
void duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::_throwIfValueDoesNotCompare ( const T & value) const
protected

Checks that the value == value. This will throw a FailedComparison if that is not the case, for example NaN.

Note
The Node class is (should be) not directly accessible by the user so we can just assert(value == value) in Node.
Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Parameters
value
487711 {
487712 if (value != value) {
487713 throw FailedComparison(
487714 "Can not work with something that does not compare equal to itself.");
487715 }
Here is the caller graph for this function:

◆ _lacksIntegrityCyclicReferences()

template<typename T, typename _Compare>
IntegrityCheck duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::_lacksIntegrityCyclicReferences ( ) const
protected

This tests that at every level >= 0 the sequence of node pointers at that level does not contain a cyclic reference.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Returns
An IntegrityCheck enum.
487727 {
487728 assert(_nodeRefs.height());
487729 // Check for cyclic references at each level
487730 for (size_t level = 0; level < _nodeRefs.height(); ++level) {
487733 while (p1 && p2) {
487734 p1 = p1->nodeRefs()[level].pNode;
487735 if (p2->nodeRefs()[level].pNode) {
487736 p2 = p2->nodeRefs()[level].pNode->nodeRefs()[level].pNode;
487737 } else {
487738 p2 = nullptr;
487739 }
487740 if (p1 && p2 && p1 == p2) {
487742 }
487743 }
487744 }
487745 return INTEGRITY_SUCCESS;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _lacksIntegrityWidthAccumulation()

template<typename T, typename _Compare>
IntegrityCheck duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::_lacksIntegrityWidthAccumulation ( ) const
protected

This tests that at every level > 0 the node to node width is the same as the accumulated node to node widths at level - 1.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Returns
An IntegrityCheck enum.
487757 {
487758 assert(_nodeRefs.height());
487759 for (size_t level = 1; level < _nodeRefs.height(); ++level) {
487760 const Node<T, _Compare> *pl = _nodeRefs[level].pNode;
487761 const Node<T, _Compare> *pl_1 = _nodeRefs[level - 1].pNode;
487762 assert(pl && pl_1); // No nulls allowed in HeadNode
487763 size_t wl = _nodeRefs[level].width;
487764 size_t wl_1 = _nodeRefs[level - 1].width;
487765 while (true) {
487766 while (pl != pl_1) {
487767 assert(pl_1); // Could only happen if a lower reference was NULL and the higher non-NULL.
487768 wl_1 += pl_1->width(level - 1);
487769 pl_1 = pl_1->pNode(level - 1);
487770 }
487771 if (wl != wl_1) {
487773 }
487774 if (pl == nullptr && pl_1 == nullptr) {
487775 break;
487776 }
487777 wl = pl->width(level);
487778 wl_1 = pl_1->width(level - 1);
487779 pl = pl->pNode(level);
487780 pl_1 = pl_1->pNode(level - 1);
487781 }
487782 }
487783 return INTEGRITY_SUCCESS;
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _lacksIntegrityNodeReferencesNotInList()

template<typename T, typename _Compare>
IntegrityCheck duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::_lacksIntegrityNodeReferencesNotInList ( ) const
protected

This tests the integrity of each Node.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Returns
An IntegrityCheck enum.
487794 {
487795 assert(_nodeRefs.height());
487796
487799 const Node<T, _Compare> *pNode = _nodeRefs[0].pNode;
487800 assert(pNode);
487801
487802 // First gather all nodes, slightly awkward code here is so that
487803 // NULL is always included.
487805 do {
487806 pNode = pNode->next();
487808 } while (pNode);
487809 assert(nodeSet.size() == _count + 1); // All nodes plus NULL
487810 // Then test each node does not have pointers that are not in nodeSet
487811 pNode = _nodeRefs[0].pNode;
487812 while (pNode) {
487813 result = pNode->lacksIntegrityRefsInSet(nodeSet);
487814 if (result) {
487815 return result;
487816 }
487817 pNode = pNode->next();
487818 }
487819 return INTEGRITY_SUCCESS;
void insert(const T &value)
Definition duckdb.cpp:487523
size_t size() const
Definition duckdb.cpp:487430
Here is the call graph for this function:
Here is the caller graph for this function:

◆ _lacksIntegrityOrder()

template<typename T, typename _Compare>
IntegrityCheck duckdb_skiplistlib::skip_list::HeadNode< T, _Compare >::_lacksIntegrityOrder ( ) const
protected

Integrity check. Traverse the lowest level and check that the ordering is correct according to the compare function. The HeadNode checks that the Node(s) have correctly applied the compare function.

Template Parameters
TType of the values in the Skip List.
_CompareCompare function.
Returns
An IntegrityCheck enum.
487832 {
487833 if (_nodeRefs.height()) {
487834 // Traverse the lowest level list iteratively deleting as we go
487835 // Doing this recursivley could be expensive as we are at level 0.
487836 const Node<T, _Compare> *node = _nodeRefs[0].pNode;
487837 const Node<T, _Compare> *next;
487838 while (node) {
487839 next = node->next();
487840 if (next && _compare(next->value(), node->value())) {
487842 }
487843 node = next;
487844 }
487845 }
487846 return INTEGRITY_SUCCESS;
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: