Skip to content

src/primitives/justification.hpp

Namespaces

Name
sgns
sgns::primitives

Classes

Name
struct sgns::primitives::Justification

Functions

Name
bool operator==(const Justification & lhs, const Justification & rhs)
compares two Justification instances
template <class Stream ,typename =std::enable_if_t>
Stream &
operator<<(Stream & s, const Justification & v)
outputs object of type Justification to stream
template <class Stream ,typename =std::enable_if_t>
Stream &
operator>>(Stream & s, Justification & v)
decodes object of type Justification from stream

Functions Documentation

function operator==

inline bool operator==(
    const Justification & lhs,
    const Justification & rhs
)

compares two Justification instances

Parameters:

  • lhs first instance
  • rhs second instance

Return: true if equal false otherwise

function operator<<

template <class Stream ,
typename  =std::enable_if_t<Stream::is_encoder_stream>>
Stream & operator<<(
    Stream & s,
    const Justification & v
)

outputs object of type Justification to stream

Parameters:

  • s stream reference
  • v value to output

Template Parameters:

  • Stream output stream type

Return: reference to stream

function operator>>

template <class Stream ,
typename  =std::enable_if_t<Stream::is_decoder_stream>>
Stream & operator>>(
    Stream & s,
    Justification & v
)

decodes object of type Justification from stream

Parameters:

  • s stream reference
  • v value to output

Template Parameters:

  • Stream input stream type

Return: reference to stream

Source code

#ifndef SUPERGENIUS_JUSTIFICATION_HPP
#define SUPERGENIUS_JUSTIFICATION_HPP

#include "base/buffer.hpp"

namespace sgns::primitives {
  struct Justification {
    base::Buffer data;
    //added to fix link error
    friend std::ostream &operator<<(std::ostream &out, const Justification &test_struct)
    {
      return out << test_struct.data ;
    }
    //end
  };

  inline bool operator==(const Justification &lhs, const Justification &rhs) {
    return lhs.data == rhs.data;
  }

  template <class Stream,
            typename = std::enable_if_t<Stream::is_encoder_stream>>
  Stream &operator<<(Stream &s, const Justification &v) {
    return s << v.data;
  }

  template <class Stream,
            typename = std::enable_if_t<Stream::is_decoder_stream>>
  Stream &operator>>(Stream &s, Justification &v) {
    return s >> v.data;
  }
}  // namespace sgns::primitives

#endif  // SUPERGENIUS_JUSTIFICATION_HPP

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