6#ifndef ALTINTEGRATION_COMMANDGROUP_HPP
7#define ALTINTEGRATION_COMMANDGROUP_HPP
11#include <veriblock/pop/reversed_range.hpp>
12#include <veriblock/pop/uint.hpp>
20 using storage_t = std::vector<CommandPtr>;
21 using id_t = std::vector<uint8_t>;
23 CommandGroup() =
default;
25 CommandGroup(std::vector<uint8_t>
id,
27 const std::string& payload_type_name)
28 : payload_type_name(&payload_type_name),
33 const std::string* payload_type_name{};
36 std::vector<uint8_t> id;
41 typename storage_t::iterator begin() {
return commands.begin(); }
42 typename storage_t::const_iterator begin()
const {
return commands.begin(); }
43 typename storage_t::iterator end() {
return commands.end(); }
44 typename storage_t::const_iterator end()
const {
return commands.end(); }
45 typename storage_t::reverse_iterator rbegin() {
return commands.rbegin(); }
46 typename storage_t::const_reverse_iterator rbegin()
const {
return commands.rbegin(); }
47 typename storage_t::reverse_iterator rend() {
return commands.rend(); }
48 typename storage_t::const_reverse_iterator rend()
const {
return commands.rend(); }
51 const std::string& getPayloadsTypeName()
const {
return *payload_type_name; }
58 bool execute(ValidationState& state)
const {
59 for (
auto cmd = begin(); cmd != end(); ++cmd) {
60 if (!(*cmd)->Execute(state)) {
62 for (
auto r_cmd = std::reverse_iterator<
decltype(cmd)>(cmd);
65 (*r_cmd)->UnExecute();
78 void unExecute() const noexcept {
84 bool operator==(
const CommandGroup& o)
const {
return id == o.id; }
86 bool operator==(
const uint256& o)
const {
return id == o; }
reverse_range< T > reverse_iterate(T &x)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Blob< SHA256_HASH_SIZE > uint256
This is an overloaded member function, provided for convenience. It differs from the above function o...