ConnInputEndPoint.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Thu Oct 22 11:59:08 CEST 2009 ConnInputEndPoint.hpp
3 
4  ConnInputEndPoint.hpp - description
5  -------------------
6  begin : Thu October 22 2009
7  copyright : (C) 2009 Sylvain Joyeux
8  email : sylvain.joyeux@m4x.org
9 
10  ***************************************************************************
11  * This library is free software; you can redistribute it and/or *
12  * modify it under the terms of the GNU General Public *
13  * License as published by the Free Software Foundation; *
14  * version 2 of the License. *
15  * *
16  * As a special exception, you may use this file as part of a free *
17  * software library without restriction. Specifically, if other files *
18  * instantiate templates or use macros or inline functions from this *
19  * file, or you compile this file and link it with other files to *
20  * produce an executable, this file does not by itself cause the *
21  * resulting executable to be covered by the GNU General Public *
22  * License. This exception does not however invalidate any other *
23  * reasons why the executable file might be covered by the GNU General *
24  * Public License. *
25  * *
26  * This library is distributed in the hope that it will be useful, *
27  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
28  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
29  * Lesser General Public License for more details. *
30  * *
31  * You should have received a copy of the GNU General Public *
32  * License along with this library; if not, write to the Free Software *
33  * Foundation, Inc., 59 Temple Place, *
34  * Suite 330, Boston, MA 02111-1307 USA *
35  * *
36  ***************************************************************************/
37 
38 
39 #ifndef ORO_CONN_INPUT_ENDPOINT_HPP
40 #define ORO_CONN_INPUT_ENDPOINT_HPP
41 
42 #include "Channels.hpp"
43 #include "PortConnectionLock.hpp"
44 
45 namespace RTT
46 { namespace internal {
47 
51  template<typename T>
53  {
54  private:
56 
57  public:
59  typedef boost::intrusive_ptr<ConnInputEndpoint<T> > shared_ptr;
60 
62  : port(port) { }
63 
65  {}
66 
68  return true;
69  }
70 
71  using Base::disconnect;
72 
73  virtual bool disconnect(const base::ChannelElementBase::shared_ptr& channel, bool forward)
74  {
75  OutputPort<T>* port = this->port;
76  PortConnectionLock lock(port);
77 
78 // // Lock port connections if the request is coming from the remote end (forward == false)
79 // PortConnectionLock lock(!forward ? port : 0);
80 
81  if (port && channel && !forward)
82  {
83  port->getManager()->removeConnection(channel.get(), /* disconnect = */ false);
84  }
85 
86  // Call the base class: it does the common cleanup
87  if (!Base::disconnect(channel, forward)) {
88  return false;
89  }
90 
91  // If this was the last connection, remove the buffer, too.
92  // For forward == false this was already done by the base class.
93  if (!this->connected() && forward) {
94  Base::disconnect(0, false);
95  }
96 
97  return true;
98  }
99 
100  virtual base::PortInterface* getPort() const {
101  return this->port;
102  }
103 
105  {
106  return this;
107  }
108 
110  {
111  return this->getInput();
112  }
113 
115  {
117  if (buffer) {
118  return buffer;
119  } else {
120  return this;
121  }
122  }
123 
124  std::string getElementName() const {
125  return std::string("ConnInputEndpoint");
126  }
127 
128  };
129 
130 }}
131 
132 #endif
133 
boost::intrusive_ptr< ChannelElement< T > > shared_ptr
virtual base::PortInterface * getPort() const
boost::intrusive_ptr< ConnInputEndpoint< T > > shared_ptr
virtual bool inputReady(base::ChannelElementBase::shared_ptr const &)
virtual bool disconnect(ChannelElementBase::shared_ptr const &channel, bool forward=false)
virtual internal::ConnectionManager * getManager()
virtual bool disconnect(const base::ChannelElementBase::shared_ptr &channel, bool forward)
virtual base::ChannelElement< T >::shared_ptr getSharedBuffer()
boost::intrusive_ptr< ChannelElementBase > shared_ptr
virtual base::ChannelElementBase::shared_ptr getInputEndPoint()
ConnInputEndpoint(OutputPort< T > *port)
base::ChannelElement< T >::shared_ptr getWriteEndpoint()
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
base::MultipleOutputsChannelElement< T > Base


rtt
Author(s): RTT Developers
autogenerated on Tue Jun 25 2019 19:33:22