Ice 3.7 C++11 API Reference
Object.h
Go to the documentation of this file.
1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 #ifndef ICE_OBJECT_H
6 #define ICE_OBJECT_H
7 
8 #include <IceUtil/Mutex.h>
9 #include <IceUtil/Shared.h>
10 #include <Ice/ObjectF.h>
11 #include <Ice/ProxyF.h>
12 #include <Ice/IncomingAsyncF.h>
13 #include <Ice/SlicedDataF.h>
14 #include <Ice/Current.h>
15 #include <Ice/Format.h>
16 
17 namespace Ice
18 {
19 
20 class OutputStream;
21 class InputStream;
22 
23 }
24 
25 namespace IceInternal
26 {
27 
28 class Incoming;
29 class Direct;
30 class GCVisitor;
31 
32 }
33 
34 namespace Ice
35 {
36 
38 ICE_API extern const Current emptyCurrent;
39 
40 #ifndef ICE_CPP11_MAPPING
41 
45 class ICE_API DispatchInterceptorAsyncCallback : public virtual IceUtil::Shared
46 {
47 public:
48 
49  virtual ~DispatchInterceptorAsyncCallback();
50 
52  virtual bool response() = 0;
53 
58  virtual bool exception(const std::exception& ex) = 0;
59 
63  virtual bool exception() = 0;
64 };
65 ICE_DEFINE_PTR(DispatchInterceptorAsyncCallbackPtr, DispatchInterceptorAsyncCallback);
66 #endif
67 
73 {
74 public:
75 
76  virtual ~Request();
77 
82  virtual const Current& getCurrent() = 0;
83 };
84 
85 #ifdef ICE_CPP11_MAPPING
86 
91 {
92 public:
93 
94  virtual ~Object() = default;
95 
104  virtual bool ice_isA(std::string s, const Current& current) const;
106  bool _iceD_ice_isA(IceInternal::Incoming&, const Current&);
108 
113  virtual void ice_ping(const Current& current) const;
115  bool _iceD_ice_ping(IceInternal::Incoming&, const Current&);
117 
124  virtual std::vector< std::string> ice_ids(const Current& current) const;
126  bool _iceD_ice_ids(IceInternal::Incoming&, const Current&);
128 
134  virtual std::string ice_id(const Current& current) const;
136  bool _iceD_ice_id(IceInternal::Incoming&, const Current&);
138 
143  static const std::string& ice_staticId();
144 
156  virtual bool ice_dispatch(Ice::Request& request,
157  std::function<bool()> response = nullptr,
158  std::function<bool(std::exception_ptr)> error = nullptr);
159 
161  virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
163 
168  {
173 
178  std::vector<::Ice::Byte> outParams;
179  };
180 
181 protected:
182 
184  static void _iceCheckMode(OperationMode, OperationMode);
186 };
187 #else
188 
192 class ICE_API Object : public virtual IceUtil::Shared
193 {
194 public:
195 
196  virtual bool operator==(const Object&) const;
197  virtual bool operator<(const Object&) const;
198 
207  virtual bool ice_isA(const std::string& s, const Current& current = Ice::emptyCurrent) const;
209  bool _iceD_ice_isA(IceInternal::Incoming&, const Current&);
211 
216  virtual void ice_ping(const Current& current = Ice::emptyCurrent) const;
218  bool _iceD_ice_ping(IceInternal::Incoming&, const Current&);
220 
227  virtual std::vector< std::string> ice_ids(const Current& current = Ice::emptyCurrent) const;
229  bool _iceD_ice_ids(IceInternal::Incoming&, const Current&);
231 
237  virtual const std::string& ice_id(const Current& current = Ice::emptyCurrent) const;
239  bool _iceD_ice_id(IceInternal::Incoming&, const Current&);
241 
267  virtual Int ice_operationAttributes(const std::string& operation) const;
268 
270  virtual void _iceWrite(Ice::OutputStream*) const;
271  virtual void _iceRead(Ice::InputStream*);
273 
275  virtual bool _iceGcVisit(IceInternal::GCVisitor&) { return false; }
277 
283  virtual void ice_collectable(bool b);
284 
289  virtual void ice_preMarshal();
290 
295  virtual void ice_postUnmarshal();
296 
301  static const std::string& ice_staticId();
302 
307  virtual ObjectPtr ice_clone() const;
308 
314  virtual SlicedDataPtr ice_getSlicedData() const;
315 
324  virtual bool ice_dispatch(Ice::Request& request, const DispatchInterceptorAsyncCallbackPtr& cb = 0);
326  virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
328 
329 protected:
330 
331  Object() {} // This class is abstract.
332 #if defined(__clang__)
333 # pragma clang diagnostic push
334 # pragma clang diagnostic ignored "-Wdeprecated-copy-dtor"
335 #endif
336  virtual ~Object() {}
337 #if defined(__clang__)
338 # pragma clang diagnostic pop
339 #endif
340 
341 protected:
342 
344  virtual void _iceWriteImpl(Ice::OutputStream*) const {}
345  virtual void _iceReadImpl(Ice::InputStream*) {}
347 
349  static void _iceCheckMode(OperationMode, OperationMode);
351 };
352 #endif
353 
359 class ICE_API Blobject : public virtual Object
360 {
361 public:
362 
375  virtual bool ice_invoke(ICE_IN(std::vector<Byte>) inEncaps, std::vector<Byte>& outEncaps,
376  const Current& current) = 0;
377 
379  virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
381 };
382 
388 class ICE_API BlobjectArray : public virtual Object
389 {
390 public:
391 
404  virtual bool ice_invoke(ICE_IN(std::pair<const Byte*, const Byte*>) inEncaps, std::vector<Byte>& outEncaps,
405  const Current& current) = 0;
406 
408  virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
410 };
411 
417 class ICE_API BlobjectAsync : public virtual Object
418 {
419 public:
420 
421 #ifdef ICE_CPP11_MAPPING
422 
435  virtual void ice_invokeAsync(std::vector<Byte> inEncaps,
436  std::function<void(bool, const std::vector<Byte>&)> response,
437  std::function<void(std::exception_ptr)> error,
438  const Current& current) = 0;
439 #else
440 
449  virtual void ice_invoke_async(const AMD_Object_ice_invokePtr& cb, const std::vector<Byte>& inEncaps,
450  const Current& current) = 0;
451 #endif
452 
454  virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
456 };
457 
463 class ICE_API BlobjectArrayAsync : public virtual Object
464 {
465 public:
466 
467 #ifdef ICE_CPP11_MAPPING
468 
481  virtual void ice_invokeAsync(std::pair<const Byte*, const Byte*> inEncaps,
482  std::function<void(bool, const std::pair<const Byte*, const Byte*>&)> response,
483  std::function<void(std::exception_ptr)> error,
484  const Current& current) = 0;
485 #else
486 
495  virtual void ice_invoke_async(const AMD_Object_ice_invokePtr& cb,
496  const std::pair<const Byte*, const Byte*>& inEncaps,
497  const Current& current) = 0;
498 #endif
499 
501  virtual bool _iceDispatch(IceInternal::Incoming&, const Current&);
503 };
504 
505 }
506 
507 #endif
Ice::Object::ice_isA
virtual bool ice_isA(std::string s, const Current &current) const
Tests whether this object supports a specific Slice interface.
Ice::Object::Ice_invokeResult::returnValue
bool returnValue
Indicates whether the invocation resulted in success (true) or a user exception (false).
Definition: Object.h:172
Ice::Request::getCurrent
virtual const Current & getCurrent()=0
Obtains the Current object associated with the request.
Ice::InputStream
Interface for input streams used to extract Slice types from a sequence of bytes.
Definition: InputStream.h:50
Ice::Object::ice_id
virtual std::string ice_id(const Current &current) const
Returns the Slice type ID of the most-derived interface supported by this object.
Ice::Object::Ice_invokeResult
Holds the results of a call to ice_invoke.
Definition: Object.h:168
Current.h
Ice::emptyCurrent
const Current emptyCurrent
A default-initialized Current instance.
Ice::Object::ice_ping
virtual void ice_ping(const Current &current) const
Tests whether this object can be reached.
Ice::Object
The base class for servants.
Definition: Object.h:91
Ice::operator==
bool operator==(const C &lhs, const C &rhs)
Relational operator for generated structs and classes.
Definition: Comparable.h:184
Ice::Request
Encapsulates details about a dispatch request.
Definition: Object.h:73
Format.h
Ice::Object::~Object
virtual ~Object()=default
Ice::Blobject::ice_invoke
virtual bool ice_invoke(std::vector< Byte > inEncaps, std::vector< Byte > &outEncaps, const Current &current)=0
Dispatch an incoming request.
ICE_API
#define ICE_API
Definition: Config.h:197
Ice::BlobjectArrayAsync::ice_invokeAsync
virtual void ice_invokeAsync(std::pair< const Byte *, const Byte * > inEncaps, std::function< void(bool, const std::pair< const Byte *, const Byte * > &)> response, std::function< void(std::exception_ptr)> error, const Current &current)=0
Dispatch an incoming request asynchronously.
Ice::Blobject
Base class for dynamic dispatch servants.
Definition: Object.h:360
Ice::BlobjectArray::ice_invoke
virtual bool ice_invoke(std::pair< const Byte *, const Byte * > inEncaps, std::vector< Byte > &outEncaps, const Current &current)=0
Dispatch an incoming request.
ICE_IN
#define ICE_IN(...)
Definition: Config.h:370
ProxyF.h
Ice::operator<
bool operator<(const C &lhs, const C &rhs)
Relational operator for generated structs and classes.
Definition: Comparable.h:136
Shared.h
SlicedDataF.h
Ice::OutputStream
Interface for output streams used to create a sequence of bytes from Slice types.
Definition: OutputStream.h:28
ObjectF.h
Mutex.h
Ice
Definition: BuiltinSequences.h:56
Ice::BlobjectArray
Base class for dynamic dispatch servants that uses the array mapping.
Definition: Object.h:389
Ice::BlobjectAsync::ice_invokeAsync
virtual void ice_invokeAsync(std::vector< Byte > inEncaps, std::function< void(bool, const std::vector< Byte > &)> response, std::function< void(std::exception_ptr)> error, const Current &current)=0
Dispatch an incoming request asynchronously.
Ice::Object::ice_ids
virtual std::vector< std::string > ice_ids(const Current &current) const
Returns the Slice type IDs of the interfaces supported by this object.
Ice::OperationMode
OperationMode
Determines the retry behavior an invocation in case of a (potentially) recoverable error.
Definition: Current.h:74
Ice::BlobjectArrayAsync
Base class for asynchronous dynamic dispatch servants that uses the array mapping.
Definition: Object.h:464
Ice::Current
Information about the current method invocation for servers.
Definition: Current.h:120
Ice::BlobjectAsync
Base class for asynchronous dynamic dispatch servants.
Definition: Object.h:418
Ice::Int
int Int
The mapping for the Slice int type.
Definition: Config.h:54
IceUtil::Shared
Definition: Shared.h:78
Ice::ICE_DEFINE_PTR
ICE_DEFINE_PTR(NativePropertiesAdminPtr, NativePropertiesAdmin)
Ice::Request::~Request
virtual ~Request()
IncomingAsyncF.h
Ice::Object::ice_staticId
static const std::string & ice_staticId()
Obtains the Slice type ID of this type.
Ice::Object::Ice_invokeResult::outParams
std::vector<::Ice::Byte > outParams
Holds an encapsulation of the encoded results.
Definition: Object.h:178
Ice::Object::ice_dispatch
virtual bool ice_dispatch(Ice::Request &request, std::function< bool()> response=nullptr, std::function< bool(std::exception_ptr)> error=nullptr)
Dispatches an invocation to a servant.