diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-11-15 22:04:07 +0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-11-15 22:04:07 +0400 |
commit | 9340f9f465a29e7653f9285963bcad0fe4a60ec6 (patch) | |
tree | 19d3503d6e0bf7a3dc2f8db744e1083b4c7d2419 /search/header.hh | |
parent | 877ade5327f7a736345f3b88c4294faa061826d6 (diff) |
Update incremental search
Diffstat (limited to 'search/header.hh')
-rw-r--r-- | search/header.hh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/search/header.hh b/search/header.hh index 25550dbed..69f0eed04 100644 --- a/search/header.hh +++ b/search/header.hh @@ -3,7 +3,6 @@ // Header consisting of Score, Arity, and Note -#include "search/note.hh" #include "search/types.hh" #include <stdint.h> @@ -24,6 +23,9 @@ class Header { bool operator<(const Header &other) const { return GetScore() < other.GetScore(); } + bool operator>(const Header &other) const { + return GetScore() > other.GetScore(); + } Arity GetArity() const { return *reinterpret_cast<const Arity*>(base_ + sizeof(Score)); @@ -36,9 +38,14 @@ class Header { *reinterpret_cast<Note*>(base_ + sizeof(Score) + sizeof(Arity)) = to; } + uint8_t *Base() { return base_; } + const uint8_t *Base() const { return base_; } + protected: Header() : base_(NULL) {} + explicit Header(void *base) : base_(static_cast<uint8_t*>(base)) {} + Header(void *base, Arity arity) : base_(static_cast<uint8_t*>(base)) { *reinterpret_cast<Arity*>(base_ + sizeof(Score)) = arity; } |