channel_element_base.hpp
Go to the documentation of this file.
00001 /* 
00002  *  channel_element_base.hpp - micros base channel element
00003  *  Copyright (C) 2015 Zaile Jiang
00004  *  
00005  *  This program is free software; you can redistribute it and/or
00006  *  modify it under the terms of the GNU General Public License
00007  *  as published by the Free Software Foundation; either version 2
00008  *  of the License, or (at your option) any later version.
00009  *  
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *  
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 */
00019 #ifndef MICROSRTT_CHANNEL_BASE_HPP
00020 #define MICROSRTT_CHANNEL_BASE_HPP
00021 
00022 #include <utility>
00023 #include <boost/intrusive_ptr.hpp>
00024 #include <boost/call_traits.hpp>
00025 #include "micros_rtt/oro/oro_arch.h"
00026 
00027 namespace micros_rtt
00028 {
00029   
00037 class ChannelElementBase
00038 {
00039 public:
00040   typedef boost::intrusive_ptr<ChannelElementBase> shared_ptr;
00041 
00042 private:
00043   oro_atomic_t refcount;
00044   friend void intrusive_ptr_add_ref( ChannelElementBase* e );
00045   friend void intrusive_ptr_release( ChannelElementBase* e );
00046 
00047   shared_ptr input;
00048   shared_ptr output;
00049   
00050 protected:
00052   void ref();
00055   void deref();
00056 
00057 public:
00063   ChannelElementBase();
00064   virtual ~ChannelElementBase();
00065 
00070   void removeInput();
00078   ChannelElementBase::shared_ptr getInput();
00079 
00086   ChannelElementBase::shared_ptr getInputEndPoint();
00087 
00088 
00092   ChannelElementBase::shared_ptr getOutput();
00093 
00100   ChannelElementBase::shared_ptr getOutputEndPoint();
00101 
00109   void setOutput(shared_ptr output);
00110 
00116   virtual bool signal();
00117 
00125   virtual bool inputReady();
00126 
00133   virtual void clear();
00134 
00139   virtual void disconnect(bool forward);
00140 
00141 };
00142 
00143 void intrusive_ptr_add_ref( ChannelElementBase* e );
00144 void intrusive_ptr_release( ChannelElementBase* e );
00145 
00146 }
00147 
00148 #endif
00149 


micros_rtt
Author(s): Zaile Jiang , Xiaodong Yi , Minglong Li
autogenerated on Sat Jun 8 2019 19:02:21