ControlTaskServer.hpp

00001 /***************************************************************************
00002   tag: Peter Soetens  Wed Jan 18 14:09:48 CET 2006  ControlTaskServer.hpp
00003 
00004                         ControlTaskServer.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_SERVER_HPP
00039 #define ORO_CORBA_CONTROLTASK_SERVER_HPP
00040 
00041 #include <map>
00042 #include "../rtt-config.h"
00043 #ifndef _REENTRANT
00044 #define _REENTRANT
00045 #endif
00046 #include "corba.h"
00047 #ifdef CORBA_IS_TAO
00048 #include <tao/corba.h>
00049 #include "ControlTaskS.h"
00050 #else
00051 #include <omniORB4/CORBA.h>
00052 #include "ControlTaskC.h"
00053 #endif
00054 #include "../TaskContext.hpp"
00055 #include "ApplicationServer.hpp"
00056 #include "../ActivityInterface.hpp"
00057 
00058 namespace RTT
00059 {namespace Corba
00060 {
00061     class OrbRunner;
00062     class ControlTaskProxy;
00063 
00070     class RTT_CORBA_API ControlTaskServer
00071         : public ApplicationServer
00072     {
00073     protected:
00074         friend class OrbRunner;
00075         friend class ControlTaskProxy;
00076 
00077         typedef std::map<TaskContext*, ControlTaskServer*> ServerMap;
00078         static ServerMap servers;
00079         static ActivityInterface* orbrunner;
00080         static bool is_shutdown;
00081 
00085         ControlTaskServer(TaskContext* taskcontext, bool use_naming, bool require_name_service);
00086 
00087         Corba::ControlTask_var mtask;
00088         TaskContext* mtaskcontext;
00089         bool muse_naming;
00090 
00095       ~ControlTaskServer();
00096 
00101         static void DoShutdownOrb(bool wait_for_completion = true);
00102     public:
00103 
00109         static void ShutdownOrb(bool wait_for_completion = true);
00110 
00114         static void CleanupServers();
00115 
00120         static void RunOrb();
00121 
00127         static void ThreadOrb();
00128 
00132         static void DestroyOrb();
00133 
00143         static ControlTaskServer* Create(TaskContext* tc, bool use_naming = true, bool require_name_service = false);
00144 
00156         static ControlTask_ptr CreateServer(TaskContext* tc, bool use_naming = true, bool require_name_service = false);
00157 
00162         static void CleanupServer( TaskContext* tc );
00163 
00169         ControlTask_ptr server() const;
00170     };
00171 }}
00172 #endif
Generated on Thu Dec 23 13:22:36 2010 for Orocos Real-Time Toolkit by  doxygen 1.6.3