Orocos Real-Time Toolkit  2.9.0
TemplateConnFactory.hpp
Go to the documentation of this file.
1 #ifndef ORO_TEMPLATE_CONN_FACTORY_HPP
2 #define ORO_TEMPLATE_CONN_FACTORY_HPP
3 
4 #include <string>
5 #include "../internal/ConnFactory.hpp"
6 
7 #include "../InputPort.hpp"
8 #include "../OutputPort.hpp"
9 #include "../Logger.hpp"
10 
11 namespace RTT
12 { namespace types {
13  using internal::ConnFactory;
14 
15  template<class T>
16  class TemplateConnFactory : public ConnFactory
17  {
18  public:
19  base::InputPortInterface* inputPort(std::string const& name) const { return new InputPort<T>(name); }
20  base::OutputPortInterface* outputPort(std::string const& name) const { return new OutputPort<T>(name); }
21 
23  return ConnFactory::buildDataStorage<T>(policy);
24  }
25 
27  {
28  return ConnFactory::buildChannelOutput(static_cast<RTT::InputPort<T>&>(port), policy);
29  }
30 
32  {
33  return ConnFactory::buildChannelInput(static_cast<RTT::OutputPort<T>&>(port), policy);
34  }
35 
37  {
38  return ConnFactory::buildSharedConnection(static_cast<RTT::OutputPort<T> *>(output_port), input_port, policy);
39  }
40  };
41 }
42 }
43 
44 #endif
The base class of the InputPort.
virtual base::ChannelElementBase::shared_ptr buildChannelOutput(base::InputPortInterface &port, ConnPolicy const &policy) const =0
Creates the output endpoint of a communication channel and adds it to an InputPort.
boost::intrusive_ptr< SharedConnectionBase > shared_ptr
internal::SharedConnectionBase::shared_ptr buildSharedConnection(base::OutputPortInterface *output_port, base::InputPortInterface *input_port, ConnPolicy const &policy) const
base::ChannelElementBase::shared_ptr buildChannelOutput(base::InputPortInterface &port, ConnPolicy const &policy) const
A component&#39;s data input port.
Definition: InputPort.hpp:63
A connection policy object describes how a given connection should behave.
Definition: ConnPolicy.hpp:107
The base class of each OutputPort.
base::OutputPortInterface * outputPort(std::string const &name) const
virtual internal::SharedConnectionBase::shared_ptr buildSharedConnection(base::OutputPortInterface *output_port, base::InputPortInterface *input_port, ConnPolicy const &policy) const =0
Tries to find an existing or creates a new shared connection object for the given output port...
base::ChannelElementBase::shared_ptr buildDataStorage(ConnPolicy const &policy) const
virtual base::ChannelElementBase::shared_ptr buildChannelInput(base::OutputPortInterface &port, ConnPolicy const &policy) const =0
Creates the input endpoint (starting point) of a communication channel and adds it to an OutputPort...
boost::intrusive_ptr< ChannelElementBase > shared_ptr
A component&#39;s data output port.
Definition: OutputPort.hpp:70
base::InputPortInterface * inputPort(std::string const &name) const
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52
base::ChannelElementBase::shared_ptr buildChannelInput(base::OutputPortInterface &port, ConnPolicy const &policy) const