summaryrefslogtreecommitdiff
path: root/cpp/test/Ice/echo/BlobjectI.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-07-19 12:16:43 -0400
committerBernard Normier <bernard@zeroc.com>2016-07-19 12:16:43 -0400
commite16efc6d8f2abe2036a601c2695fd65bd9134246 (patch)
tree2af5e70e8b24e3596f14edec12cd249e8f056720 /cpp/test/Ice/echo/BlobjectI.cpp
parentICE-7240 - Python Ice/servantLocator cross test (diff)
downloadice-e16efc6d8f2abe2036a601c2695fd65bd9134246.tar.bz2
ice-e16efc6d8f2abe2036a601c2695fd65bd9134246.tar.xz
ice-e16efc6d8f2abe2036a601c2695fd65bd9134246.zip
C++11 support in test/Ice/echo
Diffstat (limited to 'cpp/test/Ice/echo/BlobjectI.cpp')
-rw-r--r--cpp/test/Ice/echo/BlobjectI.cpp55
1 files changed, 55 insertions, 0 deletions
diff --git a/cpp/test/Ice/echo/BlobjectI.cpp b/cpp/test/Ice/echo/BlobjectI.cpp
index 2d86e66f276..984236d0f15 100644
--- a/cpp/test/Ice/echo/BlobjectI.cpp
+++ b/cpp/test/Ice/echo/BlobjectI.cpp
@@ -12,6 +12,7 @@
using namespace std;
+#ifndef ICE_CPP11_MAPPING
class Callback : public IceUtil::Shared
{
public:
@@ -45,6 +46,7 @@ private:
bool _twoway;
};
typedef IceUtil::Handle<Callback> CallbackPtr;
+#endif
BlobjectI::BlobjectI() :
_startBatch(false)
@@ -66,6 +68,58 @@ BlobjectI::flushBatch()
_batchProxy = 0;
}
+#ifdef ICE_CPP11_MAPPING
+void
+BlobjectI::ice_invokeAsync(std::vector<Ice::Byte> inEncaps,
+ std::function<void(bool, std::vector<Ice::Byte>)> response,
+ std::function<void(std::exception_ptr)> ex,
+ const Ice::Current& current)
+{
+ const bool twoway = current.requestId > 0;
+ auto obj = current.con->createProxy(current.id);
+ if(!twoway)
+ {
+ if(_startBatch)
+ {
+ _startBatch = false;
+ _batchProxy = obj->ice_batchOneway();
+ }
+ if(_batchProxy)
+ {
+ obj = _batchProxy;
+ }
+
+ if(!current.facet.empty())
+ {
+ obj = obj->ice_facet(current.facet);
+ }
+
+ if(_batchProxy)
+ {
+ vector<Ice::Byte> out;
+ obj->ice_invoke(current.operation, current.mode, inEncaps, out, current.ctx);
+ response(true, vector<Ice::Byte>());
+ }
+ else
+ {
+ obj->ice_oneway()->ice_invokeAsync(current.operation, current.mode, inEncaps,
+ [](bool, std::vector<Ice::Byte>) { assert(0); },
+ ex,
+ [&](bool) { response(true, vector<Ice::Byte>()); },
+ current.ctx);
+ }
+ }
+ else
+ {
+ if(!current.facet.empty())
+ {
+ obj = obj->ice_facet(current.facet);
+ }
+
+ obj->ice_invokeAsync(current.operation, current.mode, inEncaps, response, ex, nullptr, current.ctx);
+ }
+}
+#else
void
BlobjectI::ice_invoke_async(const Ice::AMD_Object_ice_invokePtr& amdCb, const vector<Ice::Byte>& inEncaps,
const Ice::Current& current)
@@ -116,3 +170,4 @@ BlobjectI::ice_invoke_async(const Ice::AMD_Object_ice_invokePtr& amdCb, const ve
obj->begin_ice_invoke(current.operation, current.mode, inEncaps, current.ctx, del);
}
}
+#endif