Program Listing for File ThrowDuct.hpp

Return to documentation for file (include/uit/ducts/mock/ThrowDuct.hpp)

#pragma once
#ifndef UIT_DUCTS_MOCK_THROWDUCT_HPP_INCLUDE
#define UIT_DUCTS_MOCK_THROWDUCT_HPP_INCLUDE

#include <stddef.h>
#include <string>

#include "../proc/impl/backend/MockBackEnd.hpp"

namespace uit {

template<typename ImplSpec>
class ThrowDuct {

  using T = typename ImplSpec::T;

public:

  using InletImpl = ThrowDuct<ImplSpec>;
  using OutletImpl = ThrowDuct<ImplSpec>;
  using BackEndImpl = uit::MockBackEnd<ImplSpec>;

  template <typename... Args>
  ThrowDuct(Args&&... args) { ; }

  [[noreturn]] bool TryPut(const T&) const {
    throw "TryPut called on ThrowDuct";
  }

  [[noreturn]] bool TryFlush() const { throw "Flush called on ThrowDuct"; }

  [[noreturn]] const T& Get() const { throw "Get called on ThrowDuct"; }

  [[noreturn]] T& Get() { throw "Get called on ThrowDuct"; }

  [[noreturn]] size_t TryConsumeGets(size_t) const {
    throw "ConsumeGets called on ThrowDuct";
  }

  static std::string GetName() { return "ThrowDuct"; }

  static constexpr bool CanStep() { return false; }

  std::string ToString() const { return std::string{}; }

};

} // namespace uit

#endif // #ifndef UIT_DUCTS_MOCK_THROWDUCT_HPP_INCLUDE