hpp-template-corba: include/hpp/corba/template/server.hh Source File

hpp-template-corba 9.0.2 Template corba server

Loading...
Searching...
No Matches
server.hh
Go to the documentation of this file.
1// Copyright (C) 2009, 2010 by Florent Lamiraux, Thomas Moulard, JRL.
2//
3// This file is part of hpp-template-corba
4//
5// This software is provided "as is" without warranty of any kind,
6// either expressed or implied, including but not limited to the
7// implied warranties of fitness for a particular purpose.
8//
9// See the COPYING file for more information.
10
11#ifndef HPP_CORBA_SERVER_HH
12#define HPP_CORBA_SERVER_HH
13
14#include <omniORB4/CORBA.h>
15
16#include <string>
17
18 namespace hpp {
19 namespace corba {
20 class ServerBase {
21 public:
29 ServerBase(int argc, const char* argv[], const char* orb_identifier = "",
30 const char* options[][2] = 0);
31
40 bool initORB(int argc, const char* argv[], const char* orb_identifier,
41 const char* options[][2]);
42 bool initRootPOA(bool inMultiThread);
43 bool initOmniINSPOA();
49 virtual ~ServerBase();
50
62 int startCorbaServer(const std::string& contextId,
63 const std::string& contextKind,
64 const std::string& objectId,
65 const std::string& objectKind);
66
75 int startCorbaServer(const std::string& contextId,
76 const std::string& contextKind);
77
79 int startCorbaServer();
80
84 int processRequest(bool loop);
85
86 PortableServer::POA_var main_poa() { return main_poa_; }
87
89 PortableServer::POA_var poa() { return poa_; }
90
91 CORBA::ORB_var orb() { return orb_; }
92
93 protected:
94 CORBA::ORB_var orb_;
95 PortableServer::POA_var poa_, main_poa_, ins_poa_;
96
98 CosNaming::NamingContext_var hppContext_;
99
100 void setServant(CORBA::Object_ptr obj);
101
102 private:
104 CORBA::Object_var servant_;
105
107 bool createHppContext(const std::string& id, const std::string kind);
108
110 bool bindObjectToName(CORBA::Object_ptr objref, CosNaming::Name objectName);
111
113 bool bindObjectToName(CosNaming::NamingContext_ptr context,
114 CORBA::Object_ptr objref, CosNaming::Name objectName);
115};
116
123 template <class T>
124 class Server : public ServerBase {
125 public:
133 Server(int argc, const char* argv[], const char* orb_identifier = "",
134 const char* options[][2] = 0);
135
145 bool initRootPOA(bool inMultiThread);
152 bool initOmniINSPOA(const char* object_id);
158 ~Server();
159
161 T& implementation();
162
163 private:
164 T* impl_;
165
168 PortableServer::ObjectId_var servantId_;
169
171 CosNaming::NamingContext_var hppContext_;
172
174 bool createHppContext(const std::string& id, const std::string kind);
175
177 bool bindObjectToName(CORBA::Object_ptr objref, CosNaming::Name objectName);
178
180 bool bindObjectToName(CosNaming::NamingContext_ptr context,
181 CORBA::Object_ptr objref, CosNaming::Name objectName);
182
186 void deactivateAndDestroyServers();
187};
188
189} // end of namespace corba.
190} // end of namespace hpp.
191
192#include "hpp/corba/template/server.hxx"
193#endif
hpp::corba::ServerBase
Definition server.hh:20
hpp::corba::ServerBase::poa_
PortableServer::POA_var poa_
Definition server.hh:95
hpp::corba::ServerBase::~ServerBase
virtual ~ServerBase()
Shutdown CORBA server.
hpp::corba::ServerBase::main_poa
PortableServer::POA_var main_poa()
Definition server.hh:86
hpp::corba::ServerBase::hppContext_
CosNaming::NamingContext_var hppContext_
Corba context.
Definition server.hh:98
hpp::corba::ServerBase::main_poa_
PortableServer::POA_var main_poa_
Definition server.hh:95
hpp::corba::ServerBase::initORB
bool initORB(int argc, const char *argv[], const char *orb_identifier, const char *options[][2])
hpp::corba::ServerBase::ins_poa_
PortableServer::POA_var ins_poa_
Definition server.hh:95
hpp::corba::ServerBase::initOmniINSPOA
bool initOmniINSPOA()
hpp::corba::ServerBase::setServant
void setServant(CORBA::Object_ptr obj)
hpp::corba::ServerBase::startCorbaServer
int startCorbaServer(const std::string &contextId, const std::string &contextKind, const std::string &objectId, const std::string &objectKind)
Initialize CORBA server to process requests from clients and declare it to the NameService (DNS for C...
hpp::corba::ServerBase::orb
CORBA::ORB_var orb()
Definition server.hh:91
hpp::corba::ServerBase::startCorbaServer
int startCorbaServer(const std::string &contextId, const std::string &contextKind)
Initialize CORBA server to process requests from clients and declare it to the NameService (DNS for C...
hpp::corba::ServerBase::orb_
CORBA::ORB_var orb_
Definition server.hh:94
hpp::corba::ServerBase::initRootPOA
bool initRootPOA(bool inMultiThread)
hpp::corba::ServerBase::ServerBase
ServerBase(int argc, const char *argv[], const char *orb_identifier="", const char *options[][2]=0)
Constructor.
hpp::corba::ServerBase::processRequest
int processRequest(bool loop)
If ORB work is pending, process it.
hpp::corba::ServerBase::poa
PortableServer::POA_var poa()
The Portable Object Adapter used to active the server.
Definition server.hh:89
hpp::corba::ServerBase::startCorbaServer
int startCorbaServer()
Initialize CORBA server to process requests from clients.
hpp::corba::Server
Template CORBA server.
Definition server.hh:124
hpp::corba::Server::initRootPOA
bool initRootPOA(bool inMultiThread)
Definition server.hxx:74
hpp::corba::Server::implementation
T & implementation()
Return a reference to the implementation.
Definition server.hxx:69
hpp::corba::Server::~Server
~Server()
Shutdown CORBA server.
Definition server.hxx:64
hpp
Definition server.hh:18
server.hxx