@@ -12,6 +12,7 @@
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
@@ -87,6 +88,13 @@ public:
|
||||
if (!src) throw NetworkBuildError("node '" + src_name + "' type mismatch");
|
||||
if (!dst) throw NetworkBuildError("node '" + dst_name + "' type mismatch");
|
||||
|
||||
auto port_key = std::make_pair(src_name, SrcIdx);
|
||||
if (connected_outputs_.count(port_key))
|
||||
throw NetworkBuildError(
|
||||
"connect: output port '" + src_name + "':" + std::to_string(SrcIdx)
|
||||
+ " is already connected — use make_fanout<T, N> for fan-out");
|
||||
connected_outputs_.insert(port_key);
|
||||
|
||||
auto& in_ch = dst->template input_channel<DstIdx>();
|
||||
src->template set_output_channel<SrcIdx>(&in_ch);
|
||||
|
||||
@@ -321,6 +329,7 @@ private:
|
||||
std::vector<std::string> topo_;
|
||||
std::map<std::string, std::string> exposed_inputs_;
|
||||
std::map<std::string, std::string> exposed_outputs_;
|
||||
std::set<std::pair<std::string, std::size_t>> connected_outputs_;
|
||||
std::vector<std::unique_ptr<IChannelProbe>> channel_probes_;
|
||||
ErrorHandler error_handler_;
|
||||
DiagnosticsHandler diag_handler_;
|
||||
|
||||
Reference in New Issue
Block a user