RemotePorts.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Thu Oct 22 11:59:07 CEST 2009 RemotePorts.hpp
3 
4  RemotePorts.hpp - description
5  -------------------
6  begin : Thu October 22 2009
7  copyright : (C) 2009 Peter Soetens
8  email : peter@thesourcworks.com
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 RTT_CORBA_REMOTE_PORTS_HPP
40 #define RTT_CORBA_REMOTE_PORTS_HPP
41 
42 #include "../../base/PortInterface.hpp"
43 #include "../../base/ChannelElement.hpp"
44 #include "../../InputPort.hpp"
45 #include "../../OutputPort.hpp"
46 #include "DataFlowI.h"
47 #include <cassert>
48 
49 namespace RTT {
50  namespace corba {
61  template<typename PortClass>
62  class RemotePort : public PortClass
63  {
64  protected:
66  CDataFlowInterface_var dataflow;
67  PortableServer::POA_var mpoa;
68 
69  bool connectionAdded( base::ChannelElementBase::shared_ptr channel, ConnPolicy const& policy ) { assert(false && "Can/Should not add connection to remote port object !");return false; }
70 
71  public:
72  RemotePort(types::TypeInfo const* type_info,
73  CDataFlowInterface_ptr dataflow,
74  std::string const& name,
75  PortableServer::POA_ptr poa);
76 
77  PortableServer::POA_ptr _default_POA();
78  CDataFlowInterface_ptr getDataFlowInterface() const;
79 
80  internal::ConnID* getPortID() const;
81 
82  types::TypeInfo const* getTypeInfo() const;
83  int serverProtocol() const;
84  bool connected() const;
85  bool createStream( const ConnPolicy& policy );
86  virtual bool addConnection(internal::ConnID* port_id, base::ChannelElementBase::shared_ptr channel_input, ConnPolicy const& policy);
87  virtual void disconnect();
88  using PortClass::disconnect;
90  };
91 
98  : public RemotePort<base::OutputPortInterface>
99  {
100  public:
102  CDataFlowInterface_ptr dataflow,
103  std::string const& name,
104  PortableServer::POA_ptr poa);
105 
106  bool keepsLastWrittenValue() const;
107  void keepLastWrittenValue(bool new_flag);
108 
109  virtual bool disconnect(PortInterface* port);
111 
112  bool createConnection( base::InputPortInterface& sink, ConnPolicy const& policy );
114 
115  virtual base::DataSourceBase::shared_ptr getDataSource() const;
116 
117  base::PortInterface* clone() const;
118  base::PortInterface* antiClone() const;
119  };
120 
128  : public RemotePort<base::InputPortInterface>
129  {
130  protected:
139 
140  public:
142  CDataFlowInterface_ptr dataflow,
143  std::string const& name,
144  PortableServer::POA_ptr poa);
145 
146  void clear();
147 
160  base::ChannelElementBase::shared_ptr buildRemoteChannelOutput(
161  base::OutputPortInterface& output_port,
162  types::TypeInfo const* type,
163  base::InputPortInterface& reader_,
164  ConnPolicy const& policy);
165 
170  bool createConnection( internal::SharedConnectionBase::shared_ptr shared_connection, ConnPolicy const& policy = ConnPolicy() );
172 
173  base::PortInterface* clone() const;
174  base::PortInterface* antiClone() const;
175 
176  virtual bool disconnect(PortInterface* port);
178 
179  base::DataSourceBase* getDataSource();
180  };
181  }
182 }
183 
184 #endif
185 
virtual bool createConnection(internal::SharedConnectionBase::shared_ptr shared_connection, ConnPolicy const &policy=ConnPolicy())
virtual bool addConnection(internal::ConnID *, base::ChannelElementBase::shared_ptr, ConnPolicy const &)
bool createStream(const ConnPolicy &policy)
Definition: RemotePorts.cpp:91
boost::intrusive_ptr< SharedConnectionBase > shared_ptr
The base class for all internal data representations.
CDataFlowInterface_var dataflow
Definition: RemotePorts.hpp:66
types::TypeInfo const * type_info
Definition: RemotePorts.hpp:65
bool connectionAdded(base::ChannelElementBase::shared_ptr channel, ConnPolicy const &policy)
Definition: RemotePorts.hpp:69
bool connected() const
Definition: RemotePorts.cpp:71
virtual bool addConnection(internal::ConnID *port_id, base::ChannelElementBase::shared_ptr channel_input, ConnPolicy const &policy)
Definition: RemotePorts.cpp:98
types::TypeInfo const * getTypeInfo() const
Definition: RemotePorts.cpp:67
virtual void disconnect()
Definition: RemotePorts.cpp:76
RemotePort(types::TypeInfo const *type_info, CDataFlowInterface_ptr dataflow, std::string const &name, PortableServer::POA_ptr poa)
Definition: RemotePorts.cpp:54
PortableServer::POA_ptr _default_POA()
Definition: RemotePorts.cpp:83
bool createConnection(InputPortInterface &sink)
base::ChannelElementBase * getEndpoint() const
internal::ConnID * getPortID() const
Definition: RemotePorts.cpp:87
PortableServer::POA_var mpoa
Definition: RemotePorts.hpp:67
CDataFlowInterface_ptr getDataFlowInterface() const
Definition: RemotePorts.cpp:64
boost::intrusive_ptr< ChannelElementBase > shared_ptr
int serverProtocol() const
Definition: RemotePorts.cpp:69
boost::intrusive_ptr< DataSourceBase > shared_ptr
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53


rtt
Author(s): RTT Developers
autogenerated on Fri Oct 25 2019 03:59:35