Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #ifndef ORO_CORBA_CONTROLTASK_PROXY_HPP
00039 #define ORO_CORBA_CONTROLTASK_PROXY_HPP
00040
00041
00042 #ifndef _REENTRANT
00043 #define _REENTRANT
00044 #endif
00045 #include "corba.h"
00046 #ifdef CORBA_IS_TAO
00047 #include "corba.h"
00048 #else
00049 #include <omniORB4/CORBA.h>
00050 #endif
00051
00052 #include <exception>
00053 #include "../../TaskContext.hpp"
00054 #include <string>
00055 #include <map>
00056 #include "TaskContextC.h"
00057 #include "ApplicationServer.hpp"
00058 #include <list>
00059
00060 namespace RTT
00061 {namespace corba
00062 {
00066 struct IllegalServer
00067 : public std::exception
00068 {
00069 std::string reason;
00070 IllegalServer();
00071 IllegalServer(const std::string& reason);
00072 ~IllegalServer() throw();
00073 const char* what() const throw();
00074 };
00075
00082 class RTT_CORBA_API TaskContextProxy
00083 : public TaskContext,
00084 public ApplicationServer
00085 {
00086 public:
00087 typedef std::map<TaskContextProxy*, corba::CTaskContext_ptr> PMap;
00088 static PMap proxies;
00089
00090 protected:
00095 TaskContextProxy(std::string location, bool is_ior);
00096
00101 TaskContextProxy( ::RTT::corba::CTaskContext_ptr t );
00102
00109 std::list<base::PortInterface*> port_proxies;
00110
00111 void synchronize();
00112
00113 mutable corba::CTaskContext_var mtask;
00114
00118 static PortableServer::POA_var proxy_poa;
00119
00120 void fetchRequesters(ServiceRequester* parent, CServiceRequester_ptr csrq);
00121 void fetchServices(Service::shared_ptr parent, CService_ptr mtask);
00122 public:
00123 ~TaskContextProxy();
00124
00128 static void DestroyOrb();
00129
00137 static TaskContextProxy* Create(std::string name, bool is_ior = false);
00138
00145 static TaskContextProxy* CreateFromFile(std::string filename);
00146
00156 static TaskContext* Create(::RTT::corba::CTaskContext_ptr task, bool force_remote = false);
00157
00165 corba::CTaskContext_ptr server() const;
00166
00167 virtual bool activate();
00168
00169 virtual bool start();
00170
00171 virtual bool stop();
00172
00173 virtual bool isRunning() const;
00174
00175 virtual bool configure();
00176
00177 virtual bool cleanup();
00178
00179 virtual bool isActive() const;
00180
00181 virtual bool isConfigured() const;
00182
00183 virtual bool inFatalError() const;
00184
00185 virtual bool inRunTimeError() const;
00186
00187 virtual TaskState getTaskState() const;
00188
00189 virtual void setName(const std::string& n);
00190
00191 virtual bool addPeer( TaskContext* peer, std::string alias = "" );
00192
00193 virtual void removePeer( const std::string& name );
00194
00195 virtual void removePeer( TaskContext* peer );
00196
00197 virtual bool connectPeers( TaskContext* peer );
00198
00199 virtual void disconnectPeers( const std::string& name );
00200
00201 virtual PeerList getPeerList() const;
00202
00203 virtual bool hasPeer( const std::string& peer_name ) const;
00204
00205 virtual TaskContext* getPeer(const std::string& peer_name ) const;
00206
00207 virtual bool connectPorts( TaskContext* peer );
00208
00209 virtual bool connectServices( TaskContext* peer );
00210
00211 virtual bool ready();
00215 static PortableServer::POA_ptr ProxyPOA();
00216 };
00217 }}
00218 #endif