00001 #ifndef ROSRTT_CONN_OUTPUT_ENDPOINT_HPP 00002 #define ROSRTT_CONN_OUTPUT_ENDPOINT_HPP 00003 00004 #include "channel_data_element.hpp" 00005 #include "../subscription.h" 00006 00007 namespace hpcl_rtt 00008 { 00017 template<typename T> 00018 class ConnOutputEndpoint : public ChannelElement<T> 00019 { 00020 ConnectionBasePtr port; 00021 public: 00030 ConnOutputEndpoint(ConnectionBasePtr port) 00031 : port(port) 00032 { 00033 // cid is deleted/owned by the port's ConnectionManager. 00034 } 00035 00036 ~ConnOutputEndpoint() 00037 { 00038 } 00039 00047 bool inputReady() 00048 { 00049 // cid is deleted/owned by the ConnectionManager. 00050 port->addConnection(this); 00051 return ChannelElement<T>::inputReady(); 00052 } 00053 00054 using ChannelElement<T>::write; 00055 00059 virtual bool write(typename ChannelElement<T>::param_t sample) 00060 { return false; } 00061 00062 virtual void disconnect(bool forward) 00063 { 00064 // // Call the base class: it does the common cleanup 00065 // base::ChannelElement<T>::disconnect(forward); 00066 // 00067 // InputPort<T>* port = this->port; 00068 // if (port && forward) 00069 // { 00070 // this->port = 0; 00071 // port->removeConnection(cid); 00072 // } 00073 } 00074 00075 virtual bool signal() 00076 { 00077 // InputPort<T>* port = this->port; 00078 //#ifdef ORO_SIGNALLING_PORTS 00079 // if (port && port->new_data_on_port_event) 00080 // (*port->new_data_on_port_event)(port); 00081 //#else 00082 // if (port ) 00083 // port->signal(); 00084 //#endif 00085 return true; 00086 } 00087 00088 virtual bool data_sample(typename ChannelElement<T>::param_t sample) 00089 { 00090 return true; 00091 } 00092 00093 }; 00094 00095 } 00096 00097 #endif