17#include <unordered_map>
19#include <unordered_set>
23#ifdef MDE_ENABLE_PARALLEL
26#include <shared_mutex>
31#include <tbb/concurrent_map.h>
32#include <tbb/concurrent_vector.h>
35#ifdef MDE_ENABLE_SERIALIZATION
39#define MDE_VERSION_MAJOR "0"
40#define MDE_VERSION_MINOR "6"
41#define MDE_VERSION_PATCH "0"
42#define MDE_VERSION_STRING (MDE_VERSION_MAJOR "." MDE_VERSION_MINOR "." MDE_VERSION_PATCH)
44#define MDE_SORTED_VECTOR_BINARY_SEARCH_THRESHOLD 12
45#define MDE_DEFAULT_BLOCK_SHIFT 5
46#define MDE_DEFAULT_BLOCK_SIZE (1 << MDE_DEFAULT_BLOCK_SHIFT)
47#define MDE_DEFAULT_BLOCK_MASK (MDE_DEFAULT_BLOCK_SIZE - 1)
48#define MDE_DISABLE_INTERNAL_INTEGRITY_CHECK true
52#define ____MDE__STR(x) #x
53#define __MDE_STR(x) ____MDE__STR(x)
55#ifdef MDE_ENABLE_DEBUG
56#define MDE_DEBUG(x) { x };
65#ifdef MDE_ENABLE_PARALLEL
67using RWMutex = std::shared_mutex;
69using ReadLock = std::shared_lock<RWMutex>;
71using WriteLock = std::lock_guard<RWMutex>;
83template<
typename K,
typename V>
86template<
typename K,
typename V>
129 const T *value =
nullptr;
142 return value !=
nullptr;
151 "A check is likely missing.");
188 "A check is likely missing.");
207static const constexpr Size EMPTY_SET_VALUE = 0;
221template<
typename T,
typename Hash = DefaultHash<T>>
Describes an optional reference of some type T. The value may either be present or absent.
const T & get()
Gets the underlying value. Throws an exception if it is absent.
bool is_present() const
Informs if the value is present.
static OptionalRef absent()
Explicitly creates an absent value.
OptionalRef(const T &value)
Describes an optional of some type T. The value may either be present or absent.
static Optional absent()
Explicitly creates an absent value.
const T & get()
Gets the underlying value. Throws an exception if it is absent.
bool is_present()
Informs if the value is present.
Describes serialization building blocks for MDE.
SubsetRelation
Used to store a subset relation between two set indices. Because the index pair must be in sorted ord...
std::map< K, V > OrderedMap
std::less< T > DefaultLess
std::unordered_set< T > HashSet
std::unique_ptr< T > UniquePointer
std::hash< T > DefaultHash
std::unordered_map< K, V > HashMap
Size compose_hash(const Size prev, T next)
Composes a preexisting hash with another variable. Useful for Hashing containers. Adapted from boost:...
std::equal_to< T > DefaultEqual
Thrown if an Optional is accessed when the value is absent.
AbsentValueAccessError(const std::string &message)