
#ifndef PLS_DATAFLOW_OUTPUT_H_
#define PLS_DATAFLOW_OUTPUT_H_

#include "token.h"
#include "input.h"

#include "pls/internal/base/error_handling.h"

namespace pls {
namespace dataflow {

template<typename T>
class output {
  input<T> *target_;
  bool connected_;

 public:
  output() : target_{nullptr}, connected_{false} {};

  void connect(input<T> &target) {
    if (connected_) {
      PLS_ERROR("Must only connect output once. Please disconnect it before reconnecting.")
    }

    target.connect();
    target_ = &target;
    connected_ = true;
  }
};

}
}

#endif //PLS_DATAFLOW_OUTPUT_H_
