DataFlowI.h
Go to the documentation of this file.
1 /***************************************************************************
2  tag: FMTC do nov 2 13:06:20 CET 2006 DataFlowI.h
3 
4  DataFlowI.h - description
5  -------------------
6  begin : do november 02 2006
7  copyright : (C) 2006 FMTC
8  email : peter.soetens@fmtc.be
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 #ifndef DATAFLOWI_H_
39 #define DATAFLOWI_H_
40 
41 #include "corba.h"
42 #ifdef CORBA_IS_TAO
43 #include "DataFlowS.h"
44 #else
45 #include "DataFlowC.h"
46 #endif
47 #include "CorbaConversion.hpp"
48 #include "../../base/ChannelElement.hpp"
49 #include "../../internal/DataSources.hpp"
50 #include "CorbaTypeTransporter.hpp"
51 #include <list>
52 #include <rtt/os/Mutex.hpp>
53 
54 #if !defined (ACE_LACKS_PRAGMA_ONCE)
55 #pragma once
56 #endif /* ACE_LACKS_PRAGMA_ONCE */
57 
58 
59 namespace RTT {
60 
61  namespace corba {
62  class CDataFlowInterface_i;
63 
69  class RTT_CORBA_API CRemoteChannelElement_i
70  : public POA_RTT::corba::CRemoteChannelElement
71  , public virtual PortableServer::RefCountServantBase
72  {
73  protected:
74  CRemoteChannelElement_var remote_side;
76  PortableServer::POA_var mpoa;
78 
79  public:
80  // standard constructor
82  PortableServer::POA_ptr poa);
83  virtual ~CRemoteChannelElement_i();
84 
85  virtual RTT::corba::CRemoteChannelElement_ptr activate_this() {
86  PortableServer::ObjectId_var oid = mpoa->activate_object(this); // ref count=2
87  _remove_ref(); // ref count=1
88  return _this();
89  }
90 
91  virtual void transferSamples() = 0;
92 
94  mdataflow = dataflow;
95  }
96 
97  PortableServer::POA_ptr _default_POA();
98 
99  void setRemoteSide(CRemoteChannelElement_ptr remote) ACE_THROW_SPEC ((
100  CORBA::SystemException
101  ));
102  };
103 
111  class RTT_CORBA_API CDataFlowInterface_i
112  : public virtual POA_RTT::corba::CDataFlowInterface
113  {
115  PortableServer::POA_var mpoa;
116 
120  struct ServantInfo
121  {
122  RTT::corba::CDataFlowInterface_var objref;
125  ServantInfo(CDataFlowInterface_var objref, CDataFlowInterface_i* servant)
126  : objref(objref), servant(servant) {}
127  };
128  typedef std::list<ServantInfo> ServantMap;
129  static ServantMap s_servant_map;
130 
131  typedef std::list<
132  std::pair<RTT::corba::CChannelElement_var, base::ChannelElementBase::shared_ptr>
135  // Lock that should be taken before access to channel_list
137  public:
138  // standard constructor
139  CDataFlowInterface_i(DataFlowInterface* interface, PortableServer::POA_ptr poa);
140  virtual ~CDataFlowInterface_i();
141 
142  DataFlowInterface* getDataFlowInterface() const;
143 
144  static void registerServant(CDataFlowInterface_ptr objref, CDataFlowInterface_i* servant);
145  static void deregisterServant(DataFlowInterface* obj);
146  static void clearServants();
147  static DataFlowInterface* getLocalInterface(CDataFlowInterface_ptr objref);
148 
150  void deregisterChannel(CChannelElement_ptr channel);
151 
156  static CDataFlowInterface_ptr getRemoteInterface(DataFlowInterface* dfi, PortableServer::POA_ptr poa);
157 
158  virtual RTT::corba::CDataFlowInterface_ptr activate_this() {
159  PortableServer::ObjectId_var oid = mpoa->activate_object(this); // ref count=2
160  //_remove_ref(); // ref count=1
161  return _this();
162  }
163 
164  PortableServer::POA_ptr _default_POA();
165 
166  // methods corresponding to defined IDL attributes and operations
167  RTT::corba::CDataFlowInterface::CPortNames* getPorts() ACE_THROW_SPEC ((
168  CORBA::SystemException
169  ));
170  RTT::corba::CDataFlowInterface::CPortDescriptions* getPortDescriptions() ACE_THROW_SPEC ((
171  CORBA::SystemException
172  ));
173  RTT::corba::CPortType getPortType(const char* port_name) ACE_THROW_SPEC ((
174  CORBA::SystemException
175  ,::RTT::corba::CNoSuchPortException
176  ));
177  char* getDataType(const char* port_name) ACE_THROW_SPEC ((
178  CORBA::SystemException
179  ,::RTT::corba::CNoSuchPortException
180  ));
181  ::CORBA::Boolean isConnected(const char* port_name) ACE_THROW_SPEC ((
182  CORBA::SystemException
183  ,::RTT::corba::CNoSuchPortException
184  ));
185  void disconnectPort(const char* port_name) ACE_THROW_SPEC ((
186  CORBA::SystemException
187  ,::RTT::corba::CNoSuchPortException
188  ));
189 
190  CChannelElement_ptr buildChannelOutput(const char* input_port, RTT::corba::CConnPolicy& policy) ACE_THROW_SPEC ((
191  CORBA::SystemException
192  ,::RTT::corba::CNoCorbaTransport
193  ,::RTT::corba::CNoSuchPortException
194  ,::RTT::corba::CInvalidArgument
195  ));
196 
197  CChannelElement_ptr buildChannelInput(const char* output_port, RTT::corba::CConnPolicy& policy) ACE_THROW_SPEC ((
198  CORBA::SystemException
199  ,::RTT::corba::CNoCorbaTransport
200  ,::RTT::corba::CNoSuchPortException
201  ,::RTT::corba::CInvalidArgument
202  ));
203 
204  ::CORBA::Boolean createConnection( const char* writer_port,
205  CDataFlowInterface_ptr reader_interface,
206  const char* reader_port,
207  RTT::corba::CConnPolicy & policy) ACE_THROW_SPEC ((
208  CORBA::SystemException
209  ,::RTT::corba::CNoSuchPortException
210  ));
211 
212  ::CORBA::Boolean createSharedConnection(const char *input_port, RTT::corba::CConnPolicy& policy) ACE_THROW_SPEC ((
213  CORBA::SystemException
214  ,::RTT::corba::CNoSuchPortException
215  ,::RTT::corba::CInvalidArgument
216  ));
217 
218  bool removeConnection( const char* writer_port,
219  CDataFlowInterface_ptr reader_interface,
220  const char* reader_port) ACE_THROW_SPEC ((
221  CORBA::SystemException
222  ,::RTT::corba::CNoSuchPortException
223  ));
224 
225  ::CORBA::Boolean createStream( const char* port,
226  RTT::corba::CConnPolicy & policy) ACE_THROW_SPEC ((
227  CORBA::SystemException
228  ,::RTT::corba::CNoSuchPortException
229  ));
230 
231  void removeStream( const char* port, const char* stream_name) ACE_THROW_SPEC ((
232  CORBA::SystemException
233  ,::RTT::corba::CNoSuchPortException
234  ));
235  };
236  }
237 }
238 
239 
240 #endif /* DATAFLOWI_H_ */
241 
std::list< std::pair< RTT::corba::CChannelElement_var, base::ChannelElementBase::shared_ptr > > ChannelList
Definition: DataFlowI.h:133
std::list< ServantInfo > ServantMap
Definition: DataFlowI.h:128
RTT::corba::CDataFlowInterface_var objref
Definition: DataFlowI.h:122
RTT::corba::CorbaTypeTransporter const & transport
Definition: DataFlowI.h:75
DataFlowInterface * mdf
Definition: DataFlowI.h:114
PortableServer::POA_var mpoa
Definition: DataFlowI.h:115
RTT::corba::CDataFlowInterface_i * servant
Definition: DataFlowI.h:123
DataFlowInterface * getDataFlowInterface() const
Definition: DataFlowI.cpp:78
#define ACE_THROW_SPEC(x)
Definition: corba.h:67
ServantInfo(CDataFlowInterface_var objref, CDataFlowInterface_i *servant)
Definition: DataFlowI.h:125
CDataFlowInterface_i * mdataflow
Definition: DataFlowI.h:77
virtual RTT::corba::CRemoteChannelElement_ptr activate_this()
Definition: DataFlowI.h:85
static ServantMap s_servant_map
Definition: DataFlowI.h:129
CRemoteChannelElement_var remote_side
Definition: DataFlowI.h:74
An object oriented wrapper around a non recursive mutex.
Definition: Mutex.hpp:92
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
virtual RTT::corba::CDataFlowInterface_ptr activate_this()
Definition: DataFlowI.h:158
DataFlowInterface * getDataFlowInterface() const
Definition: DataFlowI.h:124
PortableServer::POA_var mpoa
Definition: DataFlowI.h:76
void setCDataFlowInterface(CDataFlowInterface_i *dataflow)
Definition: DataFlowI.h:93


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