1#ifndef XRPL_PROTOCOL_FEATURE_H_INCLUDED
2#define XRPL_PROTOCOL_FEATURE_H_INCLUDED
4#include <xrpl/basics/base_uint.h>
6#include <boost/container/flat_map.hpp>
77#pragma push_macro("XRPL_FEATURE")
79#pragma push_macro("XRPL_FIX")
81#pragma push_macro("XRPL_RETIRE")
84#define XRPL_FEATURE(name, supported, vote) +1
85#define XRPL_FIX(name, supported, vote) +1
86#define XRPL_RETIRE(name) +1
94#include <xrpl/protocol/detail/features.macro>
98#pragma pop_macro("XRPL_RETIRE")
100#pragma pop_macro("XRPL_FIX")
102#pragma pop_macro("XRPL_FEATURE")
142 template <
class... Fs>
147 if constexpr (
sizeof...(fs) > 0)
153 using base::operator==;
164 using base::operator[];
175 "ripple::FeatureBitset::FeatureBitset(base) : count match");
178 template <
class... Fs>
183 count() == (
sizeof...(fs) + 1),
184 "ripple::FeatureBitset::FeatureBitset(uint256) : count and "
185 "sizeof... do match");
191 for (
auto const& f : fs)
194 fs.size() ==
count(),
195 "ripple::FeatureBitset::FeatureBitset(Container auto) : count and "
256 static_cast<base const&
>(lhs) &
static_cast<base const&
>(rhs)};
275 static_cast<base const&
>(lhs) |
static_cast<base const&
>(rhs)};
294 static_cast<base const&
>(lhs) ^
static_cast<base const&
>(rhs)};
333 for (
size_t i = 0; i < bs.
size(); ++i)
338#pragma push_macro("XRPL_FEATURE")
340#pragma push_macro("XRPL_FIX")
342#pragma push_macro("XRPL_RETIRE")
345#define XRPL_FEATURE(name, supported, vote) extern uint256 const feature##name;
346#define XRPL_FIX(name, supported, vote) extern uint256 const fix##name;
347#define XRPL_RETIRE(name)
349#include <xrpl/protocol/detail/features.macro>
352#pragma pop_macro("XRPL_RETIRE")
354#pragma pop_macro("XRPL_FIX")
356#pragma pop_macro("XRPL_FEATURE")
friend FeatureBitset operator|(FeatureBitset const &lhs, FeatureBitset const &rhs)
friend FeatureBitset operator&(FeatureBitset const &lhs, uint256 const &rhs)
friend FeatureBitset operator-(FeatureBitset const &lhs, uint256 const &rhs)
friend FeatureBitset operator|(uint256 const &lhs, FeatureBitset const &rhs)
FeatureBitset & operator|=(FeatureBitset const &rhs)
friend FeatureBitset operator^(FeatureBitset const &lhs, uint256 const &rhs)
auto operator[](uint256 const &f)
void initFromFeatures(uint256 const &f, Fs &&... fs)
friend FeatureBitset operator|(FeatureBitset const &lhs, uint256 const &rhs)
friend FeatureBitset operator&(uint256 const &lhs, FeatureBitset const &rhs)
friend FeatureBitset operator^(FeatureBitset const &lhs, FeatureBitset const &rhs)
FeatureBitset(uint256 const &f, Fs &&... fs)
FeatureBitset operator~() const
friend FeatureBitset operator^(uint256 const &lhs, FeatureBitset const &rhs)
friend FeatureBitset operator&(FeatureBitset const &lhs, FeatureBitset const &rhs)
friend FeatureBitset operator-(uint256 const &lhs, FeatureBitset const &rhs)
FeatureBitset & flip(uint256 const &f)
FeatureBitset(Col const &fs)
FeatureBitset & set(uint256 const &f, bool value=true)
friend FeatureBitset operator-(FeatureBitset const &lhs, FeatureBitset const &rhs)
FeatureBitset(base const &b)
FeatureBitset & operator&=(FeatureBitset const &rhs)
FeatureBitset & reset(uint256 const &f)
auto operator[](uint256 const &f) const
static constexpr std::size_t numFeatures
std::size_t numUpVotedAmendments()
Amendments that this server will vote for by default.
std::size_t numDownVotedAmendments()
Amendments that this server won't vote for by default.
std::map< std::string, VoteBehavior > const & supportedAmendments()
Amendments that this server supports and the default voting behavior.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
uint256 bitsetIndexToFeature(size_t i)
size_t featureToBitsetIndex(uint256 const &f)
std::map< std::string, AmendmentSupport > const & allAmendments()
All amendments libxrpl knows about.
std::string featureToName(uint256 const &f)
std::optional< uint256 > getRegisteredFeature(std::string const &name)
void foreachFeature(FeatureBitset bs, F &&f)