TaskContextProxy.hpp
Go to the documentation of this file.
00001 /***************************************************************************
00002   tag: Peter Soetens  Wed Jan 18 14:09:48 CET 2006  TaskContextProxy.hpp
00003 
00004                         TaskContextProxy.hpp -  description
00005                            -------------------
00006     begin                : Wed January 18 2006
00007     copyright            : (C) 2006 Peter Soetens
00008     email                : peter.soetens@fmtc.be
00009 
00010  ***************************************************************************
00011  *   This library is free software; you can redistribute it and/or         *
00012  *   modify it under the terms of the GNU General Public                   *
00013  *   License as published by the Free Software Foundation;                 *
00014  *   version 2 of the License.                                             *
00015  *                                                                         *
00016  *   As a special exception, you may use this file as part of a free       *
00017  *   software library without restriction.  Specifically, if other files   *
00018  *   instantiate templates or use macros or inline functions from this     *
00019  *   file, or you compile this file and link it with other files to        *
00020  *   produce an executable, this file does not by itself cause the         *
00021  *   resulting executable to be covered by the GNU General Public          *
00022  *   License.  This exception does not however invalidate any other        *
00023  *   reasons why the executable file might be covered by the GNU General   *
00024  *   Public License.                                                       *
00025  *                                                                         *
00026  *   This library is distributed in the hope that it will be useful,       *
00027  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00028  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00029  *   Lesser General Public License for more details.                       *
00030  *                                                                         *
00031  *   You should have received a copy of the GNU General Public             *
00032  *   License along with this library; if not, write to the Free Software   *
00033  *   Foundation, Inc., 59 Temple Place,                                    *
00034  *   Suite 330, Boston, MA  02111-1307  USA                                *
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 
00100         TaskContextProxy();
00101         
00106         TaskContextProxy( ::RTT::corba::CTaskContext_ptr t );
00107 
00114         std::list<base::PortInterface*> port_proxies;
00115 
00119         void initFromURIOrTaskname(std::string location, bool is_ior);
00120         
00121         void synchronize();
00122 
00123         mutable corba::CTaskContext_var mtask;
00124 
00128         static PortableServer::POA_var proxy_poa;
00129 
00130         void fetchRequesters(ServiceRequester::shared_ptr parent, CServiceRequester_ptr csrq);
00131         void fetchServices(Service::shared_ptr parent, CService_ptr mtask);
00132         void fetchPorts(Service::shared_ptr parent, CDataFlowInterface_ptr serv);
00133     public:
00134         ~TaskContextProxy();
00135 
00139         static void DestroyOrb();
00140 
00148         static TaskContextProxy* Create(std::string name, bool is_ior = false);
00149 
00156         static TaskContextProxy* CreateFromFile(std::string filename);
00157 
00167         static TaskContext* Create(::RTT::corba::CTaskContext_ptr task, bool force_remote = false);
00168 
00176         corba::CTaskContext_ptr server() const;
00177 
00178         virtual bool activate();
00179 
00180         virtual bool start();
00181 
00182         virtual bool stop();
00183 
00184         virtual bool isRunning() const;
00185 
00186         virtual bool configure();
00187 
00188         virtual bool cleanup();
00189 
00190         virtual bool isActive() const;
00191 
00192         virtual bool isConfigured() const;
00193 
00194         virtual bool inFatalError() const;
00195 
00196         virtual bool inRunTimeError() const;
00197 
00198         virtual TaskState getTaskState() const;
00199 
00200         virtual void setName(const std::string& n);
00201 
00202         virtual bool addPeer( TaskContext* peer, std::string alias = "" );
00203 
00204         virtual void removePeer( const std::string& name );
00205 
00206         virtual void removePeer( TaskContext* peer );
00207 
00208         virtual bool connectPeers( TaskContext* peer );
00209 
00210         virtual void disconnectPeers( const std::string& name );
00211 
00212         virtual PeerList getPeerList() const;
00213 
00214         virtual bool hasPeer( const std::string& peer_name ) const;
00215 
00216         virtual TaskContext* getPeer(const std::string& peer_name ) const;
00217 
00218         virtual bool connectPorts( TaskContext* peer );
00219 
00220         virtual bool connectServices( TaskContext* peer );
00221 
00222         virtual bool ready();
00226         static PortableServer::POA_ptr ProxyPOA();
00227     };
00228 }}
00229 #endif


rtt
Author(s): RTT Developers
autogenerated on Fri Sep 9 2016 04:02:15