Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
Session.h
1// Copyright (c) ZeroC, Inc.
2
3// slice2cpp version 3.8.0-alpha.0
4// <auto-generated>Generated from Slice file 'Session.ice'.</auto-generated>
5// clang-format off
6
7#ifndef IceGrid_Session_h_
8#define IceGrid_Session_h_
9
11#include <Ice/Ice.h>
12#include "Exception.h"
13#include <Glacier2/Session.h>
14#include <IceGrid/Config.h>
15
16#ifndef ICE_DISABLE_VERSION
17# if ICE_INT_VERSION != 30850
18# error Ice version mismatch: an exact match is required for beta generated code
19# endif
20#endif
21
22#ifndef ICEGRID_API
23# if defined(ICEGRID_API_EXPORTS)
24# define ICEGRID_API ICE_DECLSPEC_EXPORT
25# else
26# define ICEGRID_API ICE_DECLSPEC_IMPORT
27# endif
28#endif
29
30// NOLINTBEGIN(modernize-concat-nested-namespaces)
31
32namespace IceGrid
33{
34 class RegistryPrx;
35
36 class SessionPrx;
37}
38
39namespace IceGrid
40{
41 /// Represents a session object used by IceGrid clients to allocate and release objects. Client sessions are created
42 /// either via the RegistryPrx object or via the registry client ::Glacier2::SessionManagerPrx object.
43 /// @headerfile IceGrid/IceGrid.h
44 class ICEGRID_API SessionPrx : public Ice::Proxy<SessionPrx, ::Glacier2::SessionPrx>
45 {
46 public:
47#if defined(__GNUC__) && !defined(__clang__)
48# pragma GCC diagnostic push
49# pragma GCC diagnostic ignored "-Wextra" // initialize all virtual bases in correct order
50#endif
51
52 /// Constructs a proxy from a Communicator and a proxy string.
53 /// @param communicator The communicator of the new proxy.
54 /// @param proxyString The proxy string to parse.
55 SessionPrx(const Ice::CommunicatorPtr& communicator, std::string_view proxyString) : Ice::ObjectPrx{communicator, proxyString} {} // NOLINT(modernize-use-equals-default)
56
57 /// Copy constructor. Constructs with a copy of the contents of @p other.
58 /// @param other The proxy to copy from.
59 SessionPrx(const SessionPrx& other) noexcept : Ice::ObjectPrx{other} {} // NOLINT(modernize-use-equals-default)
60
61 /// Move constructor. Constructs a proxy with the contents of @p other using move semantics.
62 /// @param other The proxy to move from.
63 SessionPrx(SessionPrx&& other) noexcept : Ice::ObjectPrx{std::move(other)} {} // NOLINT(modernize-use-equals-default)
64
65 ~SessionPrx() override;
66
67 /// Copy assignment operator. Replaces the contents of this proxy with a copy of the contents of @p rhs.
68 /// @param rhs The proxy to copy from.
69 /// @return A reference to this proxy.
70 SessionPrx& operator=(const SessionPrx& rhs) noexcept
71 {
72 if (this != &rhs)
73 {
75 }
76 return *this;
77 }
78
79 /// Move assignment operator. Replaces the contents of this proxy with the contents of @p rhs using move semantics.
80 /// @param rhs The proxy to move from.
82 {
83 if (this != &rhs)
84 {
85 Ice::ObjectPrx::operator=(std::move(rhs));
86 }
87 return *this;
88 }
89
90 /// Keeps the session alive.
91 /// @param context The request context.
92 [[deprecated("As of Ice 3.8, there is no need to call this operation, and its implementation does nothing.")]] void keepAlive(const Ice::Context& context = Ice::noExplicitContext) const;
93
94 /// Keeps the session alive.
95 /// @param context The request context.
96 /// @return A future that becomes available when the invocation completes.
97 [[deprecated("As of Ice 3.8, there is no need to call this operation, and its implementation does nothing.")]] [[nodiscard]] std::future<void> keepAliveAsync(const Ice::Context& context = Ice::noExplicitContext) const;
98
99 /// Keeps the session alive.
100 /// @param response The response callback.
101 /// @param exception The exception callback.
102 /// @param sent The sent callback.
103 /// @param context The request context.
104 /// @return A function that can be called to cancel the invocation locally.
105 // NOLINTNEXTLINE(modernize-use-nodiscard)
106 [[deprecated("As of Ice 3.8, there is no need to call this operation, and its implementation does nothing.")]] std::function<void()> keepAliveAsync(std::function<void()> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;
107
108 /// @private
109 void _iceI_keepAlive(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>&, const Ice::Context&) const;
110
111 /// Allocates an object.
112 /// @param id The identity of the object to allocate.
113 /// @param context The request context.
114 /// @return A proxy to the allocated object. This proxy is never null.
115 /// @throws IceGrid::AllocationException Thrown when the allocation fails.
116 /// @throws IceGrid::ObjectNotRegisteredException Thrown when an object with the given identity is not registered with
117 /// the registry.
118 /// @see #setAllocationTimeout
119 /// @see #releaseObject
120 std::optional<Ice::ObjectPrx> allocateObjectById(const ::Ice::Identity& id, const Ice::Context& context = Ice::noExplicitContext) const; // NOLINT(modernize-use-nodiscard)
121
122 /// Allocates an object.
123 /// @param id The identity of the object to allocate.
124 /// @param context The request context.
125 /// @return A future that becomes available when the invocation completes. This future holds:
126 /// - A proxy to the allocated object. This proxy is never null.
127 /// @see #setAllocationTimeout
128 /// @see #releaseObject
129 [[nodiscard]] std::future<std::optional<Ice::ObjectPrx>> allocateObjectByIdAsync(const ::Ice::Identity& id, const Ice::Context& context = Ice::noExplicitContext) const;
130
131 /// Allocates an object.
132 /// @param id The identity of the object to allocate.
133 /// @param response The response callback. It accepts:
134 /// - A proxy to the allocated object. This proxy is never null.
135 /// @param exception The exception callback.
136 /// @param sent The sent callback.
137 /// @param context The request context.
138 /// @return A function that can be called to cancel the invocation locally.
139 /// @see #setAllocationTimeout
140 /// @see #releaseObject
141 // NOLINTNEXTLINE(modernize-use-nodiscard)
142 std::function<void()> allocateObjectByIdAsync(const ::Ice::Identity& id, std::function<void(std::optional<Ice::ObjectPrx>)> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;
143
144 /// @private
145 void _iceI_allocateObjectById(const std::shared_ptr<IceInternal::OutgoingAsyncT<std::optional<Ice::ObjectPrx>>>&, const ::Ice::Identity&, const Ice::Context&) const;
146
147 /// Allocates an object with the given type.
148 /// @param type The type of the object.
149 /// @param context The request context.
150 /// @return A proxy to the allocated object. This proxy is never null.
151 /// @throws IceGrid::AllocationException Thrown when the allocation fails.
152 /// @see #setAllocationTimeout
153 /// @see #releaseObject
154 std::optional<Ice::ObjectPrx> allocateObjectByType(std::string_view type, const Ice::Context& context = Ice::noExplicitContext) const; // NOLINT(modernize-use-nodiscard)
155
156 /// Allocates an object with the given type.
157 /// @param type The type of the object.
158 /// @param context The request context.
159 /// @return A future that becomes available when the invocation completes. This future holds:
160 /// - A proxy to the allocated object. This proxy is never null.
161 /// @see #setAllocationTimeout
162 /// @see #releaseObject
163 [[nodiscard]] std::future<std::optional<Ice::ObjectPrx>> allocateObjectByTypeAsync(std::string_view type, const Ice::Context& context = Ice::noExplicitContext) const;
164
165 /// Allocates an object with the given type.
166 /// @param type The type of the object.
167 /// @param response The response callback. It accepts:
168 /// - A proxy to the allocated object. This proxy is never null.
169 /// @param exception The exception callback.
170 /// @param sent The sent callback.
171 /// @param context The request context.
172 /// @return A function that can be called to cancel the invocation locally.
173 /// @see #setAllocationTimeout
174 /// @see #releaseObject
175 // NOLINTNEXTLINE(modernize-use-nodiscard)
176 std::function<void()> allocateObjectByTypeAsync(std::string_view type, std::function<void(std::optional<Ice::ObjectPrx>)> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;
177
178 /// @private
179 void _iceI_allocateObjectByType(const std::shared_ptr<IceInternal::OutgoingAsyncT<std::optional<Ice::ObjectPrx>>>&, std::string_view, const Ice::Context&) const;
180
181 /// Releases an object that was allocated using ::IceGrid::SessionPrx::allocateObjectById or ::IceGrid::SessionPrx::allocateObjectByType.
182 /// @param id The identity of the object to release.
183 /// @param context The request context.
184 /// @throws IceGrid::AllocationException Thrown when the object can't be released. This can happen when the object is not
185 /// allocatable or is not allocated by this session.
186 /// @throws IceGrid::ObjectNotRegisteredException Thrown when an object with the given identity is not registered with
187 /// the registry.
188 void releaseObject(const ::Ice::Identity& id, const Ice::Context& context = Ice::noExplicitContext) const;
189
190 /// Releases an object that was allocated using ::IceGrid::SessionPrx::allocateObjectById or ::IceGrid::SessionPrx::allocateObjectByType.
191 /// @param id The identity of the object to release.
192 /// @param context The request context.
193 /// @return A future that becomes available when the invocation completes.
194 [[nodiscard]] std::future<void> releaseObjectAsync(const ::Ice::Identity& id, const Ice::Context& context = Ice::noExplicitContext) const;
195
196 /// Releases an object that was allocated using ::IceGrid::SessionPrx::allocateObjectById or ::IceGrid::SessionPrx::allocateObjectByType.
197 /// @param id The identity of the object to release.
198 /// @param response The response callback.
199 /// @param exception The exception callback.
200 /// @param sent The sent callback.
201 /// @param context The request context.
202 /// @return A function that can be called to cancel the invocation locally.
203 // NOLINTNEXTLINE(modernize-use-nodiscard)
204 std::function<void()> releaseObjectAsync(const ::Ice::Identity& id, std::function<void()> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;
205
206 /// @private
207 void _iceI_releaseObject(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>&, const ::Ice::Identity&, const Ice::Context&) const;
208
209 /// Sets the allocation timeout. When no object is immediately available for an allocation request, the
210 /// implementation of ::IceGrid::SessionPrx::allocateObjectById and ::IceGrid::SessionPrx::allocateObjectByType waits for the duration of
211 /// this @p timeout.
212 /// @param timeout The timeout in milliseconds.
213 /// @param context The request context.
214 void setAllocationTimeout(std::int32_t timeout, const Ice::Context& context = Ice::noExplicitContext) const;
215
216 /// Sets the allocation timeout. When no object is immediately available for an allocation request, the
217 /// implementation of ::IceGrid::SessionPrx::allocateObjectById and ::IceGrid::SessionPrx::allocateObjectByType waits for the duration of
218 /// this @p timeout.
219 /// @param timeout The timeout in milliseconds.
220 /// @param context The request context.
221 /// @return A future that becomes available when the invocation completes.
222 [[nodiscard]] std::future<void> setAllocationTimeoutAsync(std::int32_t timeout, const Ice::Context& context = Ice::noExplicitContext) const;
223
224 /// Sets the allocation timeout. When no object is immediately available for an allocation request, the
225 /// implementation of ::IceGrid::SessionPrx::allocateObjectById and ::IceGrid::SessionPrx::allocateObjectByType waits for the duration of
226 /// this @p timeout.
227 /// @param timeout The timeout in milliseconds.
228 /// @param response The response callback.
229 /// @param exception The exception callback.
230 /// @param sent The sent callback.
231 /// @param context The request context.
232 /// @return A function that can be called to cancel the invocation locally.
233 // NOLINTNEXTLINE(modernize-use-nodiscard)
234 std::function<void()> setAllocationTimeoutAsync(std::int32_t timeout, std::function<void()> response, std::function<void(std::exception_ptr)> exception = nullptr, std::function<void(bool)> sent = nullptr, const Ice::Context& context = Ice::noExplicitContext) const;
235
236 /// @private
237 void _iceI_setAllocationTimeout(const std::shared_ptr<IceInternal::OutgoingAsyncT<void>>&, std::int32_t, const Ice::Context&) const;
238
239 /// Gets the type ID of the associated Slice interface.
240 /// @return The string `"::IceGrid::Session"`.
241 static const char* ice_staticId() noexcept;
242
243 /// @private
244 static SessionPrx _fromReference(IceInternal::ReferencePtr ref) { return SessionPrx{std::move(ref)}; }
245
246 protected:
247 /// @private
248 SessionPrx() = default;
249
250 /// @private
251 explicit SessionPrx(IceInternal::ReferencePtr&& ref) : Ice::ObjectPrx{std::move(ref)}
252 {
253 }
254
255#if defined(__GNUC__) && !defined(__clang__)
256# pragma GCC diagnostic pop
257#endif
258 };
259}
260
261namespace IceGrid
262{
263 /// Represents a session object used by IceGrid clients to allocate and release objects. Client sessions are created
264 /// either via the RegistryPrx object or via the registry client ::Glacier2::SessionManagerPrx object.
265 /// @headerfile IceGrid/IceGrid.h
266 class ICEGRID_API Session : public virtual ::Glacier2::Session
267 {
268 public:
269 /// The associated proxy type.
270 using ProxyType = SessionPrx;
271
272 /// Dispatches an incoming request to one of the member functions of this generated class, based on the operation name carried by the request.
273 /// @param request The incoming request.
274 /// @param sendResponse The callback to send the response.
275 void dispatch(Ice::IncomingRequest& request, std::function<void(Ice::OutgoingResponse)> sendResponse) override;
276
277 [[nodiscard]] std::vector<std::string> ice_ids(const Ice::Current& current) const override;
278
279 [[nodiscard]] std::string ice_id(const Ice::Current& current) const override;
280
281 /// Keeps the session alive.
282 /// @param current The Current object of the incoming request.
283 virtual void keepAlive(const Ice::Current& current) = 0;
284
285 /// @private
286 void _iceD_keepAlive(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);
287
288 /// Allocates an object.
289 /// @param id The identity of the object to allocate.
290 /// @param response The response callback. It accepts:
291 /// - A proxy to the allocated object. This proxy is never null.
292 /// @param exception The exception callback.
293 /// @param current The Current object of the incoming request.
294 /// @throws IceGrid::AllocationException Thrown when the allocation fails.
295 /// @throws IceGrid::ObjectNotRegisteredException Thrown when an object with the given identity is not registered with
296 /// the registry.
297 /// @see #setAllocationTimeout
298 /// @see #releaseObject
299 virtual void allocateObjectByIdAsync(::Ice::Identity id, std::function<void(const std::optional<Ice::ObjectPrx>& returnValue)> response, std::function<void(std::exception_ptr)> exception, const Ice::Current& current) = 0;
300
301 /// @private
302 void _iceD_allocateObjectById(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);
303
304 /// Allocates an object with the given type.
305 /// @param type The type of the object.
306 /// @param response The response callback. It accepts:
307 /// - A proxy to the allocated object. This proxy is never null.
308 /// @param exception The exception callback.
309 /// @param current The Current object of the incoming request.
310 /// @throws IceGrid::AllocationException Thrown when the allocation fails.
311 /// @see #setAllocationTimeout
312 /// @see #releaseObject
313 virtual void allocateObjectByTypeAsync(std::string type, std::function<void(const std::optional<Ice::ObjectPrx>& returnValue)> response, std::function<void(std::exception_ptr)> exception, const Ice::Current& current) = 0;
314
315 /// @private
316 void _iceD_allocateObjectByType(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);
317
318 /// Releases an object that was allocated using ::IceGrid::SessionPrx::allocateObjectById or ::IceGrid::SessionPrx::allocateObjectByType.
319 /// @param id The identity of the object to release.
320 /// @param current The Current object of the incoming request.
321 /// @throws IceGrid::AllocationException Thrown when the object can't be released. This can happen when the object is not
322 /// allocatable or is not allocated by this session.
323 /// @throws IceGrid::ObjectNotRegisteredException Thrown when an object with the given identity is not registered with
324 /// the registry.
325 virtual void releaseObject(::Ice::Identity id, const Ice::Current& current) = 0;
326
327 /// @private
328 void _iceD_releaseObject(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);
329
330 /// Sets the allocation timeout. When no object is immediately available for an allocation request, the
331 /// implementation of ::IceGrid::SessionPrx::allocateObjectById and ::IceGrid::SessionPrx::allocateObjectByType waits for the duration of
332 /// this @p timeout.
333 /// @param timeout The timeout in milliseconds.
334 /// @param current The Current object of the incoming request.
335 virtual void setAllocationTimeout(std::int32_t timeout, const Ice::Current& current) = 0;
336
337 /// @private
338 void _iceD_setAllocationTimeout(Ice::IncomingRequest&, std::function<void(Ice::OutgoingResponse)>);
339
340 /// Gets the type ID of the associated Slice interface.
341 /// @return The string `"::IceGrid::Session"`.
342 static const char* ice_staticId() noexcept;
343 };
344
345 /// A shared pointer to a Session.
346 using SessionPtr = std::shared_ptr<Session>;
347}
348
349// NOLINTEND(modernize-concat-nested-namespaces)
350
351#include <Ice/PopDisableWarnings.h>
352#endif
Represents the main entry point into the IceGrid registry service.
Definition Registry.h:275
std::future< std::optional< Ice::ObjectPrx > > allocateObjectByIdAsync(const ::Ice::Identity &id, const Ice::Context &context=Ice::noExplicitContext) const
Allocates an object.
std::optional< Ice::ObjectPrx > allocateObjectById(const ::Ice::Identity &id, const Ice::Context &context=Ice::noExplicitContext) const
Allocates an object.
SessionPrx(const Ice::CommunicatorPtr &communicator, std::string_view proxyString)
Constructs a proxy from a Communicator and a proxy string.
Definition Session.h:55
std::future< std::optional< Ice::ObjectPrx > > allocateObjectByTypeAsync(std::string_view type, const Ice::Context &context=Ice::noExplicitContext) const
Allocates an object with the given type.
std::function< void()> keepAliveAsync(std::function< void()> response, std::function< void(std::exception_ptr)> exception=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Keeps the session alive.
static const char * ice_staticId() noexcept
Gets the type ID of the associated Slice interface.
SessionPrx(const SessionPrx &other) noexcept
Copy constructor.
Definition Session.h:59
std::future< void > releaseObjectAsync(const ::Ice::Identity &id, const Ice::Context &context=Ice::noExplicitContext) const
Releases an object that was allocated using IceGrid::SessionPrx::allocateObjectById or IceGrid::Sessi...
SessionPrx & operator=(const SessionPrx &rhs) noexcept
Copy assignment operator.
Definition Session.h:70
void releaseObject(const ::Ice::Identity &id, const Ice::Context &context=Ice::noExplicitContext) const
Releases an object that was allocated using IceGrid::SessionPrx::allocateObjectById or IceGrid::Sessi...
void setAllocationTimeout(std::int32_t timeout, const Ice::Context &context=Ice::noExplicitContext) const
Sets the allocation timeout.
std::function< void()> allocateObjectByIdAsync(const ::Ice::Identity &id, std::function< void(std::optional< Ice::ObjectPrx >)> response, std::function< void(std::exception_ptr)> exception=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Allocates an object.
std::optional< Ice::ObjectPrx > allocateObjectByType(std::string_view type, const Ice::Context &context=Ice::noExplicitContext) const
Allocates an object with the given type.
SessionPrx & operator=(SessionPrx &&rhs) noexcept
Move assignment operator.
Definition Session.h:81
void keepAlive(const Ice::Context &context=Ice::noExplicitContext) const
Keeps the session alive.
std::future< void > setAllocationTimeoutAsync(std::int32_t timeout, const Ice::Context &context=Ice::noExplicitContext) const
Sets the allocation timeout.
SessionPrx(SessionPrx &&other) noexcept
Move constructor.
Definition Session.h:63
std::function< void()> allocateObjectByTypeAsync(std::string_view type, std::function< void(std::optional< Ice::ObjectPrx >)> response, std::function< void(std::exception_ptr)> exception=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Allocates an object with the given type.
std::future< void > keepAliveAsync(const Ice::Context &context=Ice::noExplicitContext) const
Keeps the session alive.
std::function< void()> setAllocationTimeoutAsync(std::int32_t timeout, std::function< void()> response, std::function< void(std::exception_ptr)> exception=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Sets the allocation timeout.
std::function< void()> releaseObjectAsync(const ::Ice::Identity &id, std::function< void()> response, std::function< void(std::exception_ptr)> exception=nullptr, std::function< void(bool)> sent=nullptr, const Ice::Context &context=Ice::noExplicitContext) const
Releases an object that was allocated using IceGrid::SessionPrx::allocateObjectById or IceGrid::Sessi...
Represents a session object used by IceGrid clients to allocate and release objects.
Definition Session.h:45
ObjectPrx & operator=(const ObjectPrx &rhs) noexcept=default
Copy assignment operator.
The base class for all Ice proxies.
Definition Proxy.h:232
Provides typed proxy functions.
Definition Proxy.h:45
std::shared_ptr< Session > SessionPtr
A shared pointer to a Session.
Definition Session.h:346
Deploy and manage Ice servers.
Definition Admin.h:34
std::shared_ptr< Communicator > CommunicatorPtr
A shared pointer to a Communicator.
const Context noExplicitContext
Marker value used to indicate that no explicit request context was passed to a proxy invocation.
std::map< std::string, std::string, std::less<> > Context
Represents additional information carried by an Ice request.
Definition Context.h:28
The Ice RPC framework.
Definition SampleEvent.h:59