Kstars

SkipListElement.h
Go to the documentation of this file.
1#ifndef _SkipListElement_H
2#define _SkipListElement_H
3
4/** \file SkipListElement.h
5 Interface for skip list elements
6 See William Pugh's paper:
7 Skip Lists: A Probabilistic Alternative to Balanced Trees
8 \author: Bruno Grossniklaus, 13.11.97
9 \version: 1.0
10 History:
11 13.11.97; Gro; Version 1.0
12*/
13
14#include <SpatialGeneral.h>
15
16#define SKIPLIST_MAXLEVEL 6 // maximum node level
17#define NIL 0 // invalid pointer
18
19#ifdef _WIN32
20#define KEY_MAX _I64_MAX
21#else
22#define KEY_MAX LLONG_MAX
23#endif
24
25typedef int64 Key; // key type
26typedef int Value; // value type
27
28class SkipListElement;
29
30class LINKAGE SkipListElement
31{
32 public:
33 SkipListElement(long level = 0, Key key = 0, Value value = 0);
34
35 /** get key of element */
36 Key getKey() const { return myKey; };
37 /** set key of element */
38 void setKey(Key key) { myKey = key; };
39
40 /** get value of element */
41 Value getValue() const { return myValue; }
42 /** set value of element */
43 void setValue(Value value) { myValue = value; }
44
45 /** get level of element */
46 long getLevel() const { return (myLevel); };
47 /** Set level of element */
48 void setLevel(long level) { myLevel = level; }
49
50 /** get next element in level */
51 SkipListElement *getElement(long level);
52 /** set next element in level */
53 void setElement(long level, SkipListElement *element);
54
55 private:
56 long myLevel; // level of element
57 Key myKey; // key of element
58 Value myValue; // value of element
59 SkipListElement *myNext[SKIPLIST_MAXLEVEL]; // pointers to next elements
60};
61#endif // _SkipListElement_H
QStringView level(QStringView ifopt)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:41 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.