00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef ORO_EXECUTION_DATA_FLOW_INTERFACE_HPP
00040 #define ORO_EXECUTION_DATA_FLOW_INTERFACE_HPP
00041
00042 #include <vector>
00043 #include <map>
00044 #include <string>
00045 #include "base/InputPortInterface.hpp"
00046 #include "base/OutputPortInterface.hpp"
00047 #include "rtt-fwd.hpp"
00048
00049 namespace RTT
00050 {
00051
00058 class RTT_API DataFlowInterface
00059 {
00060 public:
00064 typedef std::vector<base::PortInterface*> Ports;
00065
00069 typedef std::vector<std::string> PortNames;
00070
00076 DataFlowInterface(Service* parent = 0 );
00077
00078 ~DataFlowInterface();
00079
00086 base::PortInterface& addPort(const std::string& name, base::PortInterface& port) {
00087 port.setName(name);
00088 return addPort(port);
00089 }
00090
00099 base::PortInterface& addPort(base::PortInterface& port);
00100
00110 base::InputPortInterface& addEventPort(const std::string& name, base::InputPortInterface& port, base::InputPortInterface::NewDataOnPortEvent::SlotFunction callback = base::InputPortInterface::NewDataOnPortEvent::SlotFunction() ) {
00111 port.setName(name);
00112 return addEventPort(port,callback);
00113 }
00114
00127 base::InputPortInterface& addEventPort(base::InputPortInterface& port, base::InputPortInterface::NewDataOnPortEvent::SlotFunction callback = base::InputPortInterface::NewDataOnPortEvent::SlotFunction() );
00128
00135 void removePort(const std::string& name);
00136
00141 Ports getPorts() const;
00142
00148 PortNames getPortNames() const;
00149
00155 base::PortInterface* getPort(const std::string& name) const;
00156
00164 std::string getPortDescription(const std::string& name) const;
00165
00176 bool setPortDescription(const std::string& name, const std::string description);
00177
00181 TaskContext* getOwner() const;
00182
00188 Service* getService() const { return mservice; }
00189
00196 base::PortInterface& addLocalPort(base::PortInterface& port);
00197
00210 base::InputPortInterface& addLocalEventPort(base::InputPortInterface& port,
00211 base::InputPortInterface::NewDataOnPortEvent::SlotFunction callback = base::InputPortInterface::NewDataOnPortEvent::SlotFunction() );
00212
00216 template< class Type>
00217 Type* getPortType(const std::string& name) {
00218 return dynamic_cast<Type*>( this->getPort(name) );
00219 }
00220
00225 void clear();
00226
00230 void setupHandles();
00234 void cleanupHandles();
00235 protected:
00240 Service* createPortObject(const std::string& name);
00241
00245 Ports mports;
00249 Service* mservice;
00254 typedef std::vector< Handle > Handles;
00255 Handles handles;
00256
00257
00258 };
00259
00260 }
00261
00262 #endif