Orocos Real-Time Toolkit
2.6.0
|
00001 #ifndef ORO_TEMPLATE_CONN_FACTORY_HPP 00002 #define ORO_TEMPLATE_CONN_FACTORY_HPP 00003 00004 #include <string> 00005 #include "../internal/ConnFactory.hpp" 00006 00007 #include "../InputPort.hpp" 00008 #include "../OutputPort.hpp" 00009 #include "../Logger.hpp" 00010 00011 namespace RTT 00012 { namespace types { 00013 using internal::ConnFactory; 00014 00015 template<class T> 00016 class TemplateConnFactory : public ConnFactory 00017 { 00018 public: 00019 base::InputPortInterface* inputPort(std::string const& name) const { return new InputPort<T>(name); } 00020 base::OutputPortInterface* outputPort(std::string const& name) const { return new OutputPort<T>(name); } 00021 00022 base::ChannelElementBase::shared_ptr buildDataStorage(ConnPolicy const& policy) const { 00023 return ConnFactory::buildDataStorage<T>(policy); 00024 } 00025 00026 base::ChannelElementBase::shared_ptr buildChannelOutput(base::InputPortInterface& port) const 00027 { 00028 return ConnFactory::buildChannelOutput( 00029 static_cast<RTT::InputPort<T>&>(port), new internal::SimpleConnID()); 00030 } 00031 00032 base::ChannelElementBase::shared_ptr buildChannelInput(base::OutputPortInterface& port) const 00033 { 00034 return ConnFactory::buildChannelInput( 00035 static_cast<RTT::OutputPort<T>&>(port), new internal::SimpleConnID(), 0 ); 00036 } 00037 }; 00038 } 00039 } 00040 00041 #endif