summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-09-01 16:37:29 +0200
committerBenoit Foucher <benoit@zeroc.com>2016-09-01 16:37:29 +0200
commitdb53db6c3e2e75d17e65e6649d85436b1e889944 (patch)
tree0df84b4b8d77eb8d35115efb9a44cec46ea80fbb
parentFixed servant locator cookie bug introduced with dispatch code changes (diff)
downloadice-db53db6c3e2e75d17e65e6649d85436b1e889944.tar.bz2
ice-db53db6c3e2e75d17e65e6649d85436b1e889944.tar.xz
ice-db53db6c3e2e75d17e65e6649d85436b1e889944.zip
Added support for C+11 marshaled results
-rw-r--r--cpp/include/Ice/Incoming.h29
-rw-r--r--cpp/include/Ice/IncomingAsync.h11
-rw-r--r--cpp/src/Ice/Incoming.cpp18
-rw-r--r--cpp/src/slice2cpp/Gen.cpp257
-rw-r--r--cpp/test/Ice/objects/TestI.cpp21
-rw-r--r--cpp/test/Ice/objects/TestI.h5
-rw-r--r--cpp/test/Ice/operations/TestAMDI.cpp36
-rw-r--r--cpp/test/Ice/operations/TestAMDI.h12
-rw-r--r--cpp/test/Ice/operations/TestI.cpp44
-rw-r--r--cpp/test/Ice/operations/TestI.h14
-rw-r--r--cpp/test/Ice/optional/TestAMDI.cpp70
-rw-r--r--cpp/test/Ice/optional/TestAMDI.h38
-rw-r--r--cpp/test/Ice/optional/TestI.cpp50
-rw-r--r--cpp/test/Ice/optional/TestI.h18
14 files changed, 457 insertions, 166 deletions
diff --git a/cpp/include/Ice/Incoming.h b/cpp/include/Ice/Incoming.h
index f322d2de1ea..f512d38ac8b 100644
--- a/cpp/include/Ice/Incoming.h
+++ b/cpp/include/Ice/Incoming.h
@@ -24,6 +24,31 @@
#include <deque>
+#ifdef ICE_CPP11_MAPPING
+
+namespace Ice
+{
+
+class ICE_API MarshaledResult
+{
+public:
+
+ MarshaledResult(const Current&);
+
+ std::shared_ptr<OutputStream> getOutputStream() const
+ {
+ return __os;
+ }
+
+protected:
+
+ std::shared_ptr<OutputStream> __os;
+};
+
+}
+
+#endif
+
namespace IceInternal
{
@@ -36,6 +61,10 @@ public:
void writeEmptyParams();
void writeParamEncaps(const Ice::Byte*, Ice::Int, bool);
+#ifdef ICE_CPP11_MAPPING
+ void setMarshaledResult(const Ice::MarshaledResult&);
+#endif
+
void response(bool);
void exception(const std::exception&, bool);
void exception(const std::string&, bool);
diff --git a/cpp/include/Ice/IncomingAsync.h b/cpp/include/Ice/IncomingAsync.h
index 474f6032761..2d7a5dc1152 100644
--- a/cpp/include/Ice/IncomingAsync.h
+++ b/cpp/include/Ice/IncomingAsync.h
@@ -63,6 +63,17 @@ public:
};
}
+ template<class T>
+ std::function<void(const T&)> response()
+ {
+ auto self = shared_from_this();
+ return [self](const T& marshaledResult)
+ {
+ self->setMarshaledResult(marshaledResult);
+ self->completed();
+ };
+ }
+
std::function<void(std::exception_ptr)> exception()
{
auto self = shared_from_this();
diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp
index 26a1d40806e..1066773110e 100644
--- a/cpp/src/Ice/Incoming.cpp
+++ b/cpp/src/Ice/Incoming.cpp
@@ -37,6 +37,16 @@ extern bool printStackTraces;
}
+#ifdef ICE_CPP11_MAPPING
+Ice::MarshaledResult::MarshaledResult(const Ice::Current& current) :
+ __os(make_shared<Ice::OutputStream>(current.adapter->getCommunicator(), Ice::currentProtocolEncoding))
+{
+ __os->writeBlob(replyHdr, sizeof(replyHdr));
+ __os->write(current.requestId);
+ __os->write(replyOK);
+}
+#endif
+
IceInternal::IncomingBase::IncomingBase(Instance* instance, ResponseHandler* responseHandler,
Ice::Connection* connection, const ObjectAdapterPtr& adapter,
bool response, Byte compress, Int requestId) :
@@ -135,6 +145,14 @@ IncomingBase::writeParamEncaps(const Byte* v, Ice::Int sz, bool ok)
}
}
+#ifdef ICE_CPP11_MAPPING
+void
+IceInternal::IncomingBase::setMarshaledResult(const Ice::MarshaledResult& result)
+{
+ result.getOutputStream()->swap(_os);
+}
+#endif
+
void
IceInternal::IncomingBase::response(bool amd)
{
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 1ad5a34660c..ca06c64219c 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -544,9 +544,11 @@ throwUserExceptionLambda(IceUtilInternal::Output& C, ExceptionList throws)
}
string
-resultStructName(const string& name, const string& scope = "")
+resultStructName(const string& name, const string& scope = "", bool marshaledResult = false)
{
- string stName = IceUtilInternal::toUpper(name.substr(0, 1)) + name.substr(1) + "Result";
+ assert(!name.empty());
+ string stName = IceUtilInternal::toUpper(name.substr(0, 1)) + name.substr(1);
+ stName += marshaledResult ? "MarshaledResult" : "Result";
if(!scope.empty())
{
stName = scope + "::" + stName;
@@ -7043,17 +7045,12 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
string name = p->name();
TypePtr ret = p->returnType();
- string retS = returnTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring | TypeContextCpp11);
- string params = "(";
- string paramsDecl = "(";
- string args = "(";
-
- string paramsAMD;
- string argsAMD;
+ vector<string> params;
+ vector<string> args;
- string responseParams;
- string responseParamsDecl;
+ vector<string> responseParams;
+ vector<string> responseParamsDecl;
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
@@ -7063,135 +7060,129 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
string scope = fixKwd(cl->scope() + cl->name() + suffix + "::");
string scoped = fixKwd(cl->scope() + cl->name() + suffix + "::" + p->name());
+ bool amd = (cl->hasMetaData("amd") || p->hasMetaData("amd"));
+
+ if(p->hasMarshaledResult())
+ {
+
+ }
+
+ if(ret)
+ {
+ string typeS = inputTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring | TypeContextCpp11);
+ responseParams.push_back(typeS);
+ responseParamsDecl.push_back(typeS + " __ret");
+ }
+
+ string retS;
+ if(amd)
+ {
+ retS = "void";
+ }
+ else if(p->hasMarshaledResult())
+ {
+ retS = resultStructName(name, "", true);
+ }
+ else
+ {
+ retS = returnTypeToString(ret, p->returnIsOptional(), p->getMetaData(), _useWstring | TypeContextCpp11);
+ }
+
ParamDeclList inParams;
ParamDeclList outParams;
ParamDeclList paramList = p->parameters();
- vector<string> outDecls;
for(ParamDeclList::iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string paramName = fixKwd(string(paramPrefix) + (*q)->name());
TypePtr type = (*q)->type();
+ string paramName = fixKwd(string(paramPrefix) + (*q)->name());
bool isOutParam = (*q)->isOutParam();
string typeString;
- if(isOutParam)
+ int typeCtx = _useWstring | TypeContextCpp11;
+ if(!isOutParam)
{
- outParams.push_back(*q);
- typeString = outputTypeToString(type, (*q)->optional(), (*q)->getMetaData(),
- _useWstring | TypeContextCpp11);
- outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
- _useWstring | TypeContextCpp11));
+ inParams.push_back(*q);
+ params.push_back(typeToString(type, (*q)->optional(), (*q)->getMetaData(), typeCtx | TypeContextInParam));
+ args.push_back(condMove(isMovable(type) && !isOutParam, paramName));
}
else
{
- inParams.push_back(*q);
- typeString = typeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
- _useWstring | TypeContextInParam | TypeContextCpp11);
- }
+ outParams.push_back(*q);
+ if(!p->hasMarshaledResult() && !amd)
+ {
+ params.push_back(outputTypeToString(type, (*q)->optional(), (*q)->getMetaData(), typeCtx));
+ args.push_back(condMove(isMovable(type) && !isOutParam, paramName));
+ }
- if(q != paramList.begin())
- {
- params += ", ";
- paramsDecl += ", ";
- args += ", ";
+ string responseTypeS = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), typeCtx);
+ responseParams.push_back(responseTypeS);
+ responseParamsDecl.push_back(responseTypeS + " " + paramName);
}
-
- params += typeString;
- paramsDecl += typeString;
- paramsDecl += ' ';
- paramsDecl += paramName;
- args += condMove(isMovable(type) && !isOutParam, paramName);
- }
-
- if(cl->isInterface())
- {
- emitOpNameResult(H, p, _useWstring);
}
-
- if(!paramList.empty())
+ if(amd)
{
- params += ", ";
- paramsDecl += ", ";
- args += ", ";
- }
-
- params += "const ::Ice::Current& = ::Ice::noExplicitCurrent)";
- paramsDecl += "const ::Ice::Current& __current)";
- args += "__current)";
-
- for(ParamDeclList::iterator q = inParams.begin(); q != inParams.end(); ++q)
- {
- if(q != inParams.begin())
+ if(p->hasMarshaledResult())
{
- paramsAMD += ", ";
- argsAMD += ", ";
- }
- paramsAMD += typeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
- _useWstring | TypeContextInParam | TypeContextCpp11);
- if(isMovable((*q)->type()))
- {
- argsAMD += "::std::move(" + fixKwd(string(paramPrefix) + (*q)->name()) + ")";
+ string resultName = resultStructName(name, "", true);
+ params.push_back("::std::function<void(const " + resultName + "&)>");
+ args.push_back("inS->response<" + resultName + ">()");
}
else
{
- argsAMD += fixKwd(string(paramPrefix) + (*q)->name());
+ params.push_back("::std::function<void(" + joinString(responseParams, ",") + ")>");
+ args.push_back(ret || !outParams.empty() ? "__responseCB" : "inS->response()");
}
+ params.push_back("::std::function<void(::std::exception_ptr)>");
+ args.push_back("inS->exception()");
}
+ params.push_back("const ::Ice::Current& = ::Ice::noExplicitCurrent");
+ args.push_back("__current");
- if(ret)
+ if(cl->isInterface())
{
- string typeString = inputTypeToString(ret, p->returnIsOptional(), p->getMetaData(),
- _useWstring | TypeContextCpp11);
- responseParams = typeString;
- responseParamsDecl = typeString + " __ret";
- if(!outParams.empty())
- {
- responseParams += ", ";
- responseParamsDecl += ", ";
- }
+ emitOpNameResult(H, p, _useWstring);
}
- for(ParamDeclList::iterator q = outParams.begin(); q != outParams.end(); ++q)
+ if(p->hasMarshaledResult())
{
- if(q != outParams.begin())
+ string resultName = resultStructName(name, "", true);
+ H << sp;
+ H << nl << "class " << resultName << " : public ::Ice::MarshaledResult";
+ H << sb;
+ H.dec();
+ H << nl << "public:";
+ H.inc();
+ H << nl << resultName << spar << responseParams << "const ::Ice::Current&" << epar << ";";
+ H << eb << ';';
+
+ C << sp << nl << scope.substr(2) << resultName << "::" << resultName;
+ C << spar << responseParamsDecl << "const ::Ice::Current& __current" << epar << ":";
+ C.inc();
+ C << nl << "MarshaledResult(__current)";
+ C.dec();
+ C << sb;
+ C << nl << "__os->startEncapsulation(__current.encoding, " << opFormatTypeToString(p) << ");";
+ writeMarshalCode(C, outParams, p, true, TypeContextCpp11);
+ if(p->returnsClasses(false))
{
- responseParams += ", ";
- responseParamsDecl += ", ";
+ C << nl << "__os->writePendingValues();";
}
- string typeString = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
- _useWstring | TypeContextCpp11);
- responseParams += typeString;
- responseParamsDecl += typeString + " " + fixKwd(string(paramPrefix) + (*q)->name());
+ C << nl << "__os->endEncapsulation();";
+ C << eb;
}
string isConst = ((p->mode() == Operation::Nonmutating) || p->hasMetaData("cpp:const")) ? " const" : "";
- bool amd = (cl->hasMetaData("amd") || p->hasMetaData("amd"));
+ string opName = amd ? (name + "Async") : fixKwd(name);
string deprecateSymbol = getDeprecateSymbol(p, cl);
- H << sp;
- if(!amd)
- {
- H << nl << deprecateSymbol << "virtual " << retS << ' ' << fixKwd(name) << params << isConst << " = 0;";
- }
- else
- {
- H << nl << deprecateSymbol << "virtual void " << name << "Async(";
- H.useCurrentPosAsIndent();
- H << paramsAMD;
- if(!paramsAMD.empty())
- {
- H << "," << nl;
- }
- H << "::std::function<void(" << responseParams << ")>," << nl
- << "::std::function<void(::std::exception_ptr)>, const Ice::Current&)" << isConst << " = 0;";
- H.restoreIndent();
- }
+ H << sp;
+ H << nl << deprecateSymbol << "virtual " << retS << ' ' << opName << spar << params << epar << isConst << " = 0;";
H << nl << "bool ___" << name << "(::IceInternal::Incoming&, const ::Ice::Current&)" << isConst << ';';
C << sp;
C << nl << "bool";
- C << nl << scope.substr(2) << "___" << name << "(::IceInternal::Incoming& __inS"
- << ", const ::Ice::Current& __current)" << isConst;
+ C << nl << scope.substr(2);
+ C << "___" << name << "(::IceInternal::Incoming& __inS" << ", const ::Ice::Current& __current)" << isConst;
C << sb;
C << nl << "__checkMode(" << operationModeToString(p->mode(), true) << ", __current.mode);";
@@ -7218,42 +7209,50 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
if(!amd)
{
writeAllocateCode(C, outParams, 0, true, _useWstring | TypeContextCpp11);
- C << nl;
- if(ret)
+ if(p->hasMarshaledResult())
{
- C << retS << " __ret = ";
+ C << nl << "__inS.setMarshaledResult(";
}
- C << fixKwd(name) << args << ';';
- if(ret || !outParams.empty())
+ else if(ret)
{
- C << nl << "auto __os = __inS.startWriteParams();";
- writeMarshalCode(C, outParams, p, true, TypeContextCpp11);
- if(p->returnsClasses(false))
- {
- C << nl << "__os->writePendingValues();";
- }
- C << nl << "__inS.endWriteParams();";
+ C << nl << retS << " __ret = ";
}
else
{
- C << nl << "__inS.writeEmptyParams();";
+ C << nl;
+ }
+
+ C << opName << spar << args << epar;
+ if(p->hasMarshaledResult())
+ {
+ C << ");";
+ }
+ else
+ {
+ C << ";";
+ if(ret || !outParams.empty())
+ {
+ C << nl << "auto __os = __inS.startWriteParams();";
+ writeMarshalCode(C, outParams, p, true, TypeContextCpp11);
+ if(p->returnsClasses(false))
+ {
+ C << nl << "__os->writePendingValues();";
+ }
+ C << nl << "__inS.endWriteParams();";
+ }
+ else
+ {
+ C << nl << "__inS.writeEmptyParams();";
+ }
}
C << nl << "return false;";
}
else
{
C << nl << "auto inS = ::IceInternal::IncomingAsync::create(__inS);";
-
- C << nl << name << "Async(";
- C.useCurrentPosAsIndent();
- if(!argsAMD.empty())
- {
- C << argsAMD << ", ";
- }
- if(ret || !outParams.empty())
+ if(!p->hasMarshaledResult() && (ret || !outParams.empty()))
{
- //C << "inS->response<" << responseParams << ">(), ";
- C << nl << "[inS](" << responseParamsDecl << ")";
+ C << nl << "auto __responseCB = [inS]" << spar << responseParamsDecl << epar;
C << sb;
C << nl << "auto __os = inS->startWriteParams();";
writeMarshalCode(C, outParams, p, true, TypeContextCpp11);
@@ -7263,15 +7262,9 @@ Slice::Gen::Cpp11InterfaceVisitor::visitOperation(const OperationPtr& p)
}
C << nl << "inS->endWriteParams();";
C << nl << "inS->completed();";
- C << eb;
- C << ", ";
- }
- else
- {
- C << "inS->response(), ";
+ C << eb << ';';
}
- C << "inS->exception(), __current);";
- C.restoreIndent();
+ C << nl << opName << spar << args << epar << ';';
C << nl << "return true;";
}
C << eb;
diff --git a/cpp/test/Ice/objects/TestI.cpp b/cpp/test/Ice/objects/TestI.cpp
index 08f0ce760f2..b46797912c3 100644
--- a/cpp/test/Ice/objects/TestI.cpp
+++ b/cpp/test/Ice/objects/TestI.cpp
@@ -161,21 +161,28 @@ InitialI::getF(const Ice::Current&)
return _f;
}
-Test::BPtr
-InitialI::getMB(const Ice::Current&)
+#ifdef ICE_CPP11_MAPPING
+InitialI::GetMBMarshaledResult
+InitialI::getMB(const Ice::Current& current)
{
- return _b1;
+ return GetMBMarshaledResult(_b1, current);
}
void
-#ifdef ICE_CPP11_MAPPING
-InitialI::getAMDMBAsync(function<void(const shared_ptr<B>&)> response,
+InitialI::getAMDMBAsync(function<void(const GetAMDMBMarshaledResult&)> response,
function<void(exception_ptr)>,
- const Ice::Current&)
+ const Ice::Current& current)
{
- response(_b1);
+ response(GetAMDMBMarshaledResult(_b1, current));
}
#else
+Test::BPtr
+InitialI::getMB(const Ice::Current&)
+{
+ return _b1;
+}
+
+void
InitialI::getAMDMB_async(const Test::AMD_Initial_getAMDMBPtr& cb, const Ice::Current&)
{
cb->ice_response(_b1);
diff --git a/cpp/test/Ice/objects/TestI.h b/cpp/test/Ice/objects/TestI.h
index 5212856f533..177d2b01864 100644
--- a/cpp/test/Ice/objects/TestI.h
+++ b/cpp/test/Ice/objects/TestI.h
@@ -97,12 +97,13 @@ public:
virtual Test::EPtr getE(const Ice::Current&);
virtual Test::FPtr getF(const Ice::Current&);
- virtual Test::BPtr getMB(const Ice::Current&);
#ifdef ICE_CPP11_MAPPING
- virtual void getAMDMBAsync(std::function<void(const std::shared_ptr<Test::B>&)>,
+ virtual GetMBMarshaledResult getMB(const Ice::Current&);
+ virtual void getAMDMBAsync(std::function<void(const GetAMDMBMarshaledResult&)>,
std::function<void(std::exception_ptr)>,
const Ice::Current&);
#else
+ virtual Test::BPtr getMB(const Ice::Current&);
virtual void getAMDMB_async(const Test::AMD_Initial_getAMDMBPtr&, const Ice::Current&);
#endif
diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp
index ed02a23f340..baea3211706 100644
--- a/cpp/test/Ice/operations/TestAMDI.cpp
+++ b/cpp/test/Ice/operations/TestAMDI.cpp
@@ -996,56 +996,56 @@ MyDerivedClassI::opWStringLiteralsAsync(function<void(const Test::WStringS&)> re
}
void
-MyDerivedClassI::opMStruct1Async(function<void(const Test::Structure&)> response,
+MyDerivedClassI::opMStruct1Async(function<void(const OpMStruct1MarshaledResult&)> response,
function<void(std::exception_ptr)>,
- const Ice::Current&)
+ const Ice::Current& current)
{
Test::Structure s;
s.e = ICE_ENUM(MyEnum, enum1); // enum must be initialized
- response(s);
+ response(OpMStruct1MarshaledResult(s, current));
}
void
MyDerivedClassI::opMStruct2Async(Test::Structure p1,
- function<void(const Test::Structure&, const Test::Structure&)> response,
+ function<void(const OpMStruct2MarshaledResult&)> response,
function<void(std::exception_ptr)>,
- const Ice::Current&)
+ const Ice::Current& current)
{
- response(p1, p1);
+ response(OpMStruct2MarshaledResult(p1, p1, current));
}
void
-MyDerivedClassI::opMSeq1Async(function<void(const Test::StringS&)> response,
+MyDerivedClassI::opMSeq1Async(function<void(const OpMSeq1MarshaledResult&)> response,
function<void(std::exception_ptr)>,
- const Ice::Current&)
+ const Ice::Current& current)
{
- response(Test::StringS());
+ response(OpMSeq1MarshaledResult(Test::StringS(), current));
}
void
MyDerivedClassI::opMSeq2Async(Test::StringS p1,
- function<void(const Test::StringS&, const Test::StringS&)> response,
+ function<void(const OpMSeq2MarshaledResult&)> response,
function<void(std::exception_ptr)>,
- const Ice::Current&)
+ const Ice::Current& current)
{
- response(p1, p1);
+ response(OpMSeq2MarshaledResult(p1, p1, current));
}
void
-MyDerivedClassI::opMDict1Async(function<void(const Test::StringStringD&)> response,
+MyDerivedClassI::opMDict1Async(function<void(const OpMDict1MarshaledResult&)> response,
function<void(std::exception_ptr)>,
- const Ice::Current&)
+ const Ice::Current& current)
{
- response(Test::StringStringD());
+ response(OpMDict1MarshaledResult(Test::StringStringD(), current));
}
void
MyDerivedClassI::opMDict2Async(Test::StringStringD p1,
- function<void(const Test::StringStringD&, const Test::StringStringD&)> response,
+ function<void(const OpMDict2MarshaledResult&)> response,
function<void(std::exception_ptr)>,
- const Ice::Current&)
+ const Ice::Current& current)
{
- response(p1, p1);
+ response(OpMDict2MarshaledResult(p1, p1, current));
}
#else
diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h
index 06603bb38d6..38cea8022f9 100644
--- a/cpp/test/Ice/operations/TestAMDI.h
+++ b/cpp/test/Ice/operations/TestAMDI.h
@@ -383,30 +383,30 @@ public:
::std::function<void(std::exception_ptr)>,
const Ice::Current&);
- virtual void opMStruct1Async(::std::function<void(const Test::Structure&)>,
+ virtual void opMStruct1Async(::std::function<void(const OpMStruct1MarshaledResult&)>,
::std::function<void(std::exception_ptr)>,
const Ice::Current&);
virtual void opMStruct2Async(ICE_IN(Test::Structure),
- ::std::function<void(const Test::Structure&, const Test::Structure&)>,
+ ::std::function<void(const OpMStruct2MarshaledResult&)>,
::std::function<void(std::exception_ptr)>,
const Ice::Current&);
- virtual void opMSeq1Async(::std::function<void(const Test::StringS&)>,
+ virtual void opMSeq1Async(::std::function<void(const OpMSeq1MarshaledResult&)>,
::std::function<void(std::exception_ptr)>,
const Ice::Current&);
virtual void opMSeq2Async(ICE_IN(Test::StringS),
- ::std::function<void(const Test::StringS&, const Test::StringS&)>,
+ ::std::function<void(const OpMSeq2MarshaledResult&)>,
::std::function<void(std::exception_ptr)>,
const Ice::Current&);
- virtual void opMDict1Async(::std::function<void(const Test::StringStringD&)>,
+ virtual void opMDict1Async(::std::function<void(const OpMDict1MarshaledResult&)>,
::std::function<void(std::exception_ptr)>,
const Ice::Current&);
virtual void opMDict2Async(ICE_IN(Test::StringStringD),
- ::std::function<void(const Test::StringStringD&, const Test::StringStringD&)>,
+ ::std::function<void(const OpMDict2MarshaledResult&)>,
::std::function<void(std::exception_ptr)>,
const Ice::Current&);
diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp
index 7b7f4ba6c33..91154cf5769 100644
--- a/cpp/test/Ice/operations/TestI.cpp
+++ b/cpp/test/Ice/operations/TestI.cpp
@@ -843,6 +843,48 @@ MyDerivedClassI::opWStringLiterals(const Ice::Current&)
return data;
}
+#ifdef ICE_CPP11_MAPPING
+MyDerivedClassI::OpMStruct1MarshaledResult
+MyDerivedClassI::opMStruct1(const Ice::Current& current)
+{
+ Test::Structure s;
+ s.e = ICE_ENUM(MyEnum, enum1); // enum must be initialized
+ return OpMStruct1MarshaledResult(s, current);
+}
+
+
+MyDerivedClassI::OpMStruct2MarshaledResult
+MyDerivedClassI::opMStruct2(ICE_IN(Test::Structure) p1, const Ice::Current& current)
+{
+ return OpMStruct2MarshaledResult(p1, p1, current);
+}
+
+MyDerivedClassI::OpMSeq1MarshaledResult
+MyDerivedClassI::opMSeq1(const Ice::Current& current)
+{
+ return OpMSeq1MarshaledResult(Test::StringS(), current);
+}
+
+MyDerivedClassI::OpMSeq2MarshaledResult
+MyDerivedClassI::opMSeq2(ICE_IN(Test::StringS) p1, const Ice::Current& current)
+{
+ return OpMSeq2MarshaledResult(p1, p1, current);
+}
+
+MyDerivedClassI::OpMDict1MarshaledResult
+MyDerivedClassI::opMDict1(const Ice::Current& current)
+{
+ return OpMDict1MarshaledResult(Test::StringStringD(), current);
+}
+
+MyDerivedClassI::OpMDict2MarshaledResult
+MyDerivedClassI::opMDict2(ICE_IN(Test::StringStringD) p1, const Ice::Current& current)
+{
+ return OpMDict2MarshaledResult(p1, p1, current);
+}
+
+#else
+
Test::Structure
MyDerivedClassI::opMStruct1(const Ice::Current&)
{
@@ -851,7 +893,6 @@ MyDerivedClassI::opMStruct1(const Ice::Current&)
return s;
}
-
Test::Structure
MyDerivedClassI::opMStruct2(ICE_IN(Test::Structure) p1, Test::Structure& p2, const Ice::Current&)
{
@@ -885,3 +926,4 @@ MyDerivedClassI::opMDict2(ICE_IN(Test::StringStringD) p1, Test::StringStringD& p
return p1;
}
+#endif \ No newline at end of file
diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h
index 9b85bc09769..83a364fdc69 100644
--- a/cpp/test/Ice/operations/TestI.h
+++ b/cpp/test/Ice/operations/TestI.h
@@ -305,6 +305,19 @@ public:
virtual Test::WStringS opWStringLiterals(const Ice::Current&);
+#ifdef ICE_CPP11_MAPPING
+ virtual OpMStruct1MarshaledResult opMStruct1(const Ice::Current&);
+
+ virtual OpMStruct2MarshaledResult opMStruct2(ICE_IN(Test::Structure), const Ice::Current&);
+
+ virtual OpMSeq1MarshaledResult opMSeq1(const Ice::Current&);
+
+ virtual OpMSeq2MarshaledResult opMSeq2(ICE_IN(Test::StringS), const Ice::Current&);
+
+ virtual OpMDict1MarshaledResult opMDict1(const Ice::Current&);
+
+ virtual OpMDict2MarshaledResult opMDict2(ICE_IN(Test::StringStringD), const Ice::Current&);
+#else
virtual Test::Structure opMStruct1(const Ice::Current&);
virtual Test::Structure opMStruct2(ICE_IN(Test::Structure), Test::Structure&, const Ice::Current&);
@@ -316,6 +329,7 @@ public:
virtual Test::StringStringD opMDict1(const Ice::Current&);
virtual Test::StringStringD opMDict2(ICE_IN(Test::StringStringD), Test::StringStringD&, const Ice::Current&);
+#endif
private:
diff --git a/cpp/test/Ice/optional/TestAMDI.cpp b/cpp/test/Ice/optional/TestAMDI.cpp
index 94c5645d326..817afefb905 100644
--- a/cpp/test/Ice/optional/TestAMDI.cpp
+++ b/cpp/test/Ice/optional/TestAMDI.cpp
@@ -379,6 +379,75 @@ InitialI::opVoidAsync(::std::function<void()> response,
response();
}
+#ifdef ICE_CPP11_MAPPING
+void
+InitialI::opMStruct1Async(function<void(const OpMStruct1MarshaledResult&)> response,
+ function<void(exception_ptr)>,
+ const Ice::Current& current)
+{
+ response(OpMStruct1MarshaledResult(Test::SmallStruct(), current));
+}
+
+void
+InitialI::opMStruct2Async(Ice::optional<SmallStruct> p1,
+ function<void(const OpMStruct2MarshaledResult&)> response,
+ function<void(exception_ptr)>,
+ const Ice::Current& current)
+{
+ response(OpMStruct2MarshaledResult(p1, p1, current));
+}
+
+void
+InitialI::opMSeq1Async(function<void(const OpMSeq1MarshaledResult&)> response,
+ function<void(exception_ptr)>,
+ const Ice::Current& current)
+{
+ response(OpMSeq1MarshaledResult(Test::StringSeq(), current));
+}
+
+void
+InitialI::opMSeq2Async(Ice::optional<Test::StringSeq> p1,
+ function<void(const OpMSeq2MarshaledResult&)> response,
+ function<void(exception_ptr)>,
+ const Ice::Current& current)
+{
+ response(OpMSeq2MarshaledResult(p1, p1, current));
+}
+
+void
+InitialI::opMDict1Async(function<void(const OpMDict1MarshaledResult&)> response,
+ function<void(exception_ptr)>,
+ const Ice::Current& current)
+{
+ response(OpMDict1MarshaledResult(StringIntDict(), current));
+}
+
+void
+InitialI::opMDict2Async(Ice::optional<StringIntDict> p1,
+ function<void(const OpMDict2MarshaledResult&)> response,
+ function<void(exception_ptr)>,
+ const Ice::Current& current)
+{
+ response(OpMDict2MarshaledResult(p1, p1, current));
+}
+
+void
+InitialI::opMG1Async(function<void(const OpMG1MarshaledResult&)> response,
+ function<void(exception_ptr)>,
+ const Ice::Current& current)
+{
+ response(OpMG1MarshaledResult(ICE_MAKE_SHARED(G), current));
+}
+
+void
+InitialI::opMG2Async(Ice::optional<GPtr> p1,
+ function<void(const OpMG2MarshaledResult&)> response,
+ function<void(exception_ptr)>,
+ const Ice::Current& current)
+{
+ response(OpMG2MarshaledResult(p1, p1, current));
+}
+#else
void
InitialI::opMStruct1Async(function<void(const Ice::optional<SmallStruct>&)> response,
function<void(exception_ptr)>,
@@ -446,6 +515,7 @@ InitialI::opMG2Async(Ice::optional<GPtr> p1,
{
response(p1, p1);
}
+#endif
void
InitialI::supportsRequiredParamsAsync(::std::function<void(bool)> response,
diff --git a/cpp/test/Ice/optional/TestAMDI.h b/cpp/test/Ice/optional/TestAMDI.h
index 278054f04f5..c38e7301662 100644
--- a/cpp/test/Ice/optional/TestAMDI.h
+++ b/cpp/test/Ice/optional/TestAMDI.h
@@ -202,6 +202,43 @@ public:
virtual void opVoidAsync(::std::function<void()>,
::std::function<void(::std::exception_ptr)>, const Ice::Current&) override;
+#ifdef ICE_CPP11_MAPPING
+ virtual void opMStruct1Async(::std::function<void(const OpMStruct1MarshaledResult&)>,
+ ::std::function<void(::std::exception_ptr)>,
+ const Ice::Current&) override;
+
+ virtual void opMStruct2Async(Ice::optional<Test::SmallStruct>,
+ ::std::function<void(const OpMStruct2MarshaledResult&)>,
+ ::std::function<void(::std::exception_ptr)>,
+ const Ice::Current&) override;
+
+ virtual void opMSeq1Async(::std::function<void(const OpMSeq1MarshaledResult&)>,
+ ::std::function<void(::std::exception_ptr)>,
+ const Ice::Current&) override;
+
+ virtual void opMSeq2Async(Ice::optional<Test::StringSeq>,
+ ::std::function<void(const OpMSeq2MarshaledResult&)>,
+ ::std::function<void(::std::exception_ptr)>,
+ const Ice::Current&) override;
+
+ virtual void opMDict1Async(::std::function<void(const OpMDict1MarshaledResult&)>,
+ ::std::function<void(::std::exception_ptr)>,
+ const Ice::Current&) override;
+
+ virtual void opMDict2Async(Ice::optional<Test::StringIntDict>,
+ ::std::function<void(const OpMDict2MarshaledResult&)>,
+ ::std::function<void(::std::exception_ptr)>,
+ const Ice::Current&) override;
+
+ virtual void opMG1Async(::std::function<void(const OpMG1MarshaledResult&)>,
+ ::std::function<void(::std::exception_ptr)>,
+ const Ice::Current&) override;
+
+ virtual void opMG2Async(Ice::optional<Test::GPtr>,
+ ::std::function<void(const OpMG2MarshaledResult&)>,
+ ::std::function<void(::std::exception_ptr)>,
+ const Ice::Current&) override;
+#else
virtual void opMStruct1Async(::std::function<void(const Ice::optional<Test::SmallStruct>&)>,
::std::function<void(::std::exception_ptr)>,
const Ice::Current&) override;
@@ -241,6 +278,7 @@ public:
const Ice::optional<Test::GPtr>&)>,
::std::function<void(::std::exception_ptr)>,
const Ice::Current&) override;
+#endif
virtual void supportsRequiredParamsAsync(::std::function<void(bool)>,
::std::function<void(::std::exception_ptr)>, const Ice::Current&) override;
diff --git a/cpp/test/Ice/optional/TestI.cpp b/cpp/test/Ice/optional/TestI.cpp
index 426082e1abe..1ebaf4afd93 100644
--- a/cpp/test/Ice/optional/TestI.cpp
+++ b/cpp/test/Ice/optional/TestI.cpp
@@ -427,6 +427,55 @@ InitialI::opVoid(const Ice::Current&)
{
}
+#ifdef ICE_CPP11_MAPPING
+InitialI::OpMStruct1MarshaledResult
+InitialI::opMStruct1(const Ice::Current& current)
+{
+ return OpMStruct1MarshaledResult(Test::SmallStruct(), current);
+}
+
+InitialI::OpMStruct2MarshaledResult
+InitialI::opMStruct2(ICE_IN(IceUtil::Optional<Test::SmallStruct>) p1, const Ice::Current& current)
+{
+ return OpMStruct2MarshaledResult(p1, p1, current);
+}
+
+InitialI::OpMSeq1MarshaledResult
+InitialI::opMSeq1(const Ice::Current& current)
+{
+ return OpMSeq1MarshaledResult(Test::StringSeq(), current);
+}
+
+InitialI::OpMSeq2MarshaledResult
+InitialI::opMSeq2(ICE_IN(IceUtil::Optional<Test::StringSeq>) p1, const Ice::Current& current)
+{
+ return OpMSeq2MarshaledResult(p1, p1, current);
+}
+
+InitialI::OpMDict1MarshaledResult
+InitialI::opMDict1(const Ice::Current& current)
+{
+ return OpMDict1MarshaledResult(Test::StringIntDict(), current);
+}
+
+InitialI::OpMDict2MarshaledResult
+InitialI::opMDict2(ICE_IN(IceUtil::Optional<Test::StringIntDict>) p1, const Ice::Current& current)
+{
+ return OpMDict2MarshaledResult(p1, p1, current);
+}
+
+InitialI::OpMG1MarshaledResult
+InitialI::opMG1(const Ice::Current& current)
+{
+ return OpMG1MarshaledResult(ICE_MAKE_SHARED(G), current);
+}
+
+InitialI::OpMG2MarshaledResult
+InitialI::opMG2(ICE_IN(IceUtil::Optional<Test::GPtr>) p1, const Ice::Current& current)
+{
+ return OpMG2MarshaledResult(p1, p1, current);
+}
+#else
IceUtil::Optional<Test::SmallStruct>
InitialI::opMStruct1(const Ice::Current&)
{
@@ -486,6 +535,7 @@ InitialI::opMG2(ICE_IN(IceUtil::Optional<Test::GPtr>) p1,
p2 = p1;
return p1;
}
+#endif
bool
InitialI::supportsRequiredParams(const Ice::Current&)
diff --git a/cpp/test/Ice/optional/TestI.h b/cpp/test/Ice/optional/TestI.h
index 461aace5eeb..edd141ce2f5 100644
--- a/cpp/test/Ice/optional/TestI.h
+++ b/cpp/test/Ice/optional/TestI.h
@@ -218,6 +218,23 @@ public:
virtual void opVoid(const Ice::Current&);
+#ifdef ICE_CPP11_MAPPING
+ virtual OpMStruct1MarshaledResult opMStruct1(const Ice::Current&);
+
+ virtual OpMStruct2MarshaledResult opMStruct2(ICE_IN(IceUtil::Optional<Test::SmallStruct>), const Ice::Current&);
+
+ virtual OpMSeq1MarshaledResult opMSeq1(const Ice::Current&);
+
+ virtual OpMSeq2MarshaledResult opMSeq2(ICE_IN(IceUtil::Optional<Test::StringSeq>), const Ice::Current&);
+
+ virtual OpMDict1MarshaledResult opMDict1(const Ice::Current&);
+
+ virtual OpMDict2MarshaledResult opMDict2(ICE_IN(IceUtil::Optional<Test::StringIntDict>), const Ice::Current&);
+
+ virtual OpMG1MarshaledResult opMG1(const Ice::Current&);
+
+ virtual OpMG2MarshaledResult opMG2(ICE_IN(IceUtil::Optional<Test::GPtr>), const Ice::Current&);
+#else
virtual IceUtil::Optional<Test::SmallStruct> opMStruct1(const Ice::Current&);
virtual IceUtil::Optional<Test::SmallStruct> opMStruct2(ICE_IN(IceUtil::Optional<Test::SmallStruct>),
@@ -241,6 +258,7 @@ public:
virtual IceUtil::Optional<Test::GPtr> opMG2(ICE_IN(IceUtil::Optional<Test::GPtr>),
IceUtil::Optional<Test::GPtr>&,
const Ice::Current&);
+#endif
virtual bool supportsRequiredParams(const Ice::Current&);