diff options
author | Joe George <joe@zeroc.com> | 2016-06-08 15:30:30 -0400 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2016-06-08 15:30:30 -0400 |
commit | e5a8741b6af4bff17d3db4a3f37c26c4f21194c4 (patch) | |
tree | dfeb2fb83d200b8a411cd65b7de3db928a418ce4 /cpp | |
parent | Replaced some ScopeArrays by vector or wstring (diff) | |
download | ice-e5a8741b6af4bff17d3db4a3f37c26c4f21194c4.tar.bz2 ice-e5a8741b6af4bff17d3db4a3f37c26c4f21194c4.tar.xz ice-e5a8741b6af4bff17d3db4a3f37c26c4f21194c4.zip |
ICE-6982 and ICE-6946
- Refactord C++ class/exception stream generated code
- Changed return type of Obejct::ice_id() to std::string for C++11
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/include/Ice/Exception.h | 10 | ||||
-rw-r--r-- | cpp/include/Ice/ExceptionHelpers.h | 83 | ||||
-rw-r--r-- | cpp/include/Ice/InterfaceByValue.h | 30 | ||||
-rw-r--r-- | cpp/include/Ice/Object.h | 6 | ||||
-rw-r--r-- | cpp/include/Ice/SlicedData.h | 13 | ||||
-rw-r--r-- | cpp/include/Ice/Value.h | 26 | ||||
-rw-r--r-- | cpp/src/Ice/Object.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Ice/Value.cpp | 6 | ||||
-rw-r--r-- | cpp/src/IceUtil/UtilException.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 49 | ||||
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.h | 2 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 19 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.h | 1 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 261 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.h | 3 | ||||
-rw-r--r-- | cpp/test/Ice/objects/Test.ice | 2 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMDI.cpp | 16 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestAMDI.h | 24 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.cpp | 6 | ||||
-rw-r--r-- | cpp/test/Ice/operations/TestI.h | 18 | ||||
-rw-r--r-- | cpp/test/Ice/stream/Client.cpp | 28 |
21 files changed, 375 insertions, 238 deletions
diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h index 5a15e49d7af..e5810ca16d0 100644 --- a/cpp/include/Ice/Exception.h +++ b/cpp/include/Ice/Exception.h @@ -47,6 +47,7 @@ public: virtual ~LocalException() ICE_NOEXCEPT; virtual std::string ice_id() const = 0; + static const std::string& ice_staticId(); #ifndef ICE_CPP11_MAPPING virtual LocalException* ice_clone() const = 0; #endif @@ -58,6 +59,7 @@ class ICE_API UserException : public IceUtil::Exception public: virtual std::string ice_id() const = 0; + static const std::string& ice_staticId(); #ifndef ICE_CPP11_MAPPING virtual UserException* ice_clone() const = 0; #endif @@ -70,12 +72,10 @@ public: protected: - virtual void __writeImpl(::Ice::OutputStream*) const = 0; - virtual void __readImpl(::Ice::InputStream*) = 0; + virtual void __writeImpl(::Ice::OutputStream*) const {}; + virtual void __readImpl(::Ice::InputStream*) {}; }; -typedef ::IceInternal::Handle<UserException> UserExceptionPtr; - class ICE_API SystemException : public IceUtil::Exception { public: @@ -89,8 +89,6 @@ public: virtual void ice_throw() const = 0; }; -typedef ::IceInternal::Handle<SystemException> SystemExceptionPtr; - #if defined(__SUNPRO_CC) // // COMPILERFIX: With Sun CC the presence of the overloaded operator diff --git a/cpp/include/Ice/ExceptionHelpers.h b/cpp/include/Ice/ExceptionHelpers.h new file mode 100644 index 00000000000..a990628d2e5 --- /dev/null +++ b/cpp/include/Ice/ExceptionHelpers.h @@ -0,0 +1,83 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2016 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. +// +// ********************************************************************** + +#ifndef ICE_EXCEPTION_HELPERS_H +#define ICE_EXCEPTION_HELPERS_H + +#ifdef ICE_CPP11_MAPPING // C++11 mapping + +#include <Ice/InputStream.h> +#include <Ice/OutputStream.h> + +namespace Ice +{ + +class LocalException; + +template<typename T, typename Base> class LocalExceptionHelper : public Base +{ +public: + + using Base::Base; + + LocalExceptionHelper() = default; + + virtual std::string ice_id() const override + { + return T::ice_staticId(); + } + + virtual void ice_throw() const override + { + throw static_cast<const T&>(*this); + } +}; + +template<typename T, typename Base> class UserExceptionHelper : public Base +{ +public: + + using Base::Base; + + UserExceptionHelper() = default; + + virtual std::string ice_id() const override + { + return T::ice_staticId(); + } + + virtual void ice_throw() const override + { + throw static_cast<const T&>(*this); + } + +protected: + + virtual void __writeImpl(Ice::OutputStream* os) const override + { + os->startSlice(T::ice_staticId(), -1, std::is_same<Base, Ice::LocalException>::value ? true : false); + Ice::StreamWriter<T, Ice::OutputStream>::write(os, static_cast<const T&>(*this)); + os->endSlice(); + Base::__writeImpl(os); + } + + virtual void __readImpl(Ice::InputStream* is) override + { + is->startSlice(); + Ice::StreamReader<T, ::Ice::InputStream>::read(is, static_cast<T&>(*this)); + is->endSlice(); + Base::__readImpl(is); + } +}; + +} + +#endif // C++11 mapping end + +#endif diff --git a/cpp/include/Ice/InterfaceByValue.h b/cpp/include/Ice/InterfaceByValue.h index 985e022d4dd..c0b3c437463 100644 --- a/cpp/include/Ice/InterfaceByValue.h +++ b/cpp/include/Ice/InterfaceByValue.h @@ -23,22 +23,7 @@ template<typename T> class InterfaceByValue : public Ice::ValueHelper<Ice::InterfaceByValue<T>, Ice::Value> { public: - - virtual void - __writeImpl(::Ice::OutputStream* __os) const - { - __os->startSlice(T::ice_staticId(), -1, true); - __os->endSlice(); - } - - virtual void - __readImpl(::Ice::InputStream* __is) - { - __is->startSlice(); - __is->endSlice(); - } - - virtual const std::string& ice_id() const + virtual std::string ice_id() const { return T::ice_staticId(); } @@ -49,7 +34,20 @@ public: } }; +template<typename S, typename T> +struct StreamWriter<Ice::InterfaceByValue<T>, S> +{ + static void write(S* __os, const Ice::InterfaceByValue<T>& v) { } +}; + +template<typename S, typename T> +struct StreamReader<Ice::InterfaceByValue<T>, S> +{ + static void read(S* __is, Ice::InterfaceByValue<T>& v) { } +}; + } + #endif #endif diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h index 235c2e6349d..150b8be12ff 100644 --- a/cpp/include/Ice/Object.h +++ b/cpp/include/Ice/Object.h @@ -86,7 +86,7 @@ public: virtual std::vector< std::string> ice_ids(const Current& = Ice::noExplicitCurrent) const; DispatchStatus ___ice_ids(IceInternal::Incoming&, const Current&); - virtual const std::string& ice_id(const Current& = Ice::noExplicitCurrent) const; + virtual std::string ice_id(const Current& = Ice::noExplicitCurrent) const; DispatchStatus ___ice_id(IceInternal::Incoming&, const Current&); static const std::string& ice_staticId(); @@ -183,7 +183,7 @@ class ICE_API BlobjectAsync : public virtual Object public: #ifdef ICE_CPP11_MAPPING - virtual void ice_invoke_async(std::vector<Byte>, + virtual void ice_invoke_async(std::vector<Byte>, std::function<void (bool, std::vector<Byte>)>, std::function<void (std::exception_ptr)>, const Current&) = 0; @@ -198,7 +198,7 @@ class ICE_API BlobjectArrayAsync : public virtual Object public: #ifdef ICE_CPP11_MAPPING - virtual void ice_invoke_async(std::pair<const Byte*, const Byte*>, + virtual void ice_invoke_async(std::pair<const Byte*, const Byte*>, std::function<void (bool, std::pair<const Byte*, const Byte*>)>, std::function<void (std::exception_ptr)>, const Current&) = 0; diff --git a/cpp/include/Ice/SlicedData.h b/cpp/include/Ice/SlicedData.h index ffe9cc46b3b..3f6528cb207 100644 --- a/cpp/include/Ice/SlicedData.h +++ b/cpp/include/Ice/SlicedData.h @@ -108,6 +108,19 @@ private: SlicedDataPtr _slicedData; }; +#if defined(ICE_CPP11_MAPPING) +template<typename S> +struct StreamWriter<UnknownSlicedValue, S> +{ + static void write(S* __os, const UnknownSlicedValue& v) { } +}; +template<typename S> +struct StreamReader<UnknownSlicedValue, S> +{ + static void read(S* __is, UnknownSlicedValue& v) { } +}; +#endif + } #endif diff --git a/cpp/include/Ice/Value.h b/cpp/include/Ice/Value.h index b565ef173f5..806571b7c40 100644 --- a/cpp/include/Ice/Value.h +++ b/cpp/include/Ice/Value.h @@ -14,12 +14,12 @@ #include <Ice/ValueF.h> +#include <Ice/OutputStream.h> +#include <Ice/InputStream.h> + namespace Ice { -class OutputStream; -class InputStream; - class ICE_API Value { public: @@ -32,7 +32,7 @@ public: virtual void __write(Ice::OutputStream*) const; virtual void __read(Ice::InputStream*); - virtual const std::string& ice_id() const; + virtual std::string ice_id() const; static const std::string& ice_staticId(); std::shared_ptr<Value> ice_clone() const; @@ -58,7 +58,7 @@ public: return std::static_pointer_cast<T>(cloneImpl()); } - virtual const std::string& ice_id() const override + virtual std::string ice_id() const override { return T::ice_staticId(); } @@ -69,6 +69,22 @@ protected: { return std::make_shared<T>(static_cast<const T&>(*this)); } + + virtual void __writeImpl(Ice::OutputStream* os) const override + { + os->startSlice(T::ice_staticId(), -1, std::is_same<Base, Ice::Value>::value ? true : false); + Ice::StreamWriter<T, Ice::OutputStream>::write(os, static_cast<const T&>(*this)); + os->endSlice(); + Base::__writeImpl(os); + } + + virtual void __readImpl(Ice::InputStream* is) override + { + is->startSlice(); + Ice::StreamReader<T, ::Ice::InputStream>::read(is, static_cast<T&>(*this)); + is->endSlice(); + Base::__readImpl(is); + } }; } diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 7b049322512..b4bd4597fbe 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -78,7 +78,11 @@ Ice::Object::ice_ids(const Current&) const return vector<string>(&__Ice__Object_ids[0], &__Ice__Object_ids[1]); } +#ifdef ICE_CPP11_MAPPING +string +#else const string& +#endif Ice::Object::ice_id(const Current&) const { return __Ice__Object_ids[0]; @@ -388,7 +392,7 @@ Ice::BlobjectAsync::__dispatch(Incoming& in, const Current& current) auto async = IncomingAsync::create(in); try { - ice_invoke_async(vector<Byte>(inEncaps, inEncaps + sz), + ice_invoke_async(vector<Byte>(inEncaps, inEncaps + sz), [async](bool ok, const vector<Byte>& outEncaps) { if(async->__validateResponse(ok)) @@ -470,7 +474,7 @@ Ice::BlobjectArrayAsync::__dispatch(Incoming& in, const Current& current) auto async = IncomingAsync::create(in); try { - ice_invoke_async(inEncaps, + ice_invoke_async(inEncaps, [async](bool ok, const pair<const Byte*, const Byte*>& outEncaps) { if(async->__validateResponse(ok)) diff --git a/cpp/src/Ice/Value.cpp b/cpp/src/Ice/Value.cpp index a489c5500be..f5a7f6b1bbf 100644 --- a/cpp/src/Ice/Value.cpp +++ b/cpp/src/Ice/Value.cpp @@ -54,14 +54,14 @@ const string __Ice__Object_ids[] = } -const string& -Ice::Value::ice_staticId() +string +Ice::Value::ice_id() const { return __Ice__Object_ids[0]; } const string& -Ice::Value::ice_id() const +Ice::Value::ice_staticId() { return __Ice__Object_ids[0]; } diff --git a/cpp/src/IceUtil/UtilException.cpp b/cpp/src/IceUtil/UtilException.cpp index 96bcc813958..7a9cfb9d776 100644 --- a/cpp/src/IceUtil/UtilException.cpp +++ b/cpp/src/IceUtil/UtilException.cpp @@ -23,7 +23,7 @@ // // For UINTPTR_MAX on Ubuntu Precise // -#ifndef __STDC_LIMIT_MACROS +#ifndef __STDC_LIMIT_MACROS # define __STDC_LIMIT_MACROS #endif diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 8197c7612c8..ce2b2690324 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -1254,6 +1254,55 @@ Slice::writeEndCode(Output& out, const ParamDeclList& params, const OperationPtr } } +void +Slice::writeMarshalUnmarshalDataMemberInHolder(IceUtilInternal::Output& C, + const string& holder, + const DataMemberPtr& p, + bool marshal) +{ + writeMarshalUnmarshalCode(C, p->type(), p->optional(), p->tag(), holder + fixKwd(p->name()), marshal, + p->getMetaData()); +} + +void +Slice::writeStreamHelpers(Output& out, const ContainedPtr& c, DataMemberList dataMembers, bool checkClassMetaData) +{ + string scoped = c->scoped(); + bool classMetaData = false; + + if(checkClassMetaData) + { + classMetaData = findMetaData(c->getMetaData(), false) == "%class"; + } + + string fullName = classMetaData ? fixKwd(scoped + "Ptr") : fixKwd(scoped); + string holder = classMetaData ? "v->" : "v."; + + out << nl << "template<typename S>"; + out << nl << "struct StreamWriter< " << fullName << ", S>"; + out << sb; + out << nl << "static void write(S* __os, const " << fullName << "& v)"; + out << sb; + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + writeMarshalUnmarshalDataMemberInHolder(out, holder, *q, true); + } + out << eb; + out << eb << ";" << nl; + + out << nl << "template<typename S>"; + out << nl << "struct StreamReader< " << fullName << ", S>"; + out << sb; + out << nl << "static void read(S* __is, " << fullName << "& v)"; + out << sb; + for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + writeMarshalUnmarshalDataMemberInHolder(out, holder, *q, false); + } + out << eb; + out << eb << ";" << nl; +} + bool Slice::findMetaData(const string& prefix, const ClassDeclPtr& cl, string& value) { diff --git a/cpp/src/Slice/CPlusPlusUtil.h b/cpp/src/Slice/CPlusPlusUtil.h index 5a3ad0f4b14..60eaf710c71 100644 --- a/cpp/src/Slice/CPlusPlusUtil.h +++ b/cpp/src/Slice/CPlusPlusUtil.h @@ -57,6 +57,8 @@ void writeAllocateCode(::IceUtilInternal::Output&, const ParamDeclList&, const O std::string getEndArg(const TypePtr&, const StringList&, const std::string&); void writeEndCode(::IceUtilInternal::Output&, const ParamDeclList&, const OperationPtr&, bool = false); +void writeMarshalUnmarshalDataMemberInHolder(IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, bool); +void writeStreamHelpers(::IceUtilInternal::Output&, const ContainedPtr&, DataMemberList, bool = false); bool findMetaData(const std::string&, const ClassDeclPtr&, std::string&); bool findMetaData(const std::string&, const StringList&, std::string&); diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 68728049a89..8dce5096a56 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1649,7 +1649,26 @@ Slice::Container::hasNonLocalExceptions() const return false; } +bool +Slice::Container::hasExceptions() const +{ + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ExceptionPtr q = ExceptionPtr::dynamicCast(*p); + if(q) + { + return true; + } + ContainerPtr container = ContainerPtr::dynamicCast(*p); + if(container && container->hasExceptions()) + { + return true; + } + } + + return false; +} bool Slice::Container::hasClassDecls() const diff --git a/cpp/src/Slice/Parser.h b/cpp/src/Slice/Parser.h index a142ec921d0..ece0c696e02 100644 --- a/cpp/src/Slice/Parser.h +++ b/cpp/src/Slice/Parser.h @@ -448,6 +448,7 @@ public: bool hasLocalClassDefsWithAsync() const; bool hasNonLocalSequences() const; bool hasNonLocalExceptions() const; + bool hasExceptions() const; bool hasDictionaries() const; bool hasOnlyDictionaries(DictionaryList&) const; bool hasClassDecls() const; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 0f603adfe61..43f570889fd 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -427,37 +427,6 @@ writeConstantValue(IceUtilInternal::Output& out, const TypePtr& type, const Synt } void -writeMarshalUnmarshalDataMember(IceUtilInternal::Output& C, const DataMemberPtr& p, bool marshal) -{ - writeMarshalUnmarshalCode(C, p->type(), p->optional(), p->tag(), fixKwd(p->name()), marshal, p->getMetaData()); -} - -void -writeMarshalUnmarshalDataMemberInHolder(IceUtilInternal::Output& C, const string& holder, const DataMemberPtr& p, bool marshal) -{ - writeMarshalUnmarshalCode(C, p->type(), p->optional(), p->tag(), holder + fixKwd(p->name()), marshal, p->getMetaData()); -} - -void -writeMarshalUnmarshalDataMembers(IceUtilInternal::Output& C, - const DataMemberList& dataMembers, - const DataMemberList& optionalDataMembers, - bool marshal) -{ - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - if(!(*q)->optional()) - { - writeMarshalUnmarshalDataMember(C, *q, marshal); - } - } - for(DataMemberList::const_iterator q = optionalDataMembers.begin(); q != optionalDataMembers.end(); ++q) - { - writeMarshalUnmarshalDataMember(C, *q, marshal); - } -} - -void writeDataMemberInitializers(IceUtilInternal::Output& C, const DataMemberList& members, int useWstring, bool cpp11 = false) { bool first = true; @@ -729,6 +698,11 @@ Slice::Gen::generate(const UnitPtr& p) H << "\n#include <IceUtil/ScopedArray.h>"; H << "\n#include <IceUtil/Optional.h>"; + if(p->hasExceptions()) + { + H << "\n#include <Ice/ExceptionHelpers.h>"; + } + if(p->usesNonLocals()) { C << "\n#include <Ice/InputStream.h>"; @@ -812,9 +786,6 @@ Slice::Gen::generate(const UnitPtr& p) Cpp11TypesVisitor typesVisitor(H, C, _dllExport); p->visit(&typesVisitor, false); - Cpp11StreamVisitor streamVisitor(H, C, _dllExport); - p->visit(&streamVisitor, false); - Cpp11ProxyVisitor proxyVisitor(H, C, _dllExport); p->visit(&proxyVisitor, false); @@ -827,6 +798,9 @@ Slice::Gen::generate(const UnitPtr& p) Cpp11ValueVisitor valueVisitor(H, C, _dllExport); p->visit(&valueVisitor, false); + Cpp11StreamVisitor streamVisitor(H, C, _dllExport); + p->visit(&streamVisitor, false); + if(_implCpp11) { implH << "\n#include <"; @@ -873,9 +847,6 @@ Slice::Gen::generate(const UnitPtr& p) TypesVisitor typesVisitor(H, C, _dllExport); p->visit(&typesVisitor, false); - StreamVisitor streamVisitor(H, C, _dllExport); - p->visit(&streamVisitor, false); - AsyncVisitor asyncVisitor(H, C, _dllExport); p->visit(&asyncVisitor, false); @@ -897,6 +868,9 @@ Slice::Gen::generate(const UnitPtr& p) ObjectVisitor objectVisitor(H, C, _dllExport); p->visit(&objectVisitor, false); + StreamVisitor streamVisitor(H, C, _dllExport); + p->visit(&streamVisitor, false); + // // We need to delay generating the template after the proxy // definition, because completed calls the begin_ method in the @@ -1271,8 +1245,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) H << nl << "virtual void __readImpl(::Ice::InputStream*);"; string baseName = base ? fixKwd(base->scoped()) : string("::Ice::UserException"); - //H << nl << "using " << baseName << "::__writeImpl;"; - //H << nl << "using " << baseName << "::__readImpl;"; if(preserved && !basePreserved) { @@ -1297,7 +1269,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << sp << nl << "void" << nl << scoped.substr(2) << "::__writeImpl(::Ice::OutputStream* __os) const"; C << sb; C << nl << "__os->startSlice(\"" << p->scoped() << "\", -1, " << (!base ? "true" : "false") << ");"; - writeMarshalUnmarshalDataMembers(C, p->dataMembers(), p->orderedOptionalDataMembers(), true); + C << nl << "Ice::StreamWriter<" << scoped.substr(2) << ", ::Ice::OutputStream>::write(__os, *this);"; + C << nl << "__os->endSlice();"; if(base) { @@ -1308,7 +1281,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << sp << nl << "void" << nl << scoped.substr(2) << "::__readImpl(::Ice::InputStream* __is)"; C << sb; C << nl << "__is->startSlice();"; - writeMarshalUnmarshalDataMembers(C, p->dataMembers(), p->orderedOptionalDataMembers(), false); + C << nl << "Ice::StreamReader<" << scoped.substr(2) << ", ::Ice::InputStream>::read(__is, *this);"; C << nl << "__is->endSlice();"; if(base) { @@ -2811,7 +2784,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) StringList allOpNames; transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); - + allOpNames.push_back("ice_id"); allOpNames.push_back("ice_ids"); allOpNames.push_back("ice_isA"); @@ -2962,6 +2935,11 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) string baseName = base ? fixKwd(base->scoped()) : string("::Ice::Object"); H << nl << "using " << baseName << "::__writeImpl;"; H << nl << "using " << baseName << "::__readImpl;"; + H << sp; + H << nl << "template<typename T, typename S>"; + H << nl << "friend struct Ice::StreamWriter;"; + H << nl << "template<typename T, typename S>"; + H << nl << "friend struct Ice::StreamReader;"; if(preserved && !basePreserved) { @@ -2986,7 +2964,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "void" << nl << scoped.substr(2) << "::__writeImpl(::Ice::OutputStream* __os) const"; C << sb; C << nl << "__os->startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");"; - writeMarshalUnmarshalDataMembers(C, p->dataMembers(), p->orderedOptionalDataMembers(), true); + C << nl << "Ice::StreamWriter<" << scoped.substr(2) << ", ::Ice::OutputStream>::write(__os, *this);"; C << nl << "__os->endSlice();"; if(base) { @@ -2998,7 +2976,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "void" << nl << scoped.substr(2) << "::__readImpl(::Ice::InputStream* __is)"; C << sb; C << nl << "__is->startSlice();"; - writeMarshalUnmarshalDataMembers(C, p->dataMembers(), p->orderedOptionalDataMembers(), false); + C << nl << "Ice::StreamReader<" << scoped.substr(2) << ", ::Ice::InputStream>::read(__is, *this);"; C << nl << "__is->endSlice();"; if(base) { @@ -4733,6 +4711,7 @@ Slice::Gen::StreamVisitor::visitModuleStart(const ModulePtr& m) { if(!m->hasNonLocalContained(Contained::ContainedTypeStruct) && !m->hasNonLocalContained(Contained::ContainedTypeEnum) && + !m->hasNonLocalContained(Contained::ContainedTypeClass) && !m->hasNonLocalContained(Contained::ContainedTypeException)) { return false; @@ -4767,6 +4746,16 @@ Slice::Gen::StreamVisitor::visitModuleEnd(const ModulePtr& m) } bool +Slice::Gen::StreamVisitor::visitClassDefStart(const ClassDefPtr& c) +{ + if(!c->isLocal()) + { + writeStreamHelpers(H, c, c->dataMembers(), true); + } + return false; +} + +bool Slice::Gen::StreamVisitor::visitExceptionStart(const ExceptionPtr& p) { if(!p->isLocal()) @@ -4777,6 +4766,8 @@ Slice::Gen::StreamVisitor::visitExceptionStart(const ExceptionPtr& p) H << sb; H << nl << "static const StreamHelperCategory helper = StreamHelperCategoryUserException;"; H << eb << ";" << nl; + + writeStreamHelpers(H, p, p->dataMembers(), true); } return false; } @@ -4815,33 +4806,7 @@ Slice::Gen::StreamVisitor::visitStructStart(const StructPtr& p) } H << eb << ";" << nl; - DataMemberList dataMembers = p->dataMembers(); - - string holder = classMetaData ? "v->" : "v."; - - H << nl << "template<class S>"; - H << nl << "struct StreamWriter< " << fullStructName << ", S>"; - H << sb; - H << nl << "static void write(S* __os, const " << fullStructName << "& v)"; - H << sb; - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalDataMemberInHolder(H, holder, *q, true); - } - H << eb; - H << eb << ";" << nl; - - H << nl << "template<class S>"; - H << nl << "struct StreamReader< " << fullStructName << ", S>"; - H << sb; - H << nl << "static void read(S* __is, " << fullStructName << "& v)"; - H << sb; - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalDataMemberInHolder(H, holder, *q, false); - } - H << eb; - H << eb << ";" << nl; + writeStreamHelpers(H, p, p->dataMembers(), true); } return false; } @@ -5425,18 +5390,12 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) } } - H << sp << nl << "class " << _dllExport << name << " : "; - H.useCurrentPosAsIndent(); - H << "public "; - if(!base) - { - H << (p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException"); - } - else - { - H << fixKwd(base->scoped()); - } - H.restoreIndent(); + string helperClass = p->isLocal() ? "Ice::LocalExceptionHelper" : "Ice::UserExceptionHelper"; + string baseClass = base ? fixKwd(base->scoped()) : (p->isLocal() ? "::Ice::LocalException" : "::Ice::UserException"); + string templateParameters = name + ", " + baseClass; + + H << sp << nl; + H << "class " << _dllExport << name << " : public ::" << helperClass << "<" << templateParameters << ">"; H << sb; H.dec(); @@ -5446,7 +5405,8 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) if(p->isLocal()) { H << sp << nl << name << "(const char* __ice_file, int __ice_line) : "; - H << (base ? fixKwd(base->scoped()) : "::Ice::LocalException") << "(__ice_file, __ice_line)"; + H << "::Ice::LocalExceptionHelper" << "<" << templateParameters << ">"; + H << "(__ice_file, __ice_line)"; H << sb; H << eb; } @@ -5494,7 +5454,7 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) H.inc(); if(base && (p->isLocal() || !baseDataMembers.empty())) { - H << nl << fixKwd(base->scoped()) << "("; + H << nl << "::" << helperClass << "<" << templateParameters << ">" << "("; if(p->isLocal()) { H << "__ice_file, __ice_line"; @@ -5528,7 +5488,8 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) } else if(p->isLocal()) { - H << nl << "::Ice::LocalException(__ice_file, __ice_line)"; + H << " ::Ice::LocalExceptionHelper" << "<" << templateParameters << ">"; + H << "(__ice_file, __ice_line)"; if(!dataMembers.empty()) { H << ","; @@ -5557,12 +5518,22 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) } H << sp; - H << nl << "virtual ::std::string ice_id() const;"; - C << sp << nl << "::std::string" << nl << scoped.substr(2) << "::ice_id() const"; + H << nl << "static const ::std::string& ice_staticId();"; + + if(p->isLocal()) + { + C << sp << nl << "namespace" << sb; + C.dec(); + C << nl << "const std::string " << p->flattenedScope() << p->name() << "_id = \"" << p->scoped() << "\";"; + C.inc(); + C << eb; + } + + C << sp << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_staticId()"; C << sb; if(p->isLocal()) { - C << nl << "return \"" << p->scoped() << "\";" << ";"; + C << nl << "return " << p->flattenedScope() << p->name() << "_id;"; } else { @@ -5576,12 +5547,6 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionStart(const ExceptionPtr& p) H << nl << "virtual void ice_print(::std::ostream&) const;"; } - H << nl << "virtual void ice_throw() const;"; - C << sp << nl << "void" << nl << scoped.substr(2) << "::ice_throw() const"; - C << sb; - C << nl << "throw *this;"; - C << eb; - if(!p->isLocal() && p->usesClasses(false)) { if(!base || (base && !base->usesClasses(false))) @@ -5616,7 +5581,6 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) ExceptionPtr base = p->base(); bool basePreserved = p->inheritsMetaData("preserve-slice"); bool preserved = p->hasMetaData("preserve-slice"); - string typeId = p->flattenedScope() + p->name() + "_init.typeId"; if(preserved && !basePreserved) { @@ -5624,13 +5588,6 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) H << nl << "virtual void __read(::Ice::InputStream*);"; } - H.dec(); - H << sp << nl << "protected:"; - H.inc(); - H << sp; - H << nl << "virtual void __writeImpl(::Ice::OutputStream*) const;"; - H << nl << "virtual void __readImpl(::Ice::InputStream*);"; - if(preserved && !basePreserved) { H << sp << nl << "::std::shared_ptr<::Ice::SlicedData> __slicedData;"; @@ -5649,28 +5606,6 @@ Slice::Gen::Cpp11TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "__slicedData = __is->endException(true);"; C << eb; } - - C << sp << nl << "void" << nl << scoped.substr(2) << "::__writeImpl(::Ice::OutputStream* __os) const"; - C << sb; - C << nl << "__os->startSlice(" << typeId << ", -1, " << (!base ? "true" : "false") << ");"; - writeMarshalUnmarshalDataMembers(C, p->dataMembers(), p->orderedOptionalDataMembers(), true); - C << nl << "__os->endSlice();"; - if(base) - { - emitUpcall(base, "::__writeImpl(__os);"); - } - C << eb; - - C << sp << nl << "void" << nl << scoped.substr(2) << "::__readImpl(::Ice::InputStream* __is)"; - C << sb; - C << nl << "__is->startSlice();"; - writeMarshalUnmarshalDataMembers(C, p->dataMembers(), p->orderedOptionalDataMembers(), false); - C << nl << "__is->endSlice();"; - if(base) - { - emitUpcall(base, "::__readImpl(__is);"); - } - C << eb; } H << eb << ';'; @@ -6993,7 +6928,7 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefStart(const ClassDefPtr& p) H << sp; H << nl << "virtual bool ice_isA(::std::string, const ::Ice::Current& = ::Ice::noExplicitCurrent) const;"; H << nl << "virtual ::std::vector< ::std::string> ice_ids(const ::Ice::Current& = ::Ice::noExplicitCurrent) const;"; - H << nl << "virtual const ::std::string& ice_id(const ::Ice::Current& = ::Ice::noExplicitCurrent) const;"; + H << nl << "virtual ::std::string ice_id(const ::Ice::Current& = ::Ice::noExplicitCurrent) const;"; H << nl << "static const ::std::string& ice_staticId();"; string flatName = p->flattenedScope() + p->name() + "_ids"; @@ -7011,7 +6946,7 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefStart(const ClassDefPtr& p) C << eb; C << sp; - C << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_id(const ::Ice::Current&) const"; + C << nl << "::std::string" << nl << scoped.substr(2) << "::ice_id(const ::Ice::Current&) const"; C << sb; C << nl << "return " << flatName << '[' << scopedPos << "];"; C << eb; @@ -7523,9 +7458,12 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefEnd(const ClassDefPtr& p) H.dec(); H << sp << nl << "protected:"; H.inc(); + H << sp; - H << nl << "virtual void __writeImpl(::Ice::OutputStream*) const;"; - H << nl << "virtual void __readImpl(::Ice::InputStream*);"; + H << nl << "template<typename T, typename S>"; + H << nl << "friend struct Ice::StreamWriter;"; + H << nl << "template<typename T, typename S>"; + H << nl << "friend struct Ice::StreamReader;"; if(preserved && !basePreserved) { @@ -7547,30 +7485,6 @@ Slice::Gen::Cpp11ValueVisitor::visitClassDefEnd(const ClassDefPtr& p) } C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__writeImpl(::Ice::OutputStream* __os) const"; - C << sb; - C << nl << "__os->startSlice(" << typeId << ", " << p->compactId() << (!base ? ", true" : ", false") << ");"; - writeMarshalUnmarshalDataMembers(C, p->dataMembers(), p->orderedOptionalDataMembers(), true); - C << nl << "__os->endSlice();"; - if(base) - { - emitUpcall(base, "::__writeImpl(__os);"); - } - C << eb; - - C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__readImpl(::Ice::InputStream* __is)"; - C << sb; - C << nl << "__is->startSlice();"; - writeMarshalUnmarshalDataMembers(C, p->dataMembers(), p->orderedOptionalDataMembers(), false); - C << nl << "__is->endSlice();"; - if(base) - { - emitUpcall(base, "::__readImpl(__is);"); - } - C << eb; - - C << sp; C << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_staticId()"; C << sb; C << nl << "return " << typeId << ";"; @@ -7769,7 +7683,9 @@ bool Slice::Gen::Cpp11StreamVisitor::visitModuleStart(const ModulePtr& m) { if(!m->hasNonLocalContained(Contained::ContainedTypeStruct) && - !m->hasNonLocalContained(Contained::ContainedTypeEnum)) + !m->hasNonLocalContained(Contained::ContainedTypeEnum) && + !m->hasNonLocalContained(Contained::ContainedTypeException) && + !m->hasNonLocalContained(Contained::ContainedTypeClass)) { return false; } @@ -7825,33 +7741,28 @@ Slice::Gen::Cpp11StreamVisitor::visitStructStart(const StructPtr& p) H << nl << "static const bool fixedLength = " << (p->isVariableLength() ? "false" : "true") << ";"; H << eb << ";" << nl; - DataMemberList dataMembers = p->dataMembers(); + writeStreamHelpers(H, p, p->dataMembers()); - H << nl << "template<class S>"; - H << nl << "struct StreamWriter<" << scoped << ", S>"; - H << sb; - H << nl << "static void write(S* __os, const " << scoped << "& v)"; - H << sb; - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) + return false; +} + +bool +Slice::Gen::Cpp11StreamVisitor::visitClassDefStart(const ClassDefPtr& c) +{ + if(!c->isLocal() && !c->isInterface()) { - writeMarshalUnmarshalDataMemberInHolder(H, "v.", *q, true); + writeStreamHelpers(H, c, c->dataMembers(), true); } - H << eb; - H << eb << ";" << nl; + return false; +} - H << nl << "template<class S>"; - H << nl << "struct StreamReader<" << scoped << ", S>"; - H << sb; - H << nl << "static void read(S* __is, " << scoped << "& v)"; - H << sb; - for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) +void +Slice::Gen::Cpp11StreamVisitor::visitExceptionEnd(const ExceptionPtr& p) +{ + if(!p->isLocal()) { - writeMarshalUnmarshalDataMemberInHolder(H, "v.", *q, false); + writeStreamHelpers(H, p, p->dataMembers(), true); } - H << eb; - H << eb << ";" << nl; - - return false; } void diff --git a/cpp/src/slice2cpp/Gen.h b/cpp/src/slice2cpp/Gen.h index 9e1d6a76283..1e45e246fb3 100644 --- a/cpp/src/slice2cpp/Gen.h +++ b/cpp/src/slice2cpp/Gen.h @@ -329,6 +329,7 @@ private: virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); virtual bool visitStructStart(const StructPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); virtual bool visitExceptionStart(const ExceptionPtr&); virtual void visitEnum(const EnumPtr&); @@ -561,6 +562,8 @@ private: virtual bool visitModuleStart(const ModulePtr&); virtual void visitModuleEnd(const ModulePtr&); virtual bool visitStructStart(const StructPtr&); + virtual bool visitClassDefStart(const ClassDefPtr&); + virtual void visitExceptionEnd(const ExceptionPtr&); virtual void visitEnum(const EnumPtr&); private: diff --git a/cpp/test/Ice/objects/Test.ice b/cpp/test/Ice/objects/Test.ice index a84a62ecfad..95099c82114 100644 --- a/cpp/test/Ice/objects/Test.ice +++ b/cpp/test/Ice/objects/Test.ice @@ -184,7 +184,7 @@ class Initial I getI(); I getJ(); I getH(); - + D1 getD1(D1 d1); void throwEDerived() throws EDerived; diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp index 68c05fae57b..900fee03e90 100644 --- a/cpp/test/Ice/operations/TestAMDI.cpp +++ b/cpp/test/Ice/operations/TestAMDI.cpp @@ -55,7 +55,11 @@ MyDerivedClassI::ice_ids(const Ice::Current& current) const #endif } +#ifdef ICE_CPP11_MAPPING +std::string +#else const std::string& +#endif MyDerivedClassI::ice_id(const Ice::Current& current) const { test(current.mode == ICE_ENUM(OperationMode, Nonmutating)); @@ -89,7 +93,7 @@ private: void MyDerivedClassI::shutdown_async(function<void ()> response, - function<void (exception_ptr)>, + function<void (exception_ptr)>, const Ice::Current& current) { { @@ -133,7 +137,7 @@ MyDerivedClassI::opVoid_async(function<void ()> response, } -void +void MyDerivedClassI::opByte_async(Ice::Byte p1, Ice::Byte p2, function<void (Ice::Byte, Ice::Byte)> response, @@ -143,7 +147,7 @@ MyDerivedClassI::opByte_async(Ice::Byte p1, response(p1, p1 ^ p2); } -void +void MyDerivedClassI::opBool_async(bool p1, bool p2, function<void (bool, bool)> response, @@ -211,7 +215,7 @@ MyDerivedClassI::opMyClass_async(shared_ptr<Test::MyClassPrx> p1, } void -MyDerivedClassI::opStruct_async(Test::Structure p1, +MyDerivedClassI::opStruct_async(Test::Structure p1, Test::Structure p2, function<void (const Test::Structure&, const Test::Structure&)> response, function<void (exception_ptr)>, @@ -756,7 +760,7 @@ MyDerivedClassI::opContext_async(function<void (const Ice::Context&)> response, void MyDerivedClassI::opDoubleMarshaling_async(Ice::Double p1, - Test::DoubleS p2, + Test::DoubleS p2, function<void ()> response, function<void (exception_ptr)>, const Ice::Current&) @@ -1605,7 +1609,7 @@ MyDerivedClassI::opByteSOneway_async(const Test::AMD_MyClass_opByteSOnewayPtr& c } void -MyDerivedClassI::opByteSOnewayCallCount_async(const Test::AMD_MyClass_opByteSOnewayCallCountPtr& cb, +MyDerivedClassI::opByteSOnewayCallCount_async(const Test::AMD_MyClass_opByteSOnewayCallCountPtr& cb, const Ice::Current&) { IceUtil::Mutex::Lock sync(_mutex); diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h index a8b758922a6..7aa1705c662 100644 --- a/cpp/test/Ice/operations/TestAMDI.h +++ b/cpp/test/Ice/operations/TestAMDI.h @@ -14,7 +14,7 @@ #include <TestAMD.h> #include <TestCommon.h> -class MyDerivedClassI : +class MyDerivedClassI : #ifdef ICE_CPP11_MAPPING public Test::MyDerivedClassDisp #else @@ -22,7 +22,7 @@ class MyDerivedClassI : #endif { public: - + MyDerivedClassI(); // @@ -31,7 +31,11 @@ public: virtual bool ice_isA(ICE_IN(std::string), const Ice::Current&) const; virtual void ice_ping(const Ice::Current&) const; virtual std::vector<std::string> ice_ids(const Ice::Current&) const; +#ifdef ICE_CPP11_MAPPING + virtual std::string ice_id(const Ice::Current&) const; +#else virtual const std::string& ice_id(const Ice::Current&) const; +#endif #ifdef ICE_CPP11_MAPPING virtual void shutdown_async(::std::function<void ()>, @@ -285,7 +289,7 @@ public: ::std::function<void ()>, ::std::function<void (std::exception_ptr)>, const Ice::Current&); - + virtual void opByteSOnewayCallCount_async(::std::function<void (int)>, ::std::function<void (std::exception_ptr)>, const Ice::Current&); @@ -355,12 +359,12 @@ public: ::std::function<void (const Test::ByteBoolD&)>, ::std::function<void (std::exception_ptr)>, const Ice::Current&); - + virtual void opStringS2_async(Test::StringS, ::std::function<void (const Test::StringS&)>, ::std::function<void (std::exception_ptr)>, const Ice::Current&); - + virtual void opByteBoolD2_async(Test::ByteBoolD, ::std::function<void (const Test::ByteBoolD&)>, ::std::function<void (std::exception_ptr)>, @@ -379,7 +383,7 @@ public: virtual void opStringLiterals_async(::std::function<void (const Test::StringS&)>, ::std::function<void (std::exception_ptr)>, const Ice::Current&); - + virtual void opWStringLiterals_async(::std::function<void (const Test::WStringS&)>, ::std::function<void (std::exception_ptr)>, const Ice::Current&); @@ -616,16 +620,16 @@ public: virtual void opByteBoolD1_async(const Test::AMD_MyClass_opByteBoolD1Ptr&, const Test::ByteBoolD&, const Ice::Current&); - + virtual void opStringS2_async(const Test::AMD_MyClass_opStringS2Ptr&, const Test::StringS&, const Ice::Current&); - + virtual void opByteBoolD2_async(const Test::AMD_MyClass_opByteBoolD2Ptr&, const Test::ByteBoolD&, const Ice::Current&); - virtual void opMyStruct1_async(const Test::AMD_MyDerivedClass_opMyStruct1Ptr&, + virtual void opMyStruct1_async(const Test::AMD_MyDerivedClass_opMyStruct1Ptr&, const Test::MyStruct1&, const Ice::Current&); @@ -635,7 +639,7 @@ public: virtual void opStringLiterals_async(const Test::AMD_MyClass_opStringLiteralsPtr&, const Ice::Current&); - + virtual void opWStringLiterals_async(const Test::AMD_MyClass_opWStringLiteralsPtr&, const Ice::Current&); #endif diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index 391f991feb8..1c091594b36 100644 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp @@ -41,7 +41,7 @@ MyDerivedClassI::ice_ping(const Ice::Current& current) const #ifdef ICE_CPP11_MAPPING Test::MyDerivedClassDisp::ice_ping(current); #else - Test::MyDerivedClass::ice_ping(current); + Test::MyDerivedClass::ice_ping(current); #endif } @@ -56,7 +56,11 @@ MyDerivedClassI::ice_ids(const Ice::Current& current) const #endif } +#ifdef ICE_CPP11_MAPPING +std::string +#else const std::string& +#endif MyDerivedClassI::ice_id(const Ice::Current& current) const { test(current.mode == ICE_ENUM(OperationMode, Nonmutating)); diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h index eadb78d4da3..88189157ba9 100644 --- a/cpp/test/Ice/operations/TestI.h +++ b/cpp/test/Ice/operations/TestI.h @@ -13,7 +13,7 @@ #include <Test.h> #include <TestCommon.h> -class MyDerivedClassI : +class MyDerivedClassI : #ifdef ICE_CPP11_MAPPING public Test::MyDerivedClassDisp #else @@ -30,7 +30,11 @@ public: virtual bool ice_isA(ICE_IN(std::string), const Ice::Current&) const; virtual void ice_ping(const Ice::Current&) const; virtual std::vector<std::string> ice_ids(const Ice::Current&) const; +#ifdef ICE_CPP11_MAPPING + virtual std::string ice_id(const Ice::Current&) const; +#else virtual const std::string& ice_id(const Ice::Current&) const; +#endif virtual void shutdown(const Ice::Current&); @@ -75,7 +79,7 @@ public: Test::MyClassPrxPtr&, Test::MyClassPrxPtr&, const Ice::Current&); - virtual Test::Structure opStruct(ICE_IN(Test::Structure), + virtual Test::Structure opStruct(ICE_IN(Test::Structure), ICE_IN(Test::Structure), Test::Structure&, const Ice::Current&); @@ -290,17 +294,17 @@ public: virtual Test::StringS opStringS1(ICE_IN(Test::StringS), const Ice::Current&); virtual Test::ByteBoolD opByteBoolD1(ICE_IN(Test::ByteBoolD), const Ice::Current&); - + virtual Test::StringS opStringS2(ICE_IN(Test::StringS), const Ice::Current&); - + virtual Test::ByteBoolD opByteBoolD2(ICE_IN(Test::ByteBoolD), const Ice::Current&); - + virtual Test::MyStruct1 opMyStruct1(ICE_IN(Test::MyStruct1), const Ice::Current&); virtual Test::MyClass1Ptr opMyClass1(ICE_IN(Test::MyClass1Ptr), const Ice::Current&); - + virtual Test::StringS opStringLiterals(const Ice::Current&); - + virtual Test::WStringS opWStringLiterals(const Ice::Current&); private: diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index 2c04c8443ba..eb73673e0bf 100644 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -78,6 +78,30 @@ public: }; ICE_DEFINE_PTR(TestObjectReaderPtr, TestObjectReader); +// Required for ValueHelper<>'s __readImpl and __writeIpml +#ifdef ICE_CPP11_MAPPING +template<class S> +struct Ice::StreamWriter<TestObjectWriter, S> +{ + static void write(S* __os, const TestObjectWriter&) { assert(false); } +}; +template<class S> +struct Ice::StreamReader<TestObjectWriter, S> +{ + static void read(S* __is, TestObjectWriter&) { assert(false); } +}; +template<class S> +struct Ice::StreamWriter<TestObjectReader, S> +{ + static void write(S* __os, const TestObjectReader&) { assert(false); } +}; +template<class S> +struct Ice::StreamReader<TestObjectReader, S> +{ + static void read(S* __is, TestObjectReader&) { assert(false); } +}; +#endif + #ifndef ICE_CPP11_MAPPING class TestValueFactory : public Ice::ValueFactory { @@ -104,7 +128,7 @@ public: #ifdef ICE_CPP11_MAPPING void patchObject(void* addr, const Ice::ValuePtr& v) -{ +{ Ice::ValuePtr* p = static_cast<Ice::ValuePtr*>(addr); assert(p); *p = v; @@ -112,7 +136,7 @@ patchObject(void* addr, const Ice::ValuePtr& v) #else void patchObject(void* addr, const Ice::ObjectPtr& v) -{ +{ Ice::ObjectPtr* p = static_cast<Ice::ObjectPtr*>(addr); assert(p); *p = v; |