summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp413
1 files changed, 323 insertions, 90 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index db170626d26..f6cb56d797b 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -335,20 +335,17 @@ Slice::Gen::generate(const UnitPtr& p)
C << _base << "." << _headerExtension << ">";
- H << "\n#include <Ice/LocalObjectF.h>";
H << "\n#include <Ice/ProxyF.h>";
H << "\n#include <Ice/ObjectF.h>";
H << "\n#include <Ice/Exception.h>";
H << "\n#include <Ice/LocalObject.h>";
H << "\n#include <Ice/StreamTraits.h>";
-
- if(p->usesProxies())
- {
- H << "\n#include <Ice/Proxy.h>";
- }
+ H << "\n#include <IceUtil/ScopedArray.h>";
+ H << "\n#include <IceUtil/Optional.h>";
if(p->hasNonLocalClassDefs())
{
+ H << "\n#include <Ice/Proxy.h>";
H << "\n#include <Ice/Object.h>";
H << "\n#include <Ice/Outgoing.h>";
H << "\n#include <Ice/OutgoingAsync.h>";
@@ -362,19 +359,11 @@ Slice::Gen::generate(const UnitPtr& p)
C << "\n#include <Ice/LocalException.h>";
C << "\n#include <Ice/ObjectFactory.h>";
}
- else if(p->hasNonLocalClassDecls())
- {
-
- H << "\n#include <Ice/Object.h>";
- }
if(p->hasNonLocalDataOnlyClasses() || p->hasNonLocalExceptions())
{
H << "\n#include <Ice/FactoryTableInit.h>";
}
-
- H << "\n#include <IceUtil/ScopedArray.h>";
- H << "\n#include <IceUtil/Optional.h>";
if(p->usesNonLocals())
{
@@ -825,8 +814,8 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
H << nl << "virtual void ice_print(::std::ostream&) const;";
}
- H << nl << "virtual ::Ice::Exception* ice_clone() const;";
- C << sp << nl << "::Ice::Exception*" << nl << scoped.substr(2) << "::ice_clone() const";
+ H << nl << "virtual " << name << "* ice_clone() const;";
+ C << sp << nl << scoped.substr(2) << "*" << nl << scoped.substr(2) << "::ice_clone() const";
C << sb;
C << nl << "return new " << name << "(*this);";
C << eb;
@@ -986,14 +975,14 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
//
C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const";
C << sb;
- C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
+ C << nl << "::Ice::MarshalException ex(__FILE__, __LINE__);";
C << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
C << nl << "throw ex;";
C << eb;
C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&)";
C << sb;
- C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
+ C << nl << "::Ice::MarshalException ex(__FILE__, __LINE__);";
C << nl << "ex.reason = \"exception " << scoped .substr(2)<< " was not generated with stream support\";";
C << nl << "throw ex;";
C << eb;
@@ -1774,6 +1763,38 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
_useWstring = resetUseWstring(_useWstringHist);
}
+namespace
+{
+
+bool
+usePrivateEnd(const OperationPtr& p)
+{
+ TypePtr ret = p->returnType();
+ bool retIsOpt = p->returnIsOptional();
+ string retSEnd = returnTypeToString(ret, retIsOpt, p->getMetaData(), TypeContextAMIEnd);
+ string retSPrivateEnd = returnTypeToString(ret, retIsOpt, p->getMetaData(), TypeContextAMIPrivateEnd);
+
+ ParamDeclList outParams;
+ vector<string> outDeclsEnd;
+ vector<string> outDeclsPrivateEnd;
+
+ ParamDeclList paramList = p->parameters();
+ for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
+ {
+ if((*q)->isOutParam())
+ {
+ outDeclsEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ TypeContextAMIEnd));
+ outDeclsPrivateEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
+ TypeContextAMIPrivateEnd));
+ }
+ }
+
+ return retSEnd != retSPrivateEnd || outDeclsEnd != outDeclsPrivateEnd;
+}
+
+}
+
void
Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
@@ -1782,14 +1803,17 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
string scope = fixKwd(p->scope());
TypePtr ret = p->returnType();
+
bool retIsOpt = p->returnIsOptional();
string retS = returnTypeToString(ret, retIsOpt, p->getMetaData(), _useWstring | TypeContextAMIEnd);
string retSEndAMI = returnTypeToString(ret, retIsOpt, p->getMetaData(), _useWstring | TypeContextAMIPrivateEnd);
+ string retInS = retS != "void" ? inputTypeToString(ret, retIsOpt, p->getMetaData(), _useWstring) : "";
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
+ string clName = cl->name();
string clScope = fixKwd(cl->scope());
- string delName = "Callback_" + cl->name() + "_" + name;
+ string delName = "Callback_" + clName + "_" + name;
string delNameScoped = clScope + delName;
vector<string> params;
@@ -1800,12 +1824,18 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
vector<string> paramsDeclAMI;
vector<string> argsAMI;
vector<string> outParamsAMI;
+ vector<string> outParamNamesAMI;
vector<string> outParamsDeclAMI;
vector<string> outParamsDeclEndAMI;
-
+ vector<string> outDecls;
+
ParamDeclList paramList = p->parameters();
ParamDeclList inParams;
ParamDeclList outParams;
+
+
+ vector<string> outEndArgs;
+
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
string paramName = fixKwd((*q)->name());
@@ -1838,9 +1868,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
else
{
outParamsAMI.push_back(typeString);
+ outParamNamesAMI.push_back(paramName);
outParamsDeclAMI.push_back(typeString + ' ' + paramName);
outParamsDeclEndAMI.push_back(typeStringEndAMI + ' ' + paramName);
outParams.push_back(*q);
+ outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring));
+ outEndArgs.push_back(getEndArg((*q)->type(), (*q)->getMetaData(), outParamNamesAMI.back()));
}
}
@@ -1884,6 +1917,201 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
}
H << fixKwd(name) << spar << args << "&__ctx" << epar << ';';
H << eb;
+
+ H.zeroIndent();
+ H << nl << "#ifdef ICE_CPP11";
+ H.restoreIndent();
+
+ string retEndArg = getEndArg(ret, p->getMetaData(), "__ret");
+
+ H << nl << "::Ice::AsyncResultPtr";
+ H << nl << "begin_" << name << spar << paramsDeclAMI
+ << "const ::IceInternal::Function<void " << spar;
+ if(!retInS.empty())
+ {
+ H << retInS;
+ }
+ H << outDecls << epar << ">& response, "
+ << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception = "
+ "::IceInternal::Function<void (const ::Ice::Exception&)>(), "
+ << "const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>()" << epar;
+
+ H << sb;
+ if(p->returnsData())
+ {
+ H << nl << "return __begin_" << name << spar << argsAMI << "0, response, exception, sent" << epar << ";";
+ }
+ else
+ {
+ H << nl << "return begin_" << name << spar << argsAMI
+ << "0, new ::IceInternal::Cpp11FnOnewayCallbackNC(response, exception, sent)" << epar << ";";
+
+ }
+ H << eb;
+
+ H << nl << "::Ice::AsyncResultPtr";
+ H << nl << "begin_" << name << spar << paramsDeclAMI
+ << "const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed"
+ << "const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent = "
+ "::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>()" << epar;
+ H << sb;
+ H << nl << "return begin_" << name << spar << argsAMI << "0, ::Ice::newCallback(completed, sent), 0" << epar << ";";
+ H << eb;
+
+
+ H << nl << "::Ice::AsyncResultPtr";
+ H << nl << "begin_" << name << spar << paramsDeclAMI << "const ::Ice::Context& ctx"
+ << "const ::IceInternal::Function<void " << spar;
+ if(!retInS.empty())
+ {
+ H << retInS;
+ }
+ H << outDecls << epar << ">& response, "
+ << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception = "
+ "::IceInternal::Function<void (const ::Ice::Exception&)>(), "
+ << "const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>()" << epar;
+
+ H << sb;
+ if(p->returnsData())
+ {
+ H << nl << "return __begin_" << name << spar << argsAMI << "&ctx, response, exception, sent" << epar << ";";
+ }
+ else
+ {
+ H << nl << "return begin_" << name << spar << argsAMI
+ << "&ctx, new ::IceInternal::Cpp11FnOnewayCallbackNC(response, exception, sent), 0" << epar << ";";
+ }
+ H << eb;
+
+ H << nl << "::Ice::AsyncResultPtr";
+ H << nl << "begin_" << name << spar << paramsDeclAMI
+ << "const ::Ice::Context& ctx"
+ << "const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& completed"
+ << "const ::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>& sent = "
+ "::IceInternal::Function<void (const ::Ice::AsyncResultPtr&)>()" << epar;
+ H << sb;
+ H << nl << "return begin_" << name << spar << argsAMI << "&ctx, ::Ice::newCallback(completed, sent)" << epar << ";";
+ H << eb;
+
+ if(p->returnsData())
+ {
+ H << nl;
+ H.dec();
+ H << nl << "private:";
+ H.inc();
+
+
+ H << sp << nl << "::Ice::AsyncResultPtr __begin_" << name << spar << paramsDeclAMI
+ << "const ::Ice::Context* ctx" << "const ::IceInternal::Function<void " << spar;
+
+
+ if(!retInS.empty())
+ {
+ H << retInS;
+ }
+ H << outDecls;
+
+ H << epar << ">& response, "
+ << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception, "
+ << "const ::IceInternal::Function<void (bool)>& sent" << epar;
+ H << sb;
+ H << nl << "class Cpp11CB : public ::IceInternal::Cpp11FnCallbackNC";
+ H << sb;
+ H.dec();
+ H << nl << "public:";
+ H.inc();
+ H << sp << nl << "Cpp11CB" << spar << "const ::std::function<void " << spar;
+ if(!retInS.empty())
+ {
+ H << retInS;
+ }
+ H << outDecls;
+ H << epar << ">& responseFunc, "
+ << "const ::std::function<void (const ::Ice::Exception&)>& exceptionFunc, "
+ << "const ::std::function<void (bool)>& sentFunc" << epar << " :";
+ H.inc();
+ H << nl << "::IceInternal::Cpp11FnCallbackNC(exceptionFunc, sentFunc),";
+ H << nl << "_response(responseFunc)";
+ H.dec();
+ H << sb;
+ H << nl << "CallbackBase::checkCallback(true, responseFunc || exceptionFunc != nullptr);";
+ H << eb;
+
+ //
+ // completed.
+ //
+ H << sp << nl << "virtual void __completed(const ::Ice::AsyncResultPtr& __result) const";
+ H << sb;
+ H << nl << clScope << clName << "Prx __proxy = " << clScope << clName
+ << "Prx::uncheckedCast(__result->getProxy());";
+ writeAllocateCode(H, outParams, p, _useWstring | TypeContextInParam | TypeContextAMICallPrivateEnd);
+ H << nl << "try";
+ H << sb;
+ H << nl;
+ if(!usePrivateEnd(p))
+ {
+ if(ret)
+ {
+ H << retEndArg << " = ";
+ }
+ H << "__proxy->end_" << p->name() << spar << outEndArgs << "__result" << epar << ';';
+ }
+ else
+ {
+ H << "__proxy->___end_" << p->name() << spar << outEndArgs;
+ if(ret)
+ {
+ H << retEndArg;
+ }
+ H << "__result" << epar << ';';
+ }
+ writeEndCode(H, outParams, p);
+ H << eb;
+ H << nl << "catch(::Ice::Exception& ex)";
+ H << sb;
+ H << nl << "Cpp11FnCallbackNC::__exception(__result, ex);";
+ H << nl << "return;";
+ H << eb;
+ H << nl << "if(_response != nullptr)";
+ H << sb;
+ H << nl << "_response" << spar;
+ if(ret)
+ {
+ H << "__ret";
+ }
+ H << outParamNamesAMI;
+ H << epar << ';';
+ H << eb;
+ H << eb;
+
+ H.dec();
+ H << nl << nl << "private:";
+ H.inc();
+ H << nl;
+ H << nl << "::std::function<void " << spar;
+
+ if(!retInS.empty())
+ {
+ H << retInS;
+ }
+ H << outDecls;
+
+ H << epar << "> _response;";
+
+ H << eb << ';';
+
+ H << nl << "return begin_" << name << spar << argsAMI << "ctx" << "new Cpp11CB(response, exception, sent)"
+ << epar << ';';
+ H << eb;
+ H << nl;
+ H.dec();
+ H << nl << "public:";
+ H.inc();
+ }
+
+ H.zeroIndent();
+ H << nl << "#endif";
+ H.restoreIndent();
H << sp << nl << "::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << epar;
H << sb;
@@ -1932,7 +2160,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
<< "const ::Ice::AsyncResultPtr&" << epar << ';';
if(generatePrivateEnd)
{
- H << sp << nl << "void ___end_" << name << spar << outParamsDeclEndAMI;
+ H << sp << nl << _dllExport << " void ___end_" << name << spar << outParamsDeclEndAMI;
H << "const ::Ice::AsyncResultPtr&" << epar << ';';
}
@@ -1949,9 +2177,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
H.dec();
H << nl << "public:";
H.inc();
-
+
C << sp << nl << retS << nl << "IceProxy" << scoped << spar << paramsDecl << "const ::Ice::Context* __ctx" << epar;
C << sb;
+ C << nl << "::IceInternal::InvocationObserver __observer(this, " << p->flattenedScope() << p->name()
+ << "_name, __ctx);";
C << nl << "int __cnt = 0;";
C << nl << "while(true)";
C << sb;
@@ -1971,7 +2201,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
C << "return ";
}
- C << "__del->" << fixKwd(name) << spar << args << "__ctx" << epar << ';';
+ C << "__del->" << fixKwd(name) << spar << args << "__ctx" << "__observer" << epar << ';';
if(!ret)
{
C << nl << "return;";
@@ -1981,16 +2211,16 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
C << sb;
if(p->mode() == Operation::Idempotent || p->mode() == Operation::Nonmutating)
{
- C << nl << "__handleExceptionWrapperRelaxed(__delBase, __ex, true, __cnt);";
+ C << nl << "__handleExceptionWrapperRelaxed(__delBase, __ex, true, __cnt, __observer);";
}
else
{
- C << nl << "__handleExceptionWrapper(__delBase, __ex);";
+ C << nl << "__handleExceptionWrapper(__delBase, __ex, __observer);";
}
C << eb;
C << nl << "catch(const ::Ice::LocalException& __ex)";
C << sb;
- C << nl << "__handleException(__delBase, __ex, true, __cnt);";
+ C << nl << "__handleException(__delBase, __ex, true, __cnt, __observer);";
C << eb;
C << eb;
C << eb;
@@ -2393,6 +2623,7 @@ Slice::Gen::DelegateVisitor::visitOperation(const OperationPtr& p)
}
params.push_back("const ::Ice::Context*");
+ params.push_back("::IceInternal::InvocationObserver&");
H << sp << nl << "virtual " << retS << ' ' << name << spar << params << epar << " = 0;";
}
@@ -2534,7 +2765,9 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
}
params.push_back("const ::Ice::Context*");
+ params.push_back("::IceInternal::InvocationObserver&");
paramsDecl.push_back("const ::Ice::Context* __context");
+ paramsDecl.push_back("::IceInternal::InvocationObserver& __observer");
string flatName = p->flattenedScope() + p->name() + "_name";
@@ -2542,7 +2775,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p)
C << sp << nl << retS << nl << "IceDelegateM" << scoped << spar << paramsDecl << epar;
C << sb;
C << nl << "::IceInternal::Outgoing __og(__handler.get(), " << flatName << ", "
- << operationModeToString(p->sendMode()) << ", __context);";
+ << operationModeToString(p->sendMode()) << ", __context, __observer);";
if(inParams.empty())
{
C << nl << "__og.writeEmptyParams();";
@@ -2796,6 +3029,9 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
}
params.push_back("const ::Ice::Context*");
+ params.push_back("::IceInternal::InvocationObserver&");
+ paramsDecl.push_back("const ::Ice::Context* __context");
+ paramsDecl.push_back("::IceInternal::InvocationObserver&");
args.push_back("__current");
argMembers.push_back("_current");
@@ -2820,8 +3056,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p)
}
else
{
- C << sp << nl << retS << nl << "IceDelegateD" << scoped << spar << paramsDecl
- << "const ::Ice::Context* __context" << epar;
+ C << sp << nl << retS << nl << "IceDelegateD" << scoped << spar << paramsDecl << epar;
C << sb;
C << nl << "class _DirectI : public ::IceInternal::Direct";
C << sb;
@@ -3320,27 +3555,37 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isLocal())
{
- H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;";
-
C << sp << nl
<< (_dllExport.empty() ? "" : "ICE_DECLSPEC_EXPORT ")
<< "::Ice::Object* " << scope.substr(2) << "upCast(" << scoped << "* p) { return p; }";
- C << sp;
- C << nl << "::Ice::ObjectPtr";
- C << nl << scoped.substr(2) << "::ice_clone() const";
- C << sb;
- if(!p->isAbstract())
- {
- C << nl << fixKwd(p->scope()) << p->name() << "Ptr __p = new " << scoped << "(*this);";
- C << nl << "return __p;";
- }
- else
- {
- C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);";
- C << nl << "return 0; // to avoid a warning with some compilers";
- }
- C << eb;
+ //
+ // It would make sense to provide a covariant ice_clone(); unfortunately many compilers
+ // (including VS2010) generate bad code for covariant types that use virtual inheritance
+ //
+
+ if(!p->isInterface())
+ {
+ H << nl << "virtual ::Ice::ObjectPtr ice_clone() const;";
+
+ C << nl << "::Ice::ObjectPtr";
+ C << nl << scoped.substr(2) << "::ice_clone() const";
+ C << sb;
+ if(!p->isAbstract())
+ {
+ C << nl << "::Ice::Object* __p = new " << name << "(*this);";
+ C << nl << "return __p;";
+ }
+ else
+ {
+ //
+ // We need this ice_clone for abstract classes derived from concrete classes
+ //
+ C << nl << "throw ::Ice::CloneNotImplementedException(__FILE__, __LINE__);";
+ C << nl << "return 0; // to avoid a warning with some compilers";
+ }
+ C << eb;
+ }
ClassList allBases = p->allBases();
StringList ids;
@@ -3724,7 +3969,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
//
C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const";
C << sb;
- C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
+ C << nl << "::Ice::MarshalException ex(__FILE__, __LINE__);";
C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
C << nl << "throw ex;";
C << eb;
@@ -3732,7 +3977,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << sp;
C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&)";
C << sb;
- C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);";
+ C << nl << "::Ice::MarshalException ex(__FILE__, __LINE__);";
C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
C << nl << "throw ex;";
C << eb;
@@ -3971,6 +4216,7 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
ParamDeclList inParams;
ParamDeclList outParams;
ParamDeclList paramList = p->parameters();
+ vector< string> outDecls;
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
string paramName = fixKwd((*q)->name());
@@ -4012,6 +4258,10 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
argsAMD += paramName;
argsAMD += ", ";
}
+ else
+ {
+ outDecls.push_back(inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring));
+ }
}
if(!cl->isLocal())
@@ -4202,6 +4452,18 @@ Slice::Gen::ObjectVisitor::visitOperation(const OperationPtr& p)
outParamsDeclAMI.push_back(typeString + ' ' + paramName);
}
}
+
+ H.zeroIndent();
+ H << nl << "#ifdef ICE_CPP11";
+ H.restoreIndent();
+
+ H << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI
+ << "const ::IceInternal::Function<void (const ::Ice::Exception&)>& exception"
+ << "const ::IceInternal::Function<void (bool)>& sent = ::IceInternal::Function<void (bool)>()" << epar << " = 0;";
+
+ H.zeroIndent();
+ H << nl << "#endif";
+ H.restoreIndent();
H << sp << nl << "virtual ::Ice::AsyncResultPtr begin_" << name << spar << paramsDeclAMI << epar << " = 0;";
@@ -4730,38 +4992,6 @@ Slice::Gen::AsyncCallbackTemplateVisitor::visitClassDefEnd(const ClassDefPtr& p)
_useWstring = resetUseWstring(_useWstringHist);
}
-namespace
-{
-
-bool
-usePrivateEnd(const OperationPtr& p)
-{
- TypePtr ret = p->returnType();
- bool retIsOpt = p->returnIsOptional();
- string retSEnd = returnTypeToString(ret, retIsOpt, p->getMetaData(), TypeContextAMIEnd);
- string retSPrivateEnd = returnTypeToString(ret, retIsOpt, p->getMetaData(), TypeContextAMIPrivateEnd);
-
- ParamDeclList outParams;
- vector<string> outDeclsEnd;
- vector<string> outDeclsPrivateEnd;
-
- ParamDeclList paramList = p->parameters();
- for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
- {
- if((*q)->isOutParam())
- {
- outDeclsEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
- TypeContextAMIEnd));
- outDeclsPrivateEnd.push_back(outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(),
- TypeContextAMIPrivateEnd));
- }
- }
-
- return retSEnd != retSPrivateEnd || outDeclsEnd != outDeclsPrivateEnd;
-}
-
-}
-
void
Slice::Gen::AsyncCallbackTemplateVisitor::visitOperation(const OperationPtr& p)
{
@@ -5902,16 +6132,19 @@ Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p)
void
Slice::Gen::StreamVisitor::visitEnum(const EnumPtr& p)
{
- string scoped = fixKwd(p->scoped());
- H << nl << "template<>";
- H << nl << "struct StreamTrait< " << scoped << ">";
- H << sb;
- H << nl << "static const ::Ice::StreamTraitType type = ::Ice::StreamTraitTypeEnum;";
- H << nl << "static const int enumLimit = " << p->getEnumerators().size() << ";";
- H << nl << "static const int minWireSize = " << p->minWireSize() << ";";
- H << nl << "static const bool isVariableLength = true;";
- H << nl << "static const ::Ice::OptionalType optionalType = ::Ice::OptionalTypeSize;";
- H << eb << ";" << nl;
+ if(!p->isLocal())
+ {
+ string scoped = fixKwd(p->scoped());
+ H << nl << "template<>";
+ H << nl << "struct StreamTrait< " << scoped << ">";
+ H << sb;
+ H << nl << "static const ::Ice::StreamTraitType type = ::Ice::StreamTraitTypeEnum;";
+ H << nl << "static const int enumLimit = " << p->getEnumerators().size() << ";";
+ H << nl << "static const int minWireSize = " << p->minWireSize() << ";";
+ H << nl << "static const bool isVariableLength = true;";
+ H << nl << "static const ::Ice::OptionalType optionalType = ::Ice::OptionalTypeSize;";
+ H << eb << ";" << nl;
+ }
}
void