summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/OutgoingAsync.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2014-07-24 16:06:51 +0000
committerBernard Normier <bernard@zeroc.com>2014-07-24 16:06:51 +0000
commitac23953bb2f5ab0bac337f15d4d8739e7aa1ce5c (patch)
tree3af419df5b8c46c809d579fdcd7165135f452d8f /cpp/src/Ice/OutgoingAsync.cpp
parentVS 2010 build fix (diff)
downloadice-ac23953bb2f5ab0bac337f15d4d8739e7aa1ce5c.tar.bz2
ice-ac23953bb2f5ab0bac337f15d4d8739e7aa1ce5c.tar.xz
ice-ac23953bb2f5ab0bac337f15d4d8739e7aa1ce5c.zip
Completed fix for ICE-5567: move various C++11 classes/functions out of line
Diffstat (limited to 'cpp/src/Ice/OutgoingAsync.cpp')
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index e8aadb6fb38..17095659df5 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -1183,6 +1183,54 @@ public:
//
CallbackBasePtr IceInternal::__dummyCallback = new DummyCallback;
+#ifdef ICE_CPP11
+
+Ice::CallbackPtr
+Ice::newCallback(const ::IceInternal::Function<void (const AsyncResultPtr&)>& completed,
+ const ::IceInternal::Function<void (const AsyncResultPtr&)>& sent)
+{
+ class Cpp11CB : public GenericCallbackBase
+ {
+ public:
+ Cpp11CB(const ::std::function<void (const AsyncResultPtr&)>& completed,
+ const ::std::function<void (const AsyncResultPtr&)>& sent) :
+ _completed(completed),
+ _sent(sent)
+ {
+ checkCallback(true, completed != nullptr);
+ }
+
+ virtual void __completed(const AsyncResultPtr& result) const
+ {
+ _completed(result);
+ }
+
+ virtual CallbackBasePtr __verify(LocalObjectPtr&)
+ {
+ return this; // Nothing to do, the cookie is not type-safe.
+ }
+
+ virtual void __sent(const AsyncResultPtr& result) const
+ {
+ if(_sent != nullptr)
+ {
+ _sent(result);
+ }
+ }
+
+ virtual bool __hasSentCallback() const
+ {
+ return _sent != nullptr;
+ }
+
+ ::std::function< void (const AsyncResultPtr&)> _completed;
+ ::std::function< void (const AsyncResultPtr&)> _sent;
+ };
+
+ return new Cpp11CB(completed, sent);
+}
+#endif
+
void
Ice::AMICallbackBase::__exception(const ::Ice::Exception& ex)
{
@@ -1198,3 +1246,4 @@ Ice::AMICallbackBase::__sent(bool sentSynchronously)
}
}
+