From c6ff1ff64d44110d5ba423989c34f96342d872fb Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Wed, 17 Jan 2024 11:03:10 -0800 Subject: [PATCH] Add PImpl scaffolding --- ConflictSet.cpp | 38 ++++++++++++++++++++++++++++++++++++++ ConflictSet.h | 3 ++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/ConflictSet.cpp b/ConflictSet.cpp index e69de29..94e25d6 100644 --- a/ConflictSet.cpp +++ b/ConflictSet.cpp @@ -0,0 +1,38 @@ +#include "ConflictSet.h" + +#include + +struct ConflictSet::Impl { + explicit Impl(int64_t oldestVersion) noexcept {} + void check(const ReadRange *reads, Result *results, int count) const {} + + void addWrites(const WriteRange *writes, int count) {} + + void setOldestVersion(int64_t oldestVersion) {} +}; + +void ConflictSet::check(const ReadRange *reads, Result *results, + int count) const { + return impl->check(reads, results, count); +} + +void ConflictSet::addWrites(const WriteRange *writes, int count) { + return impl->addWrites(writes, count); +} + +void ConflictSet::setOldestVersion(int64_t oldestVersion) { + return impl->setOldestVersion(oldestVersion); +} + +ConflictSet::ConflictSet(int64_t oldestVersion) + : impl(new Impl{oldestVersion}) {} + +ConflictSet::~ConflictSet() { delete impl; } + +ConflictSet::ConflictSet(ConflictSet &&other) noexcept + : impl(std::exchange(other.impl, nullptr)) {} + +ConflictSet &ConflictSet::operator=(ConflictSet &&other) noexcept { + impl = std::exchange(other.impl, nullptr); + return *this; +} diff --git a/ConflictSet.h b/ConflictSet.h index b132c37..2863d0d 100644 --- a/ConflictSet.h +++ b/ConflictSet.h @@ -56,5 +56,6 @@ struct ConflictSet { ConflictSet &operator=(const ConflictSet &) = delete; private: - struct Impl *impl; + struct Impl; + Impl *impl; }; \ No newline at end of file