diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 596 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.h | 39 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Main.cpp | 22 | ||||
-rw-r--r-- | cpp/test/Ice/Makefile | 54 | ||||
-rw-r--r-- | cpp/test/Ice/impl/.gitignore | 9 | ||||
-rw-r--r-- | cpp/test/Ice/impl/Makefile | 60 | ||||
-rw-r--r-- | cpp/test/Ice/impl/Makefile.mak | 78 | ||||
-rw-r--r-- | cpp/test/Ice/impl/Server.cpp | 58 | ||||
-rw-r--r-- | cpp/test/Ice/impl/ServerAMD.cpp | 58 | ||||
-rw-r--r-- | cpp/test/Ice/impl/Test.ice | 278 | ||||
-rw-r--r-- | cpp/test/Ice/impl/TestAMD.ice | 280 |
11 files changed, 1303 insertions, 229 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index f9a232e05e0..ac5131a1871 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -270,7 +270,7 @@ writeDataMemberInitializers(IceUtilInternal::Output& C, const DataMemberList& me Slice::Gen::Gen(const string& base, const string& headerExtension, const string& sourceExtension, const vector<string>& extraHeaders, const string& include, const vector<string>& includePaths, const string& dllExport, const string& dir, - bool imp, bool checksum, bool stream, bool ice) : + bool implCpp98, bool implCpp11, bool checksum, bool stream, bool ice) : _base(base), _headerExtension(headerExtension), _implHeaderExtension(headerExtension), @@ -280,7 +280,8 @@ Slice::Gen::Gen(const string& base, const string& headerExtension, const string& _includePaths(includePaths), _dllExport(dllExport), _dir(dir), - _impl(imp), + _implCpp98(implCpp98), + _implCpp11(implCpp11), _checksum(checksum), _stream(stream), _ice(ice) @@ -303,7 +304,7 @@ Slice::Gen::~Gen() H << "\n#endif\n"; C << '\n'; - if(_impl) + if(_implCpp98 || _implCpp11) { implH << "\n\n#endif\n"; implC << '\n'; @@ -356,7 +357,7 @@ Slice::Gen::generate(const UnitPtr& p) _headerExtension = headerExtension; } - if(_impl) + if(_implCpp98 || _implCpp11) { string fileImplH = _base + "I." + _implHeaderExtension; string fileImplC = _base + "I." + _sourceExtension; @@ -624,8 +625,7 @@ Slice::Gen::generate(const UnitPtr& p) Cpp11ValueVisitor valueVisitor(H, C, _dllExport, _stream); p->visit(&valueVisitor, false); - // TODO - /*if(_impl) + if(_implCpp11) { implH << "\n#include <"; if(_include.size()) @@ -633,7 +633,7 @@ Slice::Gen::generate(const UnitPtr& p) implH << _include << '/'; } implH << _base << "." << _headerExtension << ">"; - + implH << nl << "//base"; writeExtraHeaders(implC); implC << "\n#include <"; @@ -643,9 +643,9 @@ Slice::Gen::generate(const UnitPtr& p) } implC << _base << "I." << _implHeaderExtension << ">"; - ImplVisitor implVisitor(implH, implC, _dllExport); + Cpp11ImplVisitor implVisitor(implH, implC, _dllExport); p->visit(&implVisitor, false); - }*/ + } Cpp11CompatibilityVisitor compatibilityVisitor(H, C, _dllExport); p->visit(&compatibilityVisitor, false); @@ -703,7 +703,7 @@ Slice::Gen::generate(const UnitPtr& p) AsyncCallbackTemplateVisitor asyncCallbackTemplateVisitor(H, C, _dllExport); p->visit(&asyncCallbackTemplateVisitor, false); - if(_impl) + if(_implCpp98) { implH << "\n#include <"; if(_include.size()) @@ -4019,58 +4019,8 @@ Slice::Gen::ImplVisitor::ImplVisitor(Output& h, Output& c, const string& dllExpo { } -void -Slice::Gen::ImplVisitor::writeDecl(Output& out, const string& name, const TypePtr& type, const StringList& metaData) -{ - out << nl << typeToString(type, metaData, _useWstring) << ' ' << name; - - BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); - if(builtin) - { - switch(builtin->kind()) - { - case Builtin::KindBool: - { - out << " = false"; - break; - } - case Builtin::KindByte: - case Builtin::KindShort: - case Builtin::KindInt: - case Builtin::KindLong: - { - out << " = 0"; - break; - } - case Builtin::KindFloat: - case Builtin::KindDouble: - { - out << " = 0.0"; - break; - } - case Builtin::KindString: - case Builtin::KindValue: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - break; - } - } - } - - EnumPtr en = EnumPtr::dynamicCast(type); - if(en) - { - EnumeratorList enumerators = en->getEnumerators(); - out << " = " << fixKwd(en->scope()) << fixKwd(enumerators.front()->name()); - } - - out << ';'; -} - -void -Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type, const StringList& metaData) +string +Slice::Gen::ImplVisitor::defaultValue(const TypePtr& type, const StringList& metaData) const { BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); if(builtin) @@ -4079,85 +4029,76 @@ Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type, const Str { case Builtin::KindBool: { - out << nl << "return false;"; - break; + return "false"; } case Builtin::KindByte: case Builtin::KindShort: case Builtin::KindInt: case Builtin::KindLong: { - out << nl << "return 0;"; - break; + return "0"; } case Builtin::KindFloat: case Builtin::KindDouble: { - out << nl << "return 0.0;"; - break; + return "0.0"; } case Builtin::KindString: { - out << nl << "return ::std::string();"; - break; + return "::std::string()"; } case Builtin::KindValue: case Builtin::KindObject: case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { - out << nl << "return 0;"; - break; + return "0"; } } } else { ProxyPtr prx = ProxyPtr::dynamicCast(type); - if(prx) + + if(ProxyPtr::dynamicCast(type) || ClassDeclPtr::dynamicCast(type)) { - out << nl << "return 0;"; + return "0"; } - else + + StructPtr st = StructPtr::dynamicCast(type); + if(st) { - ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type); - if(cl) - { - out << nl << "return 0;"; - } - else - { - StructPtr st = StructPtr::dynamicCast(type); - if(st) - { - out << nl << "return " << fixKwd(st->scoped()) << "();"; - } - else - { - EnumPtr en = EnumPtr::dynamicCast(type); - if(en) - { - EnumeratorList enumerators = en->getEnumerators(); - out << nl << "return " << fixKwd(en->scope()) << fixKwd(enumerators.front()->name()) << ';'; - } - else - { - SequencePtr seq = SequencePtr::dynamicCast(type); - if(seq) - { - out << nl << "return " << typeToString(seq, metaData, _useWstring) << "();"; - } - else - { - DictionaryPtr dict = DictionaryPtr::dynamicCast(type); - assert(dict); - out << nl << "return " << fixKwd(dict->scoped()) << "();"; - } - } - } - } + return fixKwd(st->scoped()) + "()"; + } + + EnumPtr en = EnumPtr::dynamicCast(type); + if(en) + { + EnumeratorList enumerators = en->getEnumerators(); + return fixKwd(en->scope() + enumerators.front()->name()); + } + + SequencePtr seq = SequencePtr::dynamicCast(type); + if(seq) + { + return typeToString(seq, metaData, _useWstring, true) + "()"; + } + + DictionaryPtr dict = DictionaryPtr::dynamicCast(type); + if(dict) + { + return fixKwd(dict->scoped()) + "()"; } } + + assert(false); + return "???"; +} + +void +Slice::Gen::ImplVisitor::writeReturn(Output& out, const TypePtr& type, const StringList& metaData) +{ + out << nl << "return " << defaultValue(type, metaData) << ";"; } bool @@ -4167,32 +4108,8 @@ Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p) { return false; } - _useWstring = setUseWstring(p, _useWstringHist, _useWstring); - - set<string> includes; - ClassList classes = p->classes(); - for(ClassList::const_iterator q = classes.begin(); q != classes.end(); ++q) - { - ClassList bases = (*q)->bases(); - for(ClassList::const_iterator r = bases.begin(); r != bases.end(); ++r) - { - if((*r)->isAbstract()) - { - includes.insert((*r)->name()); - } - } - } - - for(set<string>::const_iterator it = includes.begin(); it != includes.end(); ++it) - { - H << nl << "#include <" << *it << "I.h>"; - } - - string name = fixKwd(p->name()); - - H << sp << nl << "namespace " << name << nl << '{'; - + H << sp << nl << "namespace " << fixKwd(p->name()) << nl << '{'; return true; } @@ -4218,38 +4135,24 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) string name = p->name(); string scope = fixKwd(p->scope()); string cls = scope.substr(2) + name + "I"; - string classScopedAMD = scope + "AMD_" + name; ClassList bases = p->bases(); H << sp; - H << nl << "class " << name << "I : "; - H.useCurrentPosAsIndent(); - H << "public virtual " << fixKwd(name); - for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q) - { - H << ',' << nl << "public virtual " << fixKwd((*q)->scope()); - if((*q)->isAbstract()) - { - H << (*q)->name() << "I"; - } - else - { - H << fixKwd((*q)->name()); - } - } - H.restoreIndent(); + H << nl << "class " << name << "I : public virtual " << fixKwd(name); H << sb; H.dec(); H << nl << "public:"; H.inc(); - OperationList ops = p->operations(); + OperationList ops = p->allOperations(); for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r) { OperationPtr op = (*r); string opName = op->name(); + + string classScopedAMD = scope + "AMD_" + ClassDefPtr::dynamicCast(op->container())->name(); TypePtr ret = op->returnType(); string retS = returnTypeToString(ret, op->returnIsOptional(), op->getMetaData(), _useWstring); @@ -4301,22 +4204,11 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) break; } } - if(ret) - { - writeDecl(C, result, ret, op->getMetaData()); - } - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - if((*q)->isOutParam()) - { - writeDecl(C, fixKwd((*q)->name()), (*q)->type(), (*q)->getMetaData()); - } - } C << nl << opName << "CB->ice_response("; if(ret) { - C << result; + C << defaultValue(ret, op->getMetaData()); } for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { @@ -4326,7 +4218,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) { C << ", "; } - C << fixKwd((*q)->name()); + C << defaultValue((*q)->type(), op->getMetaData()); } } C << ");"; @@ -4344,17 +4236,14 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) { H << ',' << nl; } - StringList metaData = (*q)->getMetaData(); - string typeString; if((*q)->isOutParam()) { - typeString = outputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring); + H << outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring); } else { - typeString = inputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring); + H << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring); } - H << typeString; } if(!p->isLocal()) { @@ -4379,17 +4268,16 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p) { C << ',' << nl; } - StringList metaData = (*q)->getMetaData(); - string typeString; if((*q)->isOutParam()) { - typeString = outputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring); + C << outputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring) << " " + << fixKwd((*q)->name()); } else { - typeString = inputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring); + C << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring) << " /*" + << fixKwd((*q)->name()) << "*/"; } - C << typeString << ' ' << fixKwd((*q)->name()); } if(!p->isLocal()) { @@ -8228,3 +8116,357 @@ Slice::Gen::Cpp11CompatibilityVisitor::visitClassDecl(const ClassDeclPtr& p) } } } + +Slice::Gen::Cpp11ImplVisitor::Cpp11ImplVisitor(Output& h, Output& c, const string& dllExport) : + H(h), C(c), _dllExport(dllExport), _useWstring(false) +{ +} + +string +Slice::Gen::Cpp11ImplVisitor::defaultValue(const TypePtr& type, const StringList& metaData) const +{ + BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); + if(builtin) + { + switch(builtin->kind()) + { + case Builtin::KindBool: + { + return "false"; + } + case Builtin::KindByte: + case Builtin::KindShort: + case Builtin::KindInt: + case Builtin::KindLong: + { + return "0"; + } + case Builtin::KindFloat: + case Builtin::KindDouble: + { + return "0.0"; + } + case Builtin::KindString: + { + return "::std::string()"; + } + case Builtin::KindValue: + case Builtin::KindObject: + case Builtin::KindObjectProxy: + case Builtin::KindLocalObject: + { + return "nullptr"; + } + } + } + else + { + ProxyPtr prx = ProxyPtr::dynamicCast(type); + + if(ProxyPtr::dynamicCast(type) || ClassDeclPtr::dynamicCast(type)) + { + return "nullptr"; + } + + StructPtr st = StructPtr::dynamicCast(type); + if(st) + { + return fixKwd(st->scoped()) + "()"; + } + + EnumPtr en = EnumPtr::dynamicCast(type); + if(en) + { + EnumeratorList enumerators = en->getEnumerators(); + return fixKwd(en->scoped() + "::" + enumerators.front()->name()); + } + + SequencePtr seq = SequencePtr::dynamicCast(type); + if(seq) + { + return typeToString(seq, metaData, _useWstring, true) + "()"; + } + + DictionaryPtr dict = DictionaryPtr::dynamicCast(type); + if(dict) + { + return fixKwd(dict->scoped()) + "()"; + } + } + + assert(false); + return "???"; +} + +void +Slice::Gen::Cpp11ImplVisitor::writeReturn(Output& out, const TypePtr& type, const StringList& metaData) +{ + out << nl << "return " << defaultValue(type, metaData) << ";"; +} + +bool +Slice::Gen::Cpp11ImplVisitor::visitModuleStart(const ModulePtr& p) +{ + if(!p->hasClassDefs()) + { + return false; + } + + _useWstring = setUseWstring(p, _useWstringHist, _useWstring); + + string name = fixKwd(p->name()); + + H << sp << nl << "namespace " << name << nl << '{'; + + return true; +} + +void +Slice::Gen::Cpp11ImplVisitor::visitModuleEnd(const ModulePtr&) +{ + H << sp; + H << nl << '}'; + + _useWstring = resetUseWstring(_useWstringHist); +} + +bool +Slice::Gen::Cpp11ImplVisitor::visitClassDefStart(const ClassDefPtr& p) +{ + if(!p->isAbstract()) + { + return false; + } + + _useWstring = setUseWstring(p, _useWstringHist, _useWstring); + + string name = p->name(); + string scope = fixKwd(p->scope()); + string cls = scope.substr(2) + name + "I"; + ClassList bases = p->bases(); + + H << sp; + H << nl << "class " << name << "I : "; + H.useCurrentPosAsIndent(); + H << "public virtual "; + + if(p->isInterface() || p->isLocal()) + { + H << fixKwd(name); + } + else + { + H << fixKwd(name + "Disp"); + } + H.restoreIndent(); + + H << sb; + H.dec(); + H << nl << "public:"; + H.inc(); + + OperationList ops = p->allOperations(); + + for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r) + { + OperationPtr op = (*r); + string opName = op->name(); + + TypePtr ret = op->returnType(); + string retS = returnTypeToString(ret, op->returnIsOptional(), op->getMetaData(), _useWstring, true); + + ParamDeclList params = op->parameters(); + ParamDeclList outParams; + ParamDeclList inParams; + for(ParamDeclList::const_iterator q = params.begin(); q != params.end(); ++q) + { + if((*q)->isOutParam()) + { + outParams.push_back(*q); + } + else + { + inParams.push_back(*q); + } + } + + if(!p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd"))) + { + string responseParams; + string responseParamsDecl; + + H << sp << nl << "virtual void " << opName << "_async("; + H.useCurrentPosAsIndent(); + + for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q) + { + H << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring, true) + << "," << nl; + } + + if(ret) + { + string typeString = inputTypeToString(ret, op->returnIsOptional(), op->getMetaData(), _useWstring | TypeContextAMD, true); + responseParams = typeString; + responseParamsDecl = typeString + " __ret"; + if(!outParams.empty()) + { + responseParams += ", "; + responseParamsDecl += ", "; + } + } + + for(ParamDeclList::iterator q = outParams.begin(); q != outParams.end(); ++q) + { + if(q != outParams.begin()) + { + responseParams += ", "; + responseParamsDecl += ", "; + } + string paramName = fixKwd(string(paramPrefix) + (*q)->name()); + string typeString = inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring | TypeContextAMD, true); + responseParams += typeString; + responseParamsDecl += typeString + " " + paramName; + } + + bool isConst = (op->mode() == Operation::Nonmutating) || op->hasMetaData("cpp:const"); + + H << "std::function<void (" << responseParams << ")>,"; + H << nl << "std::function<void (std::exception_ptr)>,"; + H << nl << "const Ice::Current&)" << (isConst ? " const" : "") << ';'; + H.restoreIndent(); + + C << sp << nl << "void" << nl << scope << name << "I::" << fixKwd(opName + "_async") << "("; + C.useCurrentPosAsIndent(); + + for(ParamDeclList::const_iterator q = inParams.begin(); q != inParams.end(); ++q) + { + C << inputTypeToString((*q)->type(), (*q)->optional(), (*q)->getMetaData(), _useWstring, true) + << ' ' << fixKwd((*q)->name()) << "," << nl; + } + + C << "std::function<void (" << responseParams << ")> " << opName << "_response,"; + C << nl << "std::function<void (std::exception_ptr)>,"; + C << nl << "const Ice::Current& current)" << (isConst ? " const" : ""); + C.restoreIndent(); + C << sb; + + string result = "r"; + for(ParamDeclList::const_iterator q = params.begin(); q != params.end(); ++q) + { + if((*q)->name() == result) + { + result = "_" + result; + break; + } + } + + C << nl << opName << "_response("; + if(ret) + { + C << defaultValue(ret, op->getMetaData()); + } + for(ParamDeclList::const_iterator q = outParams.begin(); q != outParams.end(); ++q) + { + if(ret || q != outParams.begin()) + { + C << ", "; + } + C << defaultValue((*q)->type(), op->getMetaData()); + } + C << ");"; + + C << eb; + } + else + { + H << sp << nl << "virtual " << retS << ' ' << fixKwd(opName) << '('; + H.useCurrentPosAsIndent(); + ParamDeclList paramList = op->parameters(); + for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) + { + if(q != paramList.begin()) + { + H << ',' << nl; + } + StringList metaData = (*q)->getMetaData(); + string typeString; + if((*q)->isOutParam()) + { + typeString = outputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring, true); + } + else + { + typeString = inputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring, true); + } + H << typeString; + } + if(!p->isLocal()) + { + if(!paramList.empty()) + { + H << ',' << nl; + } + H << "const Ice::Current&"; + } + H.restoreIndent(); + + bool isConst = (op->mode() == Operation::Nonmutating) || op->hasMetaData("cpp:const"); + + H << ")" << (isConst ? " const" : "") << ';'; + + C << sp << nl << retS << nl; + C << scope.substr(2) << name << "I::" << fixKwd(opName) << '('; + C.useCurrentPosAsIndent(); + for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) + { + if(q != paramList.begin()) + { + C << ',' << nl; + } + StringList metaData = (*q)->getMetaData(); + string typeString; + if((*q)->isOutParam()) + { + C << outputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring, true) << " " + << fixKwd((*q)->name()); + } + else + { + C << inputTypeToString((*q)->type(), (*q)->optional(), metaData, _useWstring, true)<< " /*" + << fixKwd((*q)->name()) << "*/"; + } + } + if(!p->isLocal()) + { + if(!paramList.empty()) + { + C << ',' << nl; + } + C << "const Ice::Current& current"; + } + C.restoreIndent(); + C << ')'; + C << (isConst ? " const" : ""); + C << sb; + + for(ParamDeclList::const_iterator q = outParams.begin(); q != outParams.end(); ++q) + { + C << nl << fixKwd((*q)->name()) << " = " << defaultValue((*q)->type(), op->getMetaData()) << ";"; + } + + if(ret) + { + writeReturn(C, ret, op->getMetaData()); + } + + C << eb; + } + } + + H << eb << ';'; + + _useWstring = resetUseWstring(_useWstringHist); + + return true; +} diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h index 1507f43fd77..6b90d3ed391 100644 --- a/cpp/src/slice2cpp/Gen.h +++ b/cpp/src/slice2cpp/Gen.h @@ -31,6 +31,7 @@ public: bool, bool, bool, + bool, bool); ~Gen(); @@ -67,7 +68,8 @@ private: std::vector<std::string> _includePaths; std::string _dllExport; std::string _dir; - bool _impl; + bool _implCpp98; + bool _implCpp11; bool _checksum; bool _stream; bool _ice; @@ -267,10 +269,9 @@ private: std::list<int> _useWstringHist; // - // Generate code to emit a local variable declaration and initialize it - // if necessary. + // Get the default value returned for a type // - void writeDecl(::IceUtilInternal::Output&, const std::string&, const TypePtr&, const StringList&); + std::string defaultValue(const TypePtr&, const StringList&) const; // // Generate code to return a dummy value @@ -587,6 +588,36 @@ private: ::IceUtilInternal::Output& H; std::string _dllExport; }; + + class Cpp11ImplVisitor : private ::IceUtil::noncopyable, public ParserVisitor + { + public: + + Cpp11ImplVisitor(::IceUtilInternal::Output&, ::IceUtilInternal::Output&, const std::string&); + + virtual bool visitModuleStart(const ModulePtr&); + virtual void visitModuleEnd(const ModulePtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); + + private: + + ::IceUtilInternal::Output& H; + ::IceUtilInternal::Output& C; + + std::string _dllExport; + int _useWstring; + std::list<int> _useWstringHist; + + // + // Generate code to return a dummy value + // + void writeReturn(::IceUtilInternal::Output&, const TypePtr&, const StringList&); + + // + // Get the default value returned for a type + // + std::string defaultValue(const TypePtr&, const StringList&) const; + }; private: diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp index c0da52fdaec..013f3dbce16 100644 --- a/cpp/src/slice2cpp/Main.cpp +++ b/cpp/src/slice2cpp/Main.cpp @@ -73,7 +73,8 @@ usage(const char* n) "--include-dir DIR Use DIR as the header include directory in source files.\n" "--output-dir DIR Create files in the directory DIR.\n" "--dll-export SYMBOL Use SYMBOL for DLL exports.\n" - "--impl Generate sample implementations.\n" + "--impl-c++98 Generate sample implementations for C++98 mapping.\n" + "--impl-c++11 Generate sample implementations for C++11 mapping.\n" "--depend Generate Makefile dependencies.\n" "--depend-xml Generate dependencies in XML format.\n" "--depend-file FILE Write dependencies to FILE instead of standard output.\n" @@ -102,7 +103,8 @@ compile(int argc, char* argv[]) opts.addOpt("", "include-dir", IceUtilInternal::Options::NeedArg); opts.addOpt("", "output-dir", IceUtilInternal::Options::NeedArg); opts.addOpt("", "dll-export", IceUtilInternal::Options::NeedArg); - opts.addOpt("", "impl"); + opts.addOpt("", "impl-c++98"); + opts.addOpt("", "impl-c++11"); opts.addOpt("", "depend"); opts.addOpt("", "depend-xml"); opts.addOpt("", "depend-file", IceUtilInternal::Options::NeedArg, ""); @@ -182,7 +184,9 @@ compile(int argc, char* argv[]) string dllExport = opts.optArg("dll-export"); - bool impl = opts.isSet("impl"); + bool implCpp98 = opts.isSet("impl-c++98"); + + bool implCpp11 = opts.isSet("impl-c++11"); bool depend = opts.isSet("depend"); @@ -219,6 +223,16 @@ compile(int argc, char* argv[]) } return EXIT_FAILURE; } + + if(implCpp98 && implCpp11) + { + getErrorStream() << argv[0] << ": error: cannot specify both --impl-c++98 and --impl-c++11" << endl; + if(!validate) + { + usage(argv[0]); + } + return EXIT_FAILURE; + } if(validate) { @@ -326,7 +340,7 @@ compile(int argc, char* argv[]) try { Gen gen(icecpp->getBaseName(), headerExtension, sourceExtension, extraHeaders, include, - includePaths, dllExport, output, impl, checksum, stream, ice); + includePaths, dllExport, output, implCpp98, implCpp11, checksum, stream, ice); gen.generate(u); } catch(const Slice::FileException& ex) diff --git a/cpp/test/Ice/Makefile b/cpp/test/Ice/Makefile index 71e865cb655..b80f75ace0a 100644 --- a/cpp/test/Ice/Makefile +++ b/cpp/test/Ice/Makefile @@ -11,7 +11,6 @@ top_srcdir = ../.. include $(top_srcdir)/config/Make.rules -ifeq ($(CPP11_MAPPING),yes) SUBDIRS = proxy \ operations \ exceptions \ @@ -39,47 +38,6 @@ SUBDIRS = proxy \ udp \ defaultServant \ defaultValue \ - invoke \ - properties \ - plugin \ - admin \ - metrics \ - enums \ - logger \ - networkProxy \ - services -else -SUBDIRS = proxy \ - operations \ - exceptions \ - ami \ - info \ - inheritance \ - facets \ - objects \ - optional \ - faultTolerance \ - location \ - adapterDeactivation \ - slicing \ - gc \ - hash \ - checksum \ - stream \ - dispatcher \ - hold \ - custom \ - binding \ - retry \ - timeout \ - acm \ - servantLocator \ - interceptor \ - stringConverter \ - background \ - udp \ - defaultServant \ - defaultValue \ threadPoolPriority \ invoke \ properties \ @@ -87,10 +45,18 @@ SUBDIRS = proxy \ admin \ metrics \ enums \ - echo \ logger \ networkProxy \ - services + services \ + impl + +ifneq ($(CPP11_MAPPING),yes) +SUBDIRS := $(SUBDIRS) \ + optional \ + gc \ + stream \ + custom \ + echo endif .PHONY: $(EVERYTHING) $(SUBDIRS) diff --git a/cpp/test/Ice/impl/.gitignore b/cpp/test/Ice/impl/.gitignore new file mode 100644 index 00000000000..7cacc722a41 --- /dev/null +++ b/cpp/test/Ice/impl/.gitignore @@ -0,0 +1,9 @@ +// Generated by makegitignore.py + +// IMPORTANT: Do not edit this file -- any edits made here will be lost! +server +serveramd +Test.cpp +TestAMD.cpp +Test.h +TestAMD.h diff --git a/cpp/test/Ice/impl/Makefile b/cpp/test/Ice/impl/Makefile new file mode 100644 index 00000000000..7c412bffcd2 --- /dev/null +++ b/cpp/test/Ice/impl/Makefile @@ -0,0 +1,60 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +top_srcdir = ../../.. + +SERVER = $(call mktestname,server) +SERVERAMD = $(call mktestname,serveramd) + +TARGETS = $(SERVER) $(SERVERAMD) + +SLICE_OBJS = Test.o TestAMD.o + +SOBJS = Test.o \ + TestI.o \ + Server.o \ + +SAMDOBJS = TestAMD.o \ + TestAMDI.o \ + ServerAMD.o + +OBJS = $(SOBJS) \ + $(SAMDOBJS) + +include $(top_srcdir)/config/Make.rules + +CPPFLAGS := -I. -I../../include $(CPPFLAGS) + +ifeq ($(CPP11_MAPPING),yes) +SLICE2CPPFLAGS := --impl-c++11 $(SLICE2CPPFLAGS) +else +SLICE2CPPFLAGS := --impl-c++98 $(SLICE2CPPFLAGS) +endif + +Test.cpp Test.h: Test.ice $(SLICE2CPP) + rm -f $(*F).h $(*F).cpp $(*F)I.h $(*F)I.cpp + $(SLICE2CPP) $(SLICE2CPPFLAGS) $(*F).ice + @touch $(*F).cpp $(*F)I.cpp + +TestAMD.cpp TestAMD.h: TestAMD.ice $(SLICE2CPP) + rm -f $(*F).h $(*F).cpp $(*F)I.h $(*F)I.cpp + $(SLICE2CPP) $(SLICE2CPPFLAGS) $(*F).ice + @touch $(*F).cpp $(*F)I.cpp + +$(SERVER): $(SOBJS) + rm -f $@ + $(call mktest,$@,$(SOBJS),$(TEST_LIBS)) + +$(SERVERAMD): $(SAMDOBJS) + rm -f $@ + $(call mktest,$@,$(SAMDOBJS),$(TEST_LIBS)) + +clean:: + rm -f TestI.cpp TestI.h + rm -f TestAMDI.cpp TestAMDI.h diff --git a/cpp/test/Ice/impl/Makefile.mak b/cpp/test/Ice/impl/Makefile.mak new file mode 100644 index 00000000000..d91de148913 --- /dev/null +++ b/cpp/test/Ice/impl/Makefile.mak @@ -0,0 +1,78 @@ +# ********************************************************************** +# +# Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +# +# This copy of Ice is licensed to you under the terms described in the +# ICE_LICENSE file included in this distribution. +# +# ********************************************************************** + +top_srcdir = ..\..\.. + +!if "$(WINRT)" != "yes" +NAME_PREFIX = +EXT = .exe +OBJDIR = . +!else +NAME_PREFIX = Ice_operations_ +EXT = .dll +OBJDIR = winrt +!endif + +SERVER = $(NAME_PREFIX)server +SERVERAMD = $(NAME_PREFIX)serveramd + +TARGETS = $(SERVER)$(EXT) $(SERVERAMD)$(EXT) + +SLICE_OBJS = $(OBJDIR)\Test.obj $(OBJDIR)\TestAMD.obj + +SOBJS = $(OBJDIR)\Test.obj \ + $(OBJDIR)\TestI.obj \ + $(OBJDIR)\Server.obj + +SAMDOBJS = $(OBJDIR)\TestAMD.obj \ + $(OBJDIR)\TestAMDI.obj \ + $(OBJDIR)\ServerAMD.obj + +OBJS = $(SOBJS) \ + $(SAMDOBJS) + +!include $(top_srcdir)/config/Make.rules.mak + +CPPFLAGS = -I. -I../../include $(CPPFLAGS) -DWIN32_LEAN_AND_MEAN -Zm200 -bigobj /wd4503 +LINKWITH = testcommon$(LIBSUFFIX).lib $(LIBS) + +!if "$(GENERATE_PDB)" == "yes" +SPDBFLAGS = /pdb:$(SERVER).pdb +SAPDBFLAGS = /pdb:$(SERVERAMD).pdb +!endif + +!if "$(CPP11_MAPPING)" == "yes" +SLICE2CPPFLAGS = --impl-c++11 $(SLICE2CPPFLAGS) +!else +SLICE2CPPFLAGS = --impl-c++98 $(SLICE2CPPFLAGS) +!endif + +Test.cpp Test.h: + del /q (*F).h $(*F).cpp (*F)I.h $(*F)I.cpp + "$(SLICE2CPP)" $(SLICE2CPPFLAGS) $< + +TestAMD.cpp TestAMD.h: + del /q (*F).h $(*F).cpp (*F)I.h $(*F)I.cpp + "$(SLICE2CPP)" $(SLICE2CPPFLAGS) $< + +$(SERVER)$(EXT): $(SOBJS) + $(LINK) $(LD_TESTFLAGS) $(SPDBFLAGS) $(SOBJS) $(PREOUT)$@ $(PRELIBS)$(LINKWITH) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest + +$(SERVERAMD)$(EXT): $(SAMDOBJS) + $(LINK) $(LD_TESTFLAGS) $(SAPDBFLAGS) $(SAMDOBJS) $(PREOUT)$@ $(PRELIBS)$(LINKWITH) + @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \ + $(MT) -nologo -manifest $@.manifest -outputresource:$@;#1 && del /q $@.manifest + +clean:: + del /q Test.cpp Test.h + del /q TestI.cpp TestI.h + del /q TestAMD.cpp TestAMD.h + del /q TestAMDI.cpp TestAMDI.h diff --git a/cpp/test/Ice/impl/Server.cpp b/cpp/test/Ice/impl/Server.cpp new file mode 100644 index 00000000000..39e585dd1b7 --- /dev/null +++ b/cpp/test/Ice/impl/Server.cpp @@ -0,0 +1,58 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <TestI.h> + +DEFINE_TEST("server") + +using namespace std; +using namespace Test; + +int +run(int, char**, const Ice::CommunicatorPtr& communicator) +{ + string endpt = getTestEndpoint(communicator, 0); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpt + ":udp"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); + adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), communicator->stringToIdentity("test")); + adapter->activate(); + TEST_READY + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ +#ifdef ICE_STATIC_LIBS + Ice::registerIceSSL(); +#endif + + try + { + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); + // + // Its possible to have batch oneway requests dispatched after + // the adapter is deactivated due to thread scheduling so we + // supress this warning. + // + initData.properties->setProperty("Ice.Warn.Dispatch", "0"); + + Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); + return run(argc, argv, ich.communicator()); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + return EXIT_FAILURE; + } +} diff --git a/cpp/test/Ice/impl/ServerAMD.cpp b/cpp/test/Ice/impl/ServerAMD.cpp new file mode 100644 index 00000000000..48d26283534 --- /dev/null +++ b/cpp/test/Ice/impl/ServerAMD.cpp @@ -0,0 +1,58 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#include <Ice/Ice.h> +#include <TestCommon.h> +#include <TestAMDI.h> + +DEFINE_TEST("serveramd") + +using namespace std; +using namespace Test; + +int +run(int, char**, const Ice::CommunicatorPtr& communicator) +{ + string endpt = getTestEndpoint(communicator, 0); + communicator->getProperties()->setProperty("TestAdapter.Endpoints", endpt + ":udp"); + Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); + adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), communicator->stringToIdentity("test")); + adapter->activate(); + TEST_READY + communicator->waitForShutdown(); + return EXIT_SUCCESS; +} + +int +main(int argc, char* argv[]) +{ +#ifdef ICE_STATIC_LIBS + Ice::registerIceSSL(); +#endif + + try + { + Ice::InitializationData initData; + initData.properties = Ice::createProperties(argc, argv); + // + // Its possible to have batch oneway requests dispatched after + // the adapter is deactivated due to thread scheduling so we + // supress this warning. + // + initData.properties->setProperty("Ice.Warn.Dispatch", "0"); + + Ice::CommunicatorHolder ich = Ice::initialize(argc, argv, initData); + return run(argc, argv, ich.communicator()); + } + catch(const Ice::Exception& ex) + { + cerr << ex << endl; + return EXIT_FAILURE; + } +} diff --git a/cpp/test/Ice/impl/Test.ice b/cpp/test/Ice/impl/Test.ice new file mode 100644 index 00000000000..43ac1db7aaf --- /dev/null +++ b/cpp/test/Ice/impl/Test.ice @@ -0,0 +1,278 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +#include <Ice/Current.ice> + +module Test +{ + +enum MyEnum +{ + enum1, + enum2, + enum3 +}; + +class MyClass; + +struct AnotherStruct +{ + string s; +}; + +struct Structure +{ + MyClass* p; + MyEnum e; + AnotherStruct s; +}; + +sequence<byte> ByteS; +sequence<bool> BoolS; +sequence<short> ShortS; +sequence<int> IntS; +sequence<long> LongS; +sequence<float> FloatS; +sequence<double> DoubleS; +sequence<string> StringS; +sequence<MyEnum> MyEnumS; +sequence<MyClass*> MyClassS; + +sequence<ByteS> ByteSS; +sequence<BoolS> BoolSS; +sequence<ShortS> ShortSS; +sequence<IntS> IntSS; +sequence<LongS> LongSS; +sequence<FloatS> FloatSS; +sequence<DoubleS> DoubleSS; +sequence<StringS> StringSS; +sequence<MyEnumS> MyEnumSS; +sequence<MyClassS> MyClassSS; + +sequence<StringSS> StringSSS; + +struct MyStruct +{ + int i; + int j; +}; + +dictionary<byte, bool> ByteBoolD; +dictionary<short, int> ShortIntD; +dictionary<long, float> LongFloatD; +dictionary<string, string> StringStringD; +dictionary<string, MyEnum> StringMyEnumD; +dictionary<MyEnum, string> MyEnumStringD; +dictionary<MyStruct, MyEnum> MyStructMyEnumD; + +sequence<ByteBoolD> ByteBoolDS; +sequence<ShortIntD> ShortIntDS; +sequence<LongFloatD> LongFloatDS; +sequence<StringStringD> StringStringDS; +sequence<StringMyEnumD> StringMyEnumDS; +sequence<MyEnumStringD> MyEnumStringDS; +sequence<MyStructMyEnumD> MyStructMyEnumDS; + +dictionary<byte, ByteS> ByteByteSD; +dictionary<bool, BoolS> BoolBoolSD; +dictionary<short, ShortS> ShortShortSD; +dictionary<int, IntS> IntIntSD; +dictionary<long, LongS> LongLongSD; +dictionary<string, FloatS> StringFloatSD; +dictionary<string, DoubleS> StringDoubleSD; +dictionary<string, StringS> StringStringSD; +dictionary<MyEnum, MyEnumS> MyEnumMyEnumSD; + +exception SomeException {}; + +class MyClass +{ + void shutdown(); + + void delay(int ms); + + void opVoid(); + + byte opByte(byte p1, byte p2, + out byte p3); + + bool opBool(bool p1, bool p2, + out bool p3); + + long opShortIntLong(short p1, int p2, long p3, + out short p4, out int p5, out long p6); + + double opFloatDouble(float p1, double p2, + out float p3, out double p4); + + string opString(string p1, string p2, + out string p3); + + MyEnum opMyEnum(MyEnum p1, out MyEnum p2); + + MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); + + Structure opStruct(Structure p1, Structure p2, + out Structure p3); + + ByteS opByteS(ByteS p1, ByteS p2, + out ByteS p3); + + BoolS opBoolS(BoolS p1, BoolS p2, + out BoolS p3); + + LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, + out ::Test::ShortS p4, out IntS p5, out LongS p6); + + DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, + out FloatS p3, out DoubleS p4); + + StringS opStringS(StringS p1, StringS p2, + out StringS p3); + + ByteSS opByteSS(ByteSS p1, ByteSS p2, + out ByteSS p3); + + BoolSS opBoolSS(BoolSS p1, BoolSS p2, + out BoolSS p3); + + LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, + out ShortSS p4, out IntSS p5, out LongSS p6); + + + DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, + out FloatSS p3, out DoubleSS p4); + + StringSS opStringSS(StringSS p1, StringSS p2, + out StringSS p3); + + StringSSS opStringSSS(StringSSS p1, StringSSS p2, + out StringSSS p3); + + ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, + out ByteBoolD p3); + + ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, + out ShortIntD p3); + + LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, + out LongFloatD p3); + + StringStringD opStringStringD(StringStringD p1, StringStringD p2, + out StringStringD p3); + + StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, + out StringMyEnumD p3); + + MyEnumStringD opMyEnumStringD(MyEnumStringD p1, MyEnumStringD p2, + out MyEnumStringD p3); + + MyStructMyEnumD opMyStructMyEnumD(MyStructMyEnumD p1, MyStructMyEnumD p2, + out MyStructMyEnumD p3); + + ByteBoolDS opByteBoolDS(ByteBoolDS p1, ByteBoolDS p2, + out ByteBoolDS p3); + + ShortIntDS opShortIntDS(ShortIntDS p1, ShortIntDS p2, + out ShortIntDS p3); + + LongFloatDS opLongFloatDS(LongFloatDS p1, LongFloatDS p2, + out LongFloatDS p3); + + StringStringDS opStringStringDS(StringStringDS p1, StringStringDS p2, + out StringStringDS p3); + + StringMyEnumDS opStringMyEnumDS(StringMyEnumDS p1, StringMyEnumDS p2, + out StringMyEnumDS p3); + + MyEnumStringDS opMyEnumStringDS(MyEnumStringDS p1, MyEnumStringDS p2, + out MyEnumStringDS p3); + + MyStructMyEnumDS opMyStructMyEnumDS(MyStructMyEnumDS p1, MyStructMyEnumDS p2, + out MyStructMyEnumDS p3); + + ByteByteSD opByteByteSD(ByteByteSD p1, ByteByteSD p2, + out ByteByteSD p3); + + BoolBoolSD opBoolBoolSD(BoolBoolSD p1, BoolBoolSD p2, + out BoolBoolSD p3); + + ShortShortSD opShortShortSD(ShortShortSD p1, ShortShortSD p2, + out ShortShortSD p3); + + IntIntSD opIntIntSD(IntIntSD p1, IntIntSD p2, + out IntIntSD p3); + + LongLongSD opLongLongSD(LongLongSD p1, LongLongSD p2, + out LongLongSD p3); + + StringFloatSD opStringFloatSD(StringFloatSD p1, StringFloatSD p2, + out StringFloatSD p3); + + StringDoubleSD opStringDoubleSD(StringDoubleSD p1, StringDoubleSD p2, + out StringDoubleSD p3); + + StringStringSD opStringStringSD(StringStringSD p1, StringStringSD p2, + out StringStringSD p3); + + MyEnumMyEnumSD opMyEnumMyEnumSD(MyEnumMyEnumSD p1, MyEnumMyEnumSD p2, + out MyEnumMyEnumSD p3); + + IntS opIntS(IntS s); + + void opByteSOneway(ByteS s); + + int opByteSOnewayCallCount(); + + Ice::Context opContext(); + + void opDoubleMarshaling(double p1, DoubleS p2); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); + + byte opByte1(byte opByte1); + short opShort1(short opShort1); + int opInt1(int opInt1); + long opLong1(long opLong1); + float opFloat1(float opFloat1); + double opDouble1(double opDouble1); + string opString1(string opString1); + StringS opStringS1(StringS opStringS1); + ByteBoolD opByteBoolD1(ByteBoolD opByteBoolD1); + StringS opStringS2(StringS stringS); + ByteBoolD opByteBoolD2(ByteBoolD byteBoolD); +}; + +struct MyStruct1 +{ + string tesT; // Same name as the enclosing module + MyClass myClass; // Same name as an already defined class + string myStruct1; // Same name as the enclosing struct +}; + +class MyClass1 +{ + string tesT; // Same name as the enclosing module + MyClass myClass; // Same name as an already defined class + string myClass1; // Same name as the enclosing class +}; + +class MyDerivedClass extends MyClass +{ + void opDerived(); + MyClass1 opMyClass1(MyClass1 c); + MyStruct1 opMyStruct1(MyStruct1 c); +}; + +}; + diff --git a/cpp/test/Ice/impl/TestAMD.ice b/cpp/test/Ice/impl/TestAMD.ice new file mode 100644 index 00000000000..bd1e2bab568 --- /dev/null +++ b/cpp/test/Ice/impl/TestAMD.ice @@ -0,0 +1,280 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +#include <Ice/Current.ice> + +module Test +{ + +enum MyEnum +{ + enum1, + enum2, + enum3 +}; + +class MyClass; + +struct AnotherStruct +{ + string s; +}; + +struct Structure +{ + MyClass* p; + MyEnum e; + AnotherStruct s; +}; + +sequence<byte> ByteS; +sequence<bool> BoolS; +sequence<short> ShortS; +sequence<int> IntS; +sequence<long> LongS; +sequence<float> FloatS; +sequence<double> DoubleS; +sequence<string> StringS; +sequence<MyEnum> MyEnumS; +sequence<MyClass*> MyClassS; + +sequence<ByteS> ByteSS; +sequence<BoolS> BoolSS; +sequence<ShortS> ShortSS; +sequence<IntS> IntSS; +sequence<LongS> LongSS; +sequence<FloatS> FloatSS; +sequence<DoubleS> DoubleSS; +sequence<StringS> StringSS; +sequence<MyEnumS> MyEnumSS; +sequence<MyClassS> MyClassSS; + +sequence<StringSS> StringSSS; + +struct MyStruct +{ + int i; + int j; +}; + +dictionary<byte, bool> ByteBoolD; +dictionary<short, int> ShortIntD; +dictionary<long, float> LongFloatD; +dictionary<string, string> StringStringD; +dictionary<string, MyEnum> StringMyEnumD; +dictionary<MyEnum, string> MyEnumStringD; +dictionary<MyStruct, MyEnum> MyStructMyEnumD; + +sequence<ByteBoolD> ByteBoolDS; +sequence<ShortIntD> ShortIntDS; +sequence<LongFloatD> LongFloatDS; +sequence<StringStringD> StringStringDS; +sequence<StringMyEnumD> StringMyEnumDS; +sequence<MyEnumStringD> MyEnumStringDS; +sequence<MyStructMyEnumD> MyStructMyEnumDS; + +dictionary<byte, ByteS> ByteByteSD; +dictionary<bool, BoolS> BoolBoolSD; +dictionary<short, ShortS> ShortShortSD; +dictionary<int, IntS> IntIntSD; +dictionary<long, LongS> LongLongSD; +dictionary<string, FloatS> StringFloatSD; +dictionary<string, DoubleS> StringDoubleSD; +dictionary<string, StringS> StringStringSD; +dictionary<MyEnum, MyEnumS> MyEnumMyEnumSD; + +["amd"] class MyClass +{ + void shutdown(); + + void delay(int ms); + + void opVoid(); + + byte opByte(byte p1, byte p2, + out byte p3); + + bool opBool(bool p1, bool p2, + out bool p3); + + long opShortIntLong(short p1, int p2, long p3, + out short p4, out int p5, out long p6); + + double opFloatDouble(float p1, double p2, + out float p3, out double p4); + + string opString(string p1, string p2, + out string p3); + + MyEnum opMyEnum(MyEnum p1, out MyEnum p2); + + MyClass* opMyClass(MyClass* p1, out MyClass* p2, out MyClass* p3); + + Structure opStruct(Structure p1, Structure p2, + out Structure p3); + + ByteS opByteS(ByteS p1, ByteS p2, + out ByteS p3); + + BoolS opBoolS(BoolS p1, BoolS p2, + out BoolS p3); + + LongS opShortIntLongS(Test::ShortS p1, IntS p2, LongS p3, + out ::Test::ShortS p4, out IntS p5, out LongS p6); + + DoubleS opFloatDoubleS(FloatS p1, DoubleS p2, + out FloatS p3, out DoubleS p4); + + StringS opStringS(StringS p1, StringS p2, + out StringS p3); + + ByteSS opByteSS(ByteSS p1, ByteSS p2, + out ByteSS p3); + + BoolSS opBoolSS(BoolSS p1, BoolSS p2, + out BoolSS p3); + + LongSS opShortIntLongSS(ShortSS p1, IntSS p2, LongSS p3, + out ShortSS p4, out IntSS p5, out LongSS p6); + + + DoubleSS opFloatDoubleSS(FloatSS p1, DoubleSS p2, + out FloatSS p3, out DoubleSS p4); + + StringSS opStringSS(StringSS p1, StringSS p2, + out StringSS p3); + + StringSSS opStringSSS(StringSSS p1, StringSSS p2, + out StringSSS p3); + + ByteBoolD opByteBoolD(ByteBoolD p1, ByteBoolD p2, + out ByteBoolD p3); + + ShortIntD opShortIntD(ShortIntD p1, ShortIntD p2, + out ShortIntD p3); + + LongFloatD opLongFloatD(LongFloatD p1, LongFloatD p2, + out LongFloatD p3); + + StringStringD opStringStringD(StringStringD p1, StringStringD p2, + out StringStringD p3); + + StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2, + out StringMyEnumD p3); + + MyEnumStringD opMyEnumStringD(MyEnumStringD p1, MyEnumStringD p2, + out MyEnumStringD p3); + + MyStructMyEnumD opMyStructMyEnumD(MyStructMyEnumD p1, MyStructMyEnumD p2, + out MyStructMyEnumD p3); + + ByteBoolDS opByteBoolDS(ByteBoolDS p1, ByteBoolDS p2, + out ByteBoolDS p3); + + ShortIntDS opShortIntDS(ShortIntDS p1, ShortIntDS p2, + out ShortIntDS p3); + + LongFloatDS opLongFloatDS(LongFloatDS p1, LongFloatDS p2, + out LongFloatDS p3); + + StringStringDS opStringStringDS(StringStringDS p1, StringStringDS p2, + out StringStringDS p3); + + StringMyEnumDS opStringMyEnumDS(StringMyEnumDS p1, StringMyEnumDS p2, + out StringMyEnumDS p3); + + MyEnumStringDS opMyEnumStringDS(MyEnumStringDS p1, MyEnumStringDS p2, + out MyEnumStringDS p3); + + MyStructMyEnumDS opMyStructMyEnumDS(MyStructMyEnumDS p1, MyStructMyEnumDS p2, + out MyStructMyEnumDS p3); + + ByteByteSD opByteByteSD(ByteByteSD p1, ByteByteSD p2, + out ByteByteSD p3); + + BoolBoolSD opBoolBoolSD(BoolBoolSD p1, BoolBoolSD p2, + out BoolBoolSD p3); + + ShortShortSD opShortShortSD(ShortShortSD p1, ShortShortSD p2, + out ShortShortSD p3); + + IntIntSD opIntIntSD(IntIntSD p1, IntIntSD p2, + out IntIntSD p3); + + LongLongSD opLongLongSD(LongLongSD p1, LongLongSD p2, + out LongLongSD p3); + + StringFloatSD opStringFloatSD(StringFloatSD p1, StringFloatSD p2, + out StringFloatSD p3); + + StringDoubleSD opStringDoubleSD(StringDoubleSD p1, StringDoubleSD p2, + out StringDoubleSD p3); + + StringStringSD opStringStringSD(StringStringSD p1, StringStringSD p2, + out StringStringSD p3); + + MyEnumMyEnumSD opMyEnumMyEnumSD(MyEnumMyEnumSD p1, MyEnumMyEnumSD p2, + out MyEnumMyEnumSD p3); + + IntS opIntS(IntS s); + + void opByteSOneway(ByteS s); + int opByteSOnewayCallCount(); + + Ice::Context opContext(); + + void opDoubleMarshaling(double p1, DoubleS p2); + + idempotent void opIdempotent(); + + ["nonmutating"] idempotent void opNonmutating(); + + // + // Test operation with a parameter that has the same name + // + byte opByte1(byte opByte1); + short opShort1(short opShort1); + int opInt1(int opInt1); + long opLong1(long opLong1); + float opFloat1(float opFloat1); + double opDouble1(double opDouble1); + string opString1(string opString1); + StringS opStringS1(StringS opStringS1); + ByteBoolD opByteBoolD1(ByteBoolD opByteBoolD1); + + StringS opStringS2(StringS stringS); + ByteBoolD opByteBoolD2(ByteBoolD byteBoolD); +}; + +struct MyStruct1 +{ + string tesT; // Same name as the enclosing module + MyClass myClass; // Same name as an already defined class + string myStruct1; // Same name as the enclosing struct +}; + +class MyClass1 +{ + string tesT; // Same name as the enclosing module + MyClass myClass; // Same name as an already defined class + string myClass1; // Same name as the enclosing class +}; + + +["amd"] class MyDerivedClass extends MyClass +{ + void opDerived(); + MyClass1 opMyClass1(MyClass1 c); + MyStruct1 opMyStruct1(MyStruct1 c); +}; + +}; + |