ConnectionInterface.hpp
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_CONNECTION_INTERFACE_HPP
00040 #define ORO_EXECUTION_CONNECTION_INTERFACE_HPP
00041
00042 #include <boost/intrusive_ptr.hpp>
00043 #include "os/Atomic.hpp"
00044 #include "DataSourceBase.hpp"
00045 #include "BufferBase.hpp"
00046 #include <vector>
00047
00048 namespace RTT
00049 {
00050 class ConnectionInterface;
00051 }
00052
00053 void RTT_API intrusive_ptr_add_ref( RTT::ConnectionInterface* p );
00054 void RTT_API intrusive_ptr_release( RTT::ConnectionInterface* p );
00055
00056 namespace RTT
00057 {
00058 class PortInterface;
00059
00101 class RTT_API ConnectionInterface
00102 {
00103 protected:
00104 friend void ::intrusive_ptr_add_ref( ConnectionInterface* p );
00105 friend void ::intrusive_ptr_release( ConnectionInterface* p );
00106 OS::AtomicInt refcount;
00107
00108 typedef std::vector<PortInterface*> PList;
00109 PList ports;
00110 bool mconnected;
00111 public:
00112 typedef boost::intrusive_ptr<ConnectionInterface> shared_ptr;
00113
00114 ConnectionInterface();
00115 virtual ~ConnectionInterface();
00116
00121 virtual DataSourceBase::shared_ptr getDataSource() const = 0;
00122
00128 virtual BufferBase::shared_ptr getBuffer() const = 0;
00129
00137 virtual bool connect();
00138
00142 virtual bool connected() const;
00143
00147 virtual bool disconnect();
00148
00159 virtual bool addPort(PortInterface* p);
00160
00170 virtual bool removePort(PortInterface* p);
00171
00175 virtual const TypeInfo* getTypeInfo() const = 0;
00176
00180 virtual int serverProtocol() const {
00181 return 0;
00182 }
00183
00190 void signal();
00191
00192 };
00193 }
00194
00195 #endif