Skip to content

src/primitives/scheduled_change.hpp

Namespaces

Name
sgns
sgns::primitives

Classes

Name
struct sgns::primitives::DelayInChain
struct sgns::primitives::AuthorityListChange
struct sgns::primitives::ScheduledChange
struct sgns::primitives::ForcedChange
struct sgns::primitives::OnDisabled
struct sgns::primitives::Pause
struct sgns::primitives::Resume

Functions

Name
template <class Stream >
Stream &
operator<<(Stream & s, const DelayInChain & delay)
template <class Stream >
Stream &
operator>>(Stream & s, DelayInChain & delay)
template <class Stream >
Stream &
operator<<(Stream & s, const OnDisabled & target)
template <class Stream >
Stream &
operator>>(Stream & s, OnDisabled & target)
template <class Stream >
Stream &
operator<<(Stream & s, const AuthorityListChange & alc)
template <class Stream >
Stream &
operator>>(Stream & s, AuthorityListChange & alc)

Functions Documentation

function operator<<

template <class Stream >
Stream & operator<<(
    Stream & s,
    const DelayInChain & delay
)

function operator>>

template <class Stream >
Stream & operator>>(
    Stream & s,
    DelayInChain & delay
)

function operator<<

template <class Stream >
Stream & operator<<(
    Stream & s,
    const OnDisabled & target
)

function operator>>

template <class Stream >
Stream & operator>>(
    Stream & s,
    OnDisabled & target
)

function operator<<

template <class Stream >
Stream & operator<<(
    Stream & s,
    const AuthorityListChange & alc
)

function operator>>

template <class Stream >
Stream & operator>>(
    Stream & s,
    AuthorityListChange & alc
)

Source code

#ifndef SUPERGENIUS_SRC_PRIMITIVES_SCHEDULED_CHANGE
#define SUPERGENIUS_SRC_PRIMITIVES_SCHEDULED_CHANGE

#include "primitives/authority.hpp"

namespace sgns::primitives {
  struct DelayInChain {
    uint32_t subchain_lenght = 0;

    DelayInChain() = default;
    explicit DelayInChain(uint32_t delay) : subchain_lenght(delay) {}
    virtual ~DelayInChain() = default;
  };

  struct AuthorityListChange {
    AuthorityList authorities{};
    uint32_t subchain_lenght = 0;

    AuthorityListChange() = default;
    AuthorityListChange(AuthorityList authorities, uint32_t delay)
        : authorities(std::move(authorities)), subchain_lenght(delay) {}
    virtual ~AuthorityListChange() = default;
  };

  struct ScheduledChange final : public AuthorityListChange {
    using AuthorityListChange::AuthorityListChange;
  };
  struct ForcedChange final : public AuthorityListChange {
    using AuthorityListChange::AuthorityListChange;
  };
  struct OnDisabled {
    uint64_t authority_index = 0;
  };
  struct Pause final : public DelayInChain {
    using DelayInChain::DelayInChain;
  };
  struct Resume final : public DelayInChain {
    using DelayInChain::DelayInChain;
  };

  template <class Stream>
  Stream &operator<<(Stream &s, const DelayInChain &delay) {
    return s << delay.subchain_lenght;
  }

  template <class Stream>
  Stream &operator>>(Stream &s, DelayInChain &delay) {
    return s >> delay.subchain_lenght;
  }

  template <class Stream>
  Stream &operator<<(Stream &s, const OnDisabled &target) {
    return s << target.authority_index;
  }

  template <class Stream>
  Stream &operator>>(Stream &s, OnDisabled &target) {
    return s >> target.authority_index;
  }

  template <class Stream>
  Stream &operator<<(Stream &s, const AuthorityListChange &alc) {
    return s << alc.authorities << alc.subchain_lenght;
  }

  template <class Stream>
  Stream &operator>>(Stream &s, AuthorityListChange &alc) {
    return s >> alc.authorities >> alc.subchain_lenght;
  }
}  // namespace sgns::primitives

#endif  // SUPERGENIUS_SRC_PRIMITIVES_SCHEDULED_CHANGE

Updated on 2026-03-04 at 13:10:44 -0800