Go to the documentation of this file.00001
00020 #ifndef RTC_INPORTBASE_H
00021 #define RTC_INPORTBASE_H
00022
00023 #include <rtm/PortBase.h>
00024 #include <rtm/DataPortStatus.h>
00025 #include <rtm/CdrBufferBase.h>
00026 #include <rtm/ConnectorListener.h>
00027
00042 namespace RTC
00043 {
00044 class InPortProvider;
00045 class OutPortConsumer;
00046 class InPortConnector;
00047
00067 class InPortBase
00068 : public PortBase, public DataPortStatus
00069 {
00070 public:
00071 DATAPORTSTATUS_ENUM
00072
00073 typedef std::vector<InPortConnector*> ConnectorList;
00074
00094 InPortBase(const char* name, const char* data_type);
00095
00109 virtual ~InPortBase(void);
00110
00126 void init(coil::Properties& prop);
00127
00142 virtual bool read() = 0;
00143
00159 coil::Properties& properties();
00160
00179 const std::vector<InPortConnector*>& connectors();
00180
00199 ConnectorInfoList getConnectorProfiles();
00200
00219 coil::vstring getConnectorIds();
00220
00239 coil::vstring getConnectorNames();
00240
00261 InPortConnector* getConnectorById(const char* id);
00262
00283 InPortConnector* getConnectorByName(const char* name);
00284
00307 bool getConnectorProfileById(const char* id,
00308 ConnectorInfo& prof);
00309
00332 bool getConnectorProfileByName(const char* name,
00333 ConnectorInfo& prof);
00334
00335
00352 virtual void activateInterfaces();
00353
00370 virtual void deactivateInterfaces();
00371
00447 void addConnectorDataListener(ConnectorDataListenerType listener_type,
00448 ConnectorDataListener* listener,
00449 bool autoclean = true);
00450
00451
00471 void removeConnectorDataListener(ConnectorDataListenerType listener_type,
00472 ConnectorDataListener* listener);
00473
00474
00527 void addConnectorListener(ConnectorListenerType callback_type,
00528 ConnectorListener* listener,
00529 bool autoclean = true);
00530
00550 void removeConnectorListener(ConnectorListenerType callback_type,
00551 ConnectorListener* listener);
00552
00570 bool isLittleEndian();
00571
00597 virtual ReturnCode_t
00598 connect(ConnectorProfile& connector_profile)
00599 throw (CORBA::SystemException);
00600
00601 protected:
00602
00631 virtual ReturnCode_t
00632 publishInterfaces(ConnectorProfile& connector_profile);
00633
00661 virtual ReturnCode_t
00662 subscribeInterfaces(const ConnectorProfile& connector_profile);
00663
00685 virtual void
00686 unsubscribeInterfaces(const ConnectorProfile& connector_profile);
00687
00688
00696 void initProviders();
00697
00705 void initConsumers();
00706
00738 bool checkEndian(const coil::Properties& prop, bool& littleEndian);
00739
00751 InPortProvider*
00752 createProvider(ConnectorProfile& cprof, coil::Properties& prop);
00753
00765 OutPortConsumer*
00766 createConsumer(const ConnectorProfile& cprof, coil::Properties& prop);
00767
00779 InPortConnector*
00780 createConnector(ConnectorProfile& cprof, coil::Properties& prop,
00781 InPortProvider* provider);
00793 InPortConnector*
00794 createConnector(const ConnectorProfile& cprof, coil::Properties& prop,
00795 OutPortConsumer* consumer);
00796
00797 protected:
00813 bool m_singlebuffer;
00821 CdrBufferBase* m_thebuffer;
00829 coil::Properties m_properties;
00837 coil::vstring m_providerTypes;
00845 coil::vstring m_consumerTypes;
00853 ConnectorList m_connectors;
00861 bool m_littleEndian;
00862
00870 ConnectorListeners m_listeners;
00871 };
00872 };
00873
00874 #endif // RTC_INPORTBASE_H