TaskContextServer.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  tag: Peter Soetens Wed Jan 18 14:09:48 CET 2006 TaskContextServer.hpp
3 
4  TaskContextServer.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_SERVER_HPP
39 #define ORO_CORBA_CONTROLTASK_SERVER_HPP
40 
41 #include <map>
42 #ifndef _REENTRANT
43 #define _REENTRANT
44 #endif
45 #include "corba.h"
46 #ifdef CORBA_IS_TAO
47 #include "TaskContextS.h"
48 #else
49 #include "TaskContextC.h"
50 #endif
51 #include "../../TaskContext.hpp"
52 #include "ApplicationServer.hpp"
53 #include "../../base/ActivityInterface.hpp"
54 
56 namespace RTT
57 {namespace corba
58 {
65  class RTT_CORBA_API TaskContextServer
66  : public ApplicationServer
67  {
68  protected:
69  friend class OrbRunner;
70  friend class TaskContextProxy;
71 
72  typedef std::map<TaskContext*, TaskContextServer*> ServerMap;
73  static ServerMap servers;
75  static bool is_shutdown;
76 
77  PortableServer::POA_var mpoa;
78 
79  typedef std::map<TaskContext*, std::string> IorMap;
80  static IorMap iors;
81 
85  TaskContextServer(TaskContext* taskcontext, bool use_naming, bool require_name_service);
89  TaskContextServer(TaskContext* taskcontext, const std::string& alias, bool use_naming, bool require_name_service);
90 
91  // initialize a new servant
92  void initTaskContextServer(bool require_name_service);
93 
94  PortableServer::ServantBase_var mtask_i;
95  corba::CTaskContext_var mtask;
98  std::string mregistered_name;
99 
104  static void DoShutdownOrb(bool wait_for_completion = true);
105  public:
106 
112 
118  static void ShutdownOrb(bool wait_for_completion = true);
119 
123  static void CleanupServers();
124 
129  static void RunOrb();
130 
137  static void ThreadOrb();
138 
144  static void ThreadOrb(int scheduler, int priority = RTT::os::LowestPriority, unsigned cpu_affinity = 0);
145 
149  static void DestroyOrb();
150 
160  static TaskContextServer* Create(TaskContext* tc, bool use_naming = true, bool require_name_service = false);
161 
172  static TaskContextServer* Create(TaskContext* tc, const std::string& alias, bool use_naming = true, bool require_name_service = false);
173 
187  static CTaskContext_ptr CreateServer(TaskContext* tc, bool use_naming = true, bool require_name_service = false);
188 
203  static CTaskContext_ptr CreateServer(TaskContext* tc, const std::string& alias, bool use_naming = true, bool require_name_service = false);
204 
209  static void CleanupServer( TaskContext* tc );
210 
217  CTaskContext_ptr server() const;
218 
224  static std::string getIOR(TaskContext* tc);
225 
226 
227  };
228 }}
229 #endif
PortableServer::ServantBase_var mtask_i
PortableServer::POA_var mpoa
static base::ActivityInterface * orbrunner
Interface to start/stop and query a Activity.
corba::CTaskContext_var mtask
std::map< TaskContext *, TaskContextServer * > ServerMap
std::map< TaskContext *, std::string > IorMap
const int LowestPriority
Definition: ecosthreads.cpp:44
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:53


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