Ice 3.7 C++98 API Reference
Loading...
Searching...
No Matches
Application.h
Go to the documentation of this file.
1//
2// Copyright (c) ZeroC, Inc. All rights reserved.
3//
4
5#ifndef GLACIER2_APPLICATION_H
6#define GLACIER2_APPLICATION_H
7
8#include <Ice/Application.h>
9
10#include <Glacier2/Session.h>
11#include <Glacier2/Router.h>
12
13namespace Glacier2
14{
15
22class GLACIER2_API RestartSessionException : public IceUtil::ExceptionHelper<RestartSessionException>
23{
24public:
25
26 virtual std::string ice_id() const;
27#ifndef ICE_CPP11_MAPPING
29#endif
30};
31
59{
60public:
61
66 Application(Ice::SignalPolicy = Ice::ICE_ENUM(SignalPolicy,HandleSignals));
67
68#ifdef ICE_CPP11_MAPPING
69 Application(const Application&) = delete;
70 Application& operator=(const Application&) = delete;
71#endif
72
81
99 virtual int runWithSession(int argc, char* argv[]) = 0;
100
108 virtual void sessionDestroyed();
109
117 static void restart();
118
124
130
138 static std::string categoryForClient();
139
145 static Ice::Identity createCallbackIdentity(const std::string&);
146
153
159
160protected:
161
165 virtual int doMain(int argc, char* argv[], const Ice::InitializationData& initData, int version);
166
167private:
168
169 bool doMain(Ice::StringSeq&, const Ice::InitializationData&, int&, int);
170
171 //
172 // Run should not be overridden for Glacier2::Application. Instead
173 // runWithSession should be used.
174 //
175 int run(int, char*[])
176 {
177 // This shouldn't be called.
178 assert(false);
179 return 0;
180 }
181
182 static Ice::ObjectAdapterPtr _adapter;
183 static Glacier2::RouterPrxPtr _router;
184 static Glacier2::SessionPrxPtr _session;
185 static std::string _category;
186};
187
188}
189
190#endif
#define GLACIER2_API
Definition PermissionsVerifierF.h:50
static std::string categoryForClient()
Returns the category to be used in the identities of all of the client's callback objects.
static Glacier2::RouterPrxPtr router()
Returns the Glacier2 router proxy.
virtual Glacier2::SessionPrxPtr createSession()=0
Creates a new Glacier2 session.
static Ice::Identity createCallbackIdentity(const std::string &)
Create a new Ice identity for callback objects with the given identity name field.
static Ice::ObjectPrxPtr addWithUUID(const Ice::ObjectPtr &servant)
Adds a servant to the callback object adapter's Active Servant Map with a UUID.
static Glacier2::SessionPrxPtr session()
Returns the Glacier2 session proxy.
virtual void sessionDestroyed()
Called when the session refresh thread detects that the session has been destroyed.
static void restart()
Called to restart the application's Glacier2 session.
virtual int runWithSession(int argc, char *argv[])=0
Called once the communicator has been initialized and the Glacier2 session has been established.
static Ice::ObjectAdapterPtr objectAdapter()
Creates an object adapter for callback objects.
Application(Ice::SignalPolicy=Ice::HandleSignals)
Initializes an instance that calls Ice::Communicator::shutdown if a signal is received.
virtual int doMain(int argc, char *argv[], const Ice::InitializationData &initData, int version)
Helper function that implements the application logic.
This exception is raised if the session should be restarted.
Definition Application.h:23
virtual std::string ice_id() const
Returns the type ID of this exception.
virtual RestartSessionException * ice_clone() const
Returns a shallow polymorphic copy of this exception.
Helper template for the implementation of Ice::Exception.
Definition Exception.h:161
Singleton helper class that simplifies Ice initialization, finalization and signal handling.
Definition Application.h:40
Definition PermissionsVerifier.h:524
RouterPrx RouterPrxPtr
Definition Router.h:790
SessionPrx SessionPrxPtr
Definition Session.h:1521
::std::vector< ::std::string > StringSeq
A sequence of strings.
Definition BuiltinSequences.h:153
IceInternal::Handle< Object > ObjectPtr
Definition ObjectF.h:21
SignalPolicy
Definition Application.h:27
::IceInternal::Handle< ObjectAdapter > ObjectAdapterPtr
Definition ObjectAdapter.h:620
ObjectPrx ObjectPrxPtr
Definition ProxyF.h:48
The identity of an Ice object.
Definition Identity.h:144
Encapsulates data to initialize a communicator.
Definition Initialize.h:279