TaskContextProxy.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Wed Jan 18 14:09:48 CET 2006 TaskContextProxy.hpp
3 
4  TaskContextProxy.hpp - description
5  -------------------
6  begin : Wed January 18 2006
7  copyright : (C) 2006 Peter Soetens
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 ORO_CORBA_CONTROLTASK_PROXY_HPP
39 #define ORO_CORBA_CONTROLTASK_PROXY_HPP
40 
41 
42 #ifndef _REENTRANT
43 #define _REENTRANT
44 #endif
45 #include "corba.h"
46 #ifdef CORBA_IS_TAO
47 #include "corba.h"
48 #else
49 #include <omniORB4/CORBA.h>
50 #endif
51 
52 #include <exception>
53 #include "../../TaskContext.hpp"
54 #include <string>
55 #include <map>
56 #include "TaskContextC.h"
57 #include "ApplicationServer.hpp"
58 #include <list>
59 
60 namespace RTT
61 {namespace corba
62 {
67  : public std::exception
68  {
69  std::string reason;
70  IllegalServer();
71  IllegalServer(const std::string& reason);
72  ~IllegalServer() throw();
73  const char* what() const throw();
74  };
75 
82  class RTT_CORBA_API TaskContextProxy
83  : public TaskContext,
84  public ApplicationServer
85  {
86  public:
87  typedef std::map<TaskContextProxy*, corba::CTaskContext_ptr> PMap;
88  static PMap proxies;
89 
90  protected:
95  TaskContextProxy(std::string location, bool is_ior);
96 
101 
106  TaskContextProxy( ::RTT::corba::CTaskContext_ptr t );
107 
114  std::list<base::PortInterface*> port_proxies;
115 
119  void initFromURIOrTaskname(std::string location, bool is_ior);
120 
121  void synchronize();
122 
123  mutable corba::CTaskContext_var mtask;
124 
128  static PortableServer::POA_var proxy_poa;
129 
130  void synchronizeRequesters(ServiceRequester::shared_ptr parent, CServiceRequester_ptr csrq, const CServiceRequesterDescription & cdescription);
131  void synchronizeServices(Service::shared_ptr parent, CService_ptr serv, const CServiceDescription & cdescription);
132  void synchronizePorts(Service::shared_ptr parent, CDataFlowInterface_ptr dfact, const CServiceDescription & cdescription);
133 
134  public:
135  ~TaskContextProxy();
136 
140  static void DestroyOrb();
141 
149  static TaskContextProxy* Create(std::string name, bool is_ior = false);
150 
157  static TaskContextProxy* CreateFromFile(std::string filename);
158 
168  static TaskContext* Create(::RTT::corba::CTaskContext_ptr task, bool force_remote = false);
169 
177  corba::CTaskContext_ptr server() const;
178 
179  virtual bool activate();
180 
181  virtual bool start();
182 
183  virtual bool stop();
184 
185  virtual bool isRunning() const;
186 
187  virtual bool configure();
188 
189  virtual bool cleanup();
190 
191  virtual bool recover();
192 
193  virtual bool isActive() const;
194 
195  virtual bool isConfigured() const;
196 
197  virtual bool inFatalError() const;
198 
199  virtual bool inRunTimeError() const;
200 
201  virtual bool inException() const;
202 
203  virtual TaskState getTaskState() const;
204 
205  virtual void setName(const std::string& n);
206 
207  virtual bool addPeer( TaskContext* peer, std::string alias = "" );
208 
209  virtual void removePeer( const std::string& name );
210 
211  virtual void removePeer( TaskContext* peer );
212 
213  virtual bool connectPeers( TaskContext* peer );
214 
215  virtual void disconnectPeers( const std::string& name );
216 
217  virtual PeerList getPeerList() const;
218 
219  virtual bool hasPeer( const std::string& peer_name ) const;
220 
221  virtual TaskContext* getPeer(const std::string& peer_name ) const;
222 
223  virtual bool connectPorts( TaskContext* peer );
224 
225  virtual bool connectServices( TaskContext* peer );
226 
227  virtual bool ready();
231  static PortableServer::POA_ptr ProxyPOA();
232  };
233 }}
234 #endif
static PortableServer::POA_var proxy_poa
boost::shared_ptr< ServiceRequester > shared_ptr
boost::shared_ptr< Service > shared_ptr
Definition: Service.hpp:101
corba::CTaskContext_var mtask
const char * what() const
std::vector< std::string > PeerList
std::map< TaskContextProxy *, corba::CTaskContext_ptr > PMap
std::list< base::PortInterface * > port_proxies
bool connectPorts(TaskContext *A, TaskContext *B)
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53
bool connectPeers(TaskContext *A, TaskContext *B)


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