Electroneum
Loading...
Searching...
No Matches
util.h File Reference
#include <cstddef>
#include <cstring>
#include <lmdb.h>
#include <type_traits>
#include <utility>
#include "span.h"
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  lmdb::identity< T >
 Prevent instantiation of std::underlying_type<T> when T is not enum. More...

Namespaces

namespace  lmdb

Macros

#define ELECTRONEUM_FIELD(obj, field)
#define ELECTRONEUM_SORT_BY(obj, field)
 Expands to lmdb::less for the value field within obj.
#define ELECTRONEUM_COMPARE(obj, field)
 Expands to lmdb::compare for the value field within obj.

Typedefs

template<typename T>
using lmdb::native_type

Functions

template<typename T, typename U = typename std::underlying_type<T>::type>
constexpr U lmdb::to_native (T value) noexcept
template<typename T>
MDB_val lmdb::to_val (T &&value) noexcept
constexpr epee::span< const std::uint8_t > lmdb::to_byte_span (MDB_val value) noexcept
template<typename T, std::size_t offset = 0>
int lmdb::less (MDB_val const *left, MDB_val const *right) noexcept
template<typename T, std::size_t offset = 0>
int lmdb::compare (MDB_val const *left, MDB_val const *right) noexcept

Macro Definition Documentation

◆ ELECTRONEUM_COMPARE

#define ELECTRONEUM_COMPARE ( obj,
field )
Value:
decltype(std::declval<obj>().field), \
offsetof(obj, field) \
>
int compare(MDB_val const *left, MDB_val const *right) noexcept
Definition util.h:135

Expands to lmdb::compare for the value field within obj.

Definition at line 51 of file util.h.

51#define ELECTRONEUM_COMPARE(obj, field) \
52 &::lmdb::compare< \
53 decltype(std::declval<obj>().field), \
54 offsetof(obj, field) \
55 >

◆ ELECTRONEUM_FIELD

#define ELECTRONEUM_FIELD ( obj,
field )
Value:
obj , decltype(std::declval<obj>().field) , offsetof(obj, field)

Calculates types and offset of struct field. Use in template arguments for table::get_value, value_iterator::get_value, value_stream::make_iterator, or value_stream::make_range.

Definition at line 40 of file util.h.

40#define ELECTRONEUM_FIELD(obj, field) \
41 obj , decltype(std::declval<obj>().field) , offsetof(obj, field)

◆ ELECTRONEUM_SORT_BY

#define ELECTRONEUM_SORT_BY ( obj,
field )
Value:
lmdb::native_type<decltype(std::declval<obj>().field)>, \
offsetof(obj, field) \
>
int less(MDB_val const *left, MDB_val const *right) noexcept
Definition util.h:111

Expands to lmdb::less for the value field within obj.

Definition at line 44 of file util.h.

44#define ELECTRONEUM_SORT_BY(obj, field) \
45 &::lmdb::less< \
46 lmdb::native_type<decltype(std::declval<obj>().field)>, \
47 offsetof(obj, field) \
48 >