00001 #ifndef ROSRTT_CHANNEL_BASE_HPP 00002 #define ROSRTT_CHANNEL_BASE_HPP 00003 00004 #include "oro_arch.h" 00005 #include <utility> 00006 #include <boost/intrusive_ptr.hpp> 00007 #include <boost/call_traits.hpp> 00008 00009 //#include <rtt/os/Mutex.hpp> 00010 //#include "rtt-base-fwd.hpp" 00011 00012 namespace hpcl_rtt 00013 { 00014 00022 class ChannelElementBase 00023 { 00024 public: 00025 typedef boost::intrusive_ptr<ChannelElementBase> shared_ptr; 00026 00027 private: 00028 oro_atomic_t refcount; 00029 friend void intrusive_ptr_add_ref( ChannelElementBase* e ); 00030 friend void intrusive_ptr_release( ChannelElementBase* e ); 00031 00032 shared_ptr input; 00033 shared_ptr output; 00034 00035 //There used to be a Mutex, waited to be fixed. 00036 //RTT::os::Mutex inout_lock; 00037 00038 protected: 00040 void ref(); 00043 void deref(); 00044 00045 public: 00051 ChannelElementBase(); 00052 virtual ~ChannelElementBase(); 00053 00058 void removeInput(); 00066 ChannelElementBase::shared_ptr getInput(); 00067 00074 ChannelElementBase::shared_ptr getInputEndPoint(); 00075 00076 00080 ChannelElementBase::shared_ptr getOutput(); 00081 00088 ChannelElementBase::shared_ptr getOutputEndPoint(); 00089 00097 void setOutput(shared_ptr output); 00098 00104 virtual bool signal(); 00105 00113 virtual bool inputReady(); 00114 00121 virtual void clear(); 00122 00127 virtual void disconnect(bool forward); 00128 00129 }; 00130 00131 void intrusive_ptr_add_ref( ChannelElementBase* e ); 00132 void intrusive_ptr_release( ChannelElementBase* e ); 00133 00134 } 00135 00136 #endif 00137