diff --git a/src/api/python/safpy.cpp b/src/api/python/safpy.cpp index 9cbf167..ad0b0c9 100644 --- a/src/api/python/safpy.cpp +++ b/src/api/python/safpy.cpp @@ -534,10 +534,10 @@ BOOST_PYTHON_MODULE(safpy) { import_array(); def("GetInstance", GetInstance, GetInstance_overloads()); - def("SetDeviceNumber", &SafPython::SetDeviceNumber); class_, boost::noncopyable>("Saf", no_init) + .def("SetDeviceNumber", &SafPython::SetDeviceNumber) .def("StopAndClean", &SafPython::StopAndClean) .def("Start", &SafPython::Start) .def("Stop", &SafPython::Stop) diff --git a/src/operator/operator.cpp b/src/operator/operator.cpp index a835090..00a4651 100644 --- a/src/operator/operator.cpp +++ b/src/operator/operator.cpp @@ -63,29 +63,39 @@ void Operator::SetSink(const std::string& name, StreamPtr stream) { } StreamPtr Operator::GetSink(const std::string& name) { + std::string real_name = name; if (sinks_.find(name) == sinks_.end()) { - std::ostringstream msg; - msg << "Sink \"" << name << "\" does not exist for operator \"" - << GetStringForOperatorType(GetType()) << "\". Available sinks: "; - for (const auto& s : sinks_) { - msg << s.first << " "; + if ((name == "output") && (sinks_.find("output0") != sinks_.end())) { + real_name = "output0"; + } else { + std::ostringstream msg; + msg << "Sink \"" << name << "\" does not exist for operator \"" + << GetStringForOperatorType(GetType()) << "\". Available sinks: "; + for (const auto& s : sinks_) { + msg << s.first << " "; + } + throw std::runtime_error(msg.str()); } - throw std::runtime_error(msg.str()); } - return sinks_.at(name); + return sinks_.at(real_name); } void Operator::SetSource(const std::string& name, StreamPtr stream) { + std::string real_name = name; if (sources_.find(name) == sources_.end()) { - std::ostringstream msg; - msg << "Source \"" << name << "\" does not exist for operator \"" - << GetStringForOperatorType(GetType()) << "\". Available sources: "; - for (const auto& s : sources_) { - msg << s.first << " "; + if ((name == "input") && (sources_.find("input0") != sources_.end())) { + real_name = "input0"; + } else { + std::ostringstream msg; + msg << "Source \"" << name << "\" does not exist for operator \"" + << GetStringForOperatorType(GetType()) << "\". Available sources: "; + for (const auto& s : sources_) { + msg << s.first << " "; + } + throw std::runtime_error(msg.str()); } - throw std::runtime_error(msg.str()); } - sources_[name] = stream; + sources_[real_name] = stream; } bool Operator::Start(size_t buf_size) {