Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
flavor_macros.hpp File Reference
#include "barretenberg/common/ref_array.hpp"
#include "barretenberg/common/std_array.hpp"
#include "barretenberg/common/std_string.hpp"
#include "barretenberg/common/std_vector.hpp"
#include <array>
#include <iostream>
#include <sstream>
#include <tuple>
#include <type_traits>

Go to the source code of this file.

Namespaces

namespace  bb
 Entry point for Barretenberg command-line interface.
 
namespace  bb::detail
 

Macros

#define VARARGS_TO_STRING(...)   #__VA_ARGS__
 
#define DEFINE_REF_VIEW(...)
 
#define DEFINE_FLAVOR_MEMBERS(DataType, ...)
 Define the body of a flavor class, included each member and a pointer view with which to iterate the struct.
 
#define DEFINE_COMPOUND_GET_ALL(...)
 

Functions

template<typename T , typename... BaseClass>
constexpr std::size_t bb::detail::_sum_base_class_size (const T &arg)
 
template<typename T , typename... BaseClass>
auto bb::detail::_concatenate_base_class_get_all (T &arg)
 
template<typename T , typename... BaseClass>
auto bb::detail::_concatenate_base_class_get_all_const (const T &arg)
 
template<typename... BaseClass>
auto bb::detail::_static_concatenate_base_class_get_labels ()
 

Macro Definition Documentation

◆ DEFINE_COMPOUND_GET_ALL

#define DEFINE_COMPOUND_GET_ALL (   ...)
Value:
[[nodiscard]] auto get_all() \
{ \
return bb::detail::_concatenate_base_class_get_all<decltype(*this), __VA_ARGS__>(*this); \
} \
[[nodiscard]] auto get_all() const \
{ \
return bb::detail::_concatenate_base_class_get_all_const<decltype(*this), __VA_ARGS__>(*this); \
} \
constexpr std::size_t size() const \
{ \
return bb::detail::_sum_base_class_size<decltype(*this), __VA_ARGS__>(*this); \
} \
static const std::vector<std::string>& get_labels() \
{ \
static const auto labels = bb::detail::_static_concatenate_base_class_get_labels<__VA_ARGS__>(); \
return labels; \
}
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13

Definition at line 83 of file flavor_macros.hpp.

◆ DEFINE_FLAVOR_MEMBERS

#define DEFINE_FLAVOR_MEMBERS (   DataType,
  ... 
)
Value:
__VA_OPT__(DataType __VA_ARGS__;) \
static constexpr size_t _members_size = std::tuple_size_v<decltype(std::make_tuple(__VA_ARGS__))>; \
DEFINE_REF_VIEW(__VA_ARGS__) \
static const std::vector<std::string>& get_labels() \
{ \
static const std::vector<std::string> labels = \
bb::detail::split_and_trim(VARARGS_TO_STRING(__VA_ARGS__), ','); \
return labels; \
} \
static constexpr std::size_t size() \
{ \
return _members_size; \
}
#define VARARGS_TO_STRING(...)

Define the body of a flavor class, included each member and a pointer view with which to iterate the struct.

Template Parameters
TThe underlying data type stored in the array
HandleTypeThe type that will be used to
NUM_ENTITIESThe size of the underlying array.

Definition at line 68 of file flavor_macros.hpp.

◆ DEFINE_REF_VIEW

#define DEFINE_REF_VIEW (   ...)
Value:
[[nodiscard]] auto get_all() \
{ \
return RefArray<std::remove_reference_t<DataType>, _members_size>{ __VA_ARGS__ }; \
} \
[[nodiscard]] auto get_all() const \
{ \
return RefArray<const std::remove_reference_t<DataType>, _members_size>{ __VA_ARGS__ }; \
}

Definition at line 51 of file flavor_macros.hpp.

◆ VARARGS_TO_STRING

#define VARARGS_TO_STRING (   ...)    #__VA_ARGS__

Definition at line 48 of file flavor_macros.hpp.