diff options
author | Benoit Foucher <benoit@zeroc.com> | 2009-12-15 18:25:33 +0100 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2009-12-15 18:25:33 +0100 |
commit | 847b96ee887e245c2c78274769b035528784d772 (patch) | |
tree | 9771f44d242e475ad7ef02d3d6ed0712251a7ed3 /cpp | |
parent | more INSTALL/README edits (diff) | |
download | ice-847b96ee887e245c2c78274769b035528784d772.tar.bz2 ice-847b96ee887e245c2c78274769b035528784d772.tar.xz ice-847b96ee887e245c2c78274769b035528784d772.zip |
Fixes for 4471 - more Ice stream fixes
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/allTests.py | 2 | ||||
-rw-r--r-- | cpp/include/Ice/Stream.h | 891 | ||||
-rw-r--r-- | cpp/include/IceUtil/ScopedArray.h | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Initialize.cpp | 8 | ||||
-rw-r--r-- | cpp/src/Ice/Stream.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.cpp | 460 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.h | 235 | ||||
-rw-r--r-- | cpp/src/IcePatch2/FileServerI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Slice/CPlusPlusUtil.cpp | 4 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 221 | ||||
-rw-r--r-- | cpp/test/Ice/Makefile.mak | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | cpp/test/Ice/stream/Client.cpp | 46 |
12 files changed, 873 insertions, 1011 deletions
diff --git a/cpp/allTests.py b/cpp/allTests.py index 6113b507419..db251048791 100755 --- a/cpp/allTests.py +++ b/cpp/allTests.py @@ -51,7 +51,7 @@ tests = [ ("Ice/gc", ["once"]), ("Ice/dispatcher", ["once"]), ("Ice/checksum", ["core"]), - ("Ice/stream", ["core", "novc6"]), + ("Ice/stream", ["core"]), ("Ice/hold", ["core"]), ("Ice/custom", ["core", "novc6"]), ("Ice/retry", ["core"]), diff --git a/cpp/include/Ice/Stream.h b/cpp/include/Ice/Stream.h index 426ee1873a1..2d0b06cb847 100644 --- a/cpp/include/Ice/Stream.h +++ b/cpp/include/Ice/Stream.h @@ -20,15 +20,14 @@ namespace Ice { -#if defined(_MSC_VER) && (_MSC_VER < 1300) // COMPILERBUG // -// VC++ 6 compiler bugs doesn't allow using templates for the Stream API. +// COMPILERFIX: VC++ 6 compiler bugs doesn't allow using templates for +// the Stream API. // // see: http://support.microsoft.com/kb/240866 // http://support.microsoft.com/kb/241569 // -#else - +#if !defined(_MSC_VER) || (_MSC_VER >= 1300) enum StreamTraitType { StreamTraitTypeBuiltin, @@ -38,14 +37,9 @@ enum StreamTraitType StreamTraitTypeShortEnum, // Enums with up to 32767 enumerators StreamTraitTypeIntEnum, // Enums with more than 32767 enumerators StreamTraitTypeSequence, -// -// BCC2010 compiler bugs doesn't allow use full specialization over partial specialization. -// -# ifndef __BCPLUSPLUS__ - StreamTraitTypeSequenceBool, // Sequences of bool need a special case - // becasue c++ optimizations for vector<bool> - // are not portable across compilers. -# endif +#ifndef __BCPLUSPLUS__ // COMPILERFIX: See StreamTrait<vector<bool>> comment below + StreamTraitTypeSequenceBool, +#endif StreamTraitTypeDictionary, StreamTraitTypeUserException, StreamTraitTypeUnknown @@ -61,7 +55,7 @@ class MarshalException; template<typename T> struct StreamTrait { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeUnknown; + static const StreamTraitType type = StreamTraitTypeUnknown; static const int minWireSize = 0; }; @@ -71,29 +65,33 @@ struct StreamTrait template<typename T> struct StreamTrait< std::vector<T> > { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeSequence; + static const StreamTraitType type = StreamTraitTypeSequence; static const int minWireSize = 1; }; // -// BCC2010 compiler bugs doesn't allow use full specialization over partial specialization. +// StreamTrait specialization for std::vector<bool>. Sequences of bool +// are handled specifically because C++ optimizations for vector<bool> +// prevent us from reading vector of bools the same way as other +// sequences (see StreamReader<StreamTraitTypeSequenceBool>::read +// implementation below) // -# ifndef __BCPLUSPLUS__ -// -// StreamTrait specialization for std::vector<bool> +// COMPILERFIX: BCC2010 doesn't allow use of full specialization over +// partial specialization. // +#ifndef __BCPLUSPLUS__ template<> -struct StreamTrait< std::vector<bool, std::allocator<bool> > > +struct StreamTrait< std::vector<bool> > { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeSequenceBool; + static const StreamTraitType type = StreamTraitTypeSequenceBool; static const int minWireSize = 1; }; -# endif +#endif template<> struct StreamTrait<UserException> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeUserException; + static const StreamTraitType type = StreamTraitTypeUserException; }; // @@ -102,88 +100,88 @@ struct StreamTrait<UserException> template<typename K, typename V> struct StreamTrait< std::map<K, V> > { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeDictionary; + static const StreamTraitType type = StreamTraitTypeDictionary; static const int minWireSize = 1; }; // -// StreamTrait specialization for builtins (these are need for sequence +// StreamTrait specialization for builtins (these are needed for sequence // marshalling to figure out the minWireSize of each built-in). // template<> struct StreamTrait< bool> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 1; }; template<> -struct StreamTrait< ::Ice::Byte> +struct StreamTrait< Byte> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 1; }; template<> -struct StreamTrait< ::Ice::Short> +struct StreamTrait< Short> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 2; }; template<> -struct StreamTrait< ::Ice::Int> +struct StreamTrait< Int> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 4; }; template<> -struct StreamTrait< ::Ice::Long> +struct StreamTrait< Long> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 8; }; template<> -struct StreamTrait< ::Ice::Float> +struct StreamTrait< Float> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 4; }; template<> -struct StreamTrait< ::Ice::Double> +struct StreamTrait< Double> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 8; }; template<> struct StreamTrait< ::std::string> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 1; }; template<> struct StreamTrait< ::std::wstring> { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 1; }; template<typename T> struct StreamTrait< ::IceInternal::ProxyHandle<T> > { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 2; }; template<typename T> struct StreamTrait< ::IceInternal::Handle<T> > { - static const ::Ice::StreamTraitType type = Ice::StreamTraitTypeBuiltin; + static const StreamTraitType type = StreamTraitTypeBuiltin; static const int minWireSize = 4; }; @@ -197,7 +195,7 @@ template<StreamTraitType st> struct StreamWriter { template<typename T> - static void write(const ::Ice::OutputStreamPtr&, const T&) + static void write(const OutputStreamPtr&, const T&) { // This asserts because we end up writing something for which // we never defined a trait. @@ -215,7 +213,7 @@ template<StreamTraitType st> struct StreamReader { template<typename T> - static void read(const ::Ice::InputStreamPtr&, T&) + static void read(const InputStreamPtr&, T&) { // This asserts because we end up reading something for wich // we never define a trait. @@ -223,203 +221,95 @@ struct StreamReader } }; -template<typename T>void -__patch__Ptr(void* __addr, ::Ice::ObjectPtr& v) -{ - ::IceInternal::Handle<T>* p = static_cast< ::IceInternal::Handle<T>*>(__addr); - assert(p); - *p = ::IceInternal::Handle<T>::dynamicCast(v); - if(v && !*p) - { - IceInternal::Ex::throwUOE(T::ice_staticId(), v->ice_id()); - } -} #endif class ICE_API ReadObjectCallback : public ::IceUtil::Shared { public: - virtual void invoke(const ::Ice::ObjectPtr&) = 0; + virtual void invoke(const ObjectPtr&) = 0; }; typedef IceUtil::Handle< ReadObjectCallback > ReadObjectCallbackPtr; -class ICE_API ReadObjectCallbackI : public ReadObjectCallback +template<typename T> +class ReadObjectCallbackI : public ReadObjectCallback { -public: - typedef void (*PatchFunc)(void*, Ice::ObjectPtr&); +public: - ReadObjectCallbackI(PatchFunc, void*); + ReadObjectCallbackI(::IceInternal::Handle<T>& v) : + _v(v) + { + } - virtual void invoke(const ::Ice::ObjectPtr&); + virtual void invoke(const ObjectPtr& p) + { + _v = ::IceInternal::Handle<T>::dynamicCast(p); + if(p && !_v) + { + IceInternal::Ex::throwUOE(T::ice_staticId(), p->ice_id()); + } + } private: - PatchFunc _func; - void* _arg; + ::IceInternal::Handle<T>& _v; }; class ICE_API InputStream : public ::IceUtil::Shared { public: - virtual Ice::CommunicatorPtr communicator() const = 0; + virtual CommunicatorPtr communicator() const = 0; virtual void sliceObjects(bool) = 0; -// -// BCC2010 compiler bugs doesn't allow use full specialization over partial specialization. -// -# if defined(__BCPLUSPLUS__) // - // std::vector<bool> optimization use a hidden reference to - // a bit instead of a reference to bool. + // COMPILERFIX: BCC2010 doesn't allow use of full specialization over + // partial specialization. // +#ifdef __BCPLUSPLUS__ void read(std::_Vb_reference<unsigned int, int> v) { v = readBool(); } -# endif - - ICE_DEPRECATED_API virtual bool readBool() - { - return internalReadBool(); - } - - ICE_DEPRECATED_API virtual ::std::vector< bool > readBoolSeq() - { - return internalReadBoolSeq(); - } - - ICE_DEPRECATED_API virtual bool* readBoolSeq(::std::pair<const bool*, const bool*>& p) - { - return internalReadBoolSeq(p); - } - - ICE_DEPRECATED_API virtual ::Ice::Byte readByte() - { - return internalReadByte(); - } - - ICE_DEPRECATED_API virtual ::std::vector< ::Ice::Byte > readByteSeq() - { - return internalReadByteSeq(); - } - - ICE_DEPRECATED_API virtual void readByteSeq(::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>& p) - { - return internalReadByteSeq(p); - } - - ICE_DEPRECATED_API virtual ::Ice::Short readShort() - { - return internalReadShort(); - } - - ICE_DEPRECATED_API virtual ::std::vector< ::Ice::Short > readShortSeq() - { - return internalReadShortSeq(); - } - - ICE_DEPRECATED_API virtual ::Ice::Short* readShortSeq(::std::pair<const ::Ice::Short*, const ::Ice::Short*>& p) - { - return internalReadShortSeq(p); - } - - ICE_DEPRECATED_API virtual ::Ice::Int readInt() - { - return internalReadInt(); - } - - ICE_DEPRECATED_API virtual ::std::vector< ::Ice::Int > readIntSeq() - { - return internalReadIntSeq(); - } - - ICE_DEPRECATED_API virtual ::Ice::Int* readIntSeq(::std::pair<const ::Ice::Int*, const ::Ice::Int*>& p) - { - return internalReadIntSeq(p); - } - - ICE_DEPRECATED_API virtual ::Ice::Long readLong() - { - return internalReadLong(); - } - - ICE_DEPRECATED_API virtual ::std::vector< ::Ice::Long > readLongSeq() - { - return internalReadLongSeq(); - } - - ICE_DEPRECATED_API virtual ::Ice::Long* readLongSeq(::std::pair<const ::Ice::Long*, const ::Ice::Long*>& p) - { - return internalReadLongSeq(p); - } - - ICE_DEPRECATED_API virtual ::Ice::Float readFloat() - { - return internalReadFloat(); - } - - ICE_DEPRECATED_API virtual ::std::vector< ::Ice::Float > readFloatSeq() - { - return internalReadFloatSeq(); - } - - ICE_DEPRECATED_API virtual ::Ice::Float* readFloatSeq(::std::pair<const ::Ice::Float*, const ::Ice::Float*>& p) - { - return internalReadFloatSeq(p); - } - - ICE_DEPRECATED_API virtual ::Ice::Double readDouble() - { - return internalReadDouble(); - } - - ICE_DEPRECATED_API virtual ::std::vector< ::Ice::Double > readDoubleSeq() - { - return internalReadDoubleSeq(); - } - - ICE_DEPRECATED_API virtual ::Ice::Double* readDoubleSeq(::std::pair<const ::Ice::Double*, const ::Ice::Double*>& p) - { - return internalReadDoubleSeq(p); - } - - ICE_DEPRECATED_API virtual ::std::string readString(bool convert = true) - { - return internalReadString(convert); - } - - ICE_DEPRECATED_API virtual ::std::vector< ::std::string > readStringSeq(bool convert = true) - { - return internalReadStringSeq(convert); - } - - ICE_DEPRECATED_API virtual ::std::wstring readWstring() - { - return internalReadWstring(); - } - - ICE_DEPRECATED_API virtual ::std::vector< ::std::wstring > readWstringSeq() - { - return internalReadWstringSeq(); - } - - virtual ::Ice::Int readSize() = 0; - virtual ::Ice::Int readAndCheckSeqSize(int) = 0; - - ICE_DEPRECATED_API virtual ::Ice::ObjectPrx readProxy() - { - return internalReadProxy(); - } - - virtual void readObject(const ::Ice::ReadObjectCallbackPtr&) = 0; +#endif + ICE_DEPRECATED_API virtual bool readBool() = 0; + ICE_DEPRECATED_API virtual Byte readByte() = 0; + ICE_DEPRECATED_API virtual Short readShort() = 0; + ICE_DEPRECATED_API virtual Int readInt() = 0; + ICE_DEPRECATED_API virtual Long readLong() = 0; + ICE_DEPRECATED_API virtual Float readFloat() = 0; + ICE_DEPRECATED_API virtual Double readDouble() = 0; + ICE_DEPRECATED_API virtual ::std::string readString(bool convert = true) = 0; + ICE_DEPRECATED_API virtual ::std::wstring readWstring() = 0; + + ICE_DEPRECATED_API virtual ::std::vector< bool > readBoolSeq() = 0; + ICE_DEPRECATED_API virtual ::std::vector< Byte > readByteSeq() = 0; + ICE_DEPRECATED_API virtual ::std::vector< Short > readShortSeq() = 0; + ICE_DEPRECATED_API virtual ::std::vector< Int > readIntSeq() = 0; + ICE_DEPRECATED_API virtual ::std::vector< Long > readLongSeq() = 0; + ICE_DEPRECATED_API virtual ::std::vector< Float > readFloatSeq() = 0; + ICE_DEPRECATED_API virtual ::std::vector< Double > readDoubleSeq() = 0; + ICE_DEPRECATED_API virtual ::std::vector< ::std::string > readStringSeq(bool convert = true) = 0; + ICE_DEPRECATED_API virtual ::std::vector< ::std::wstring > readWstringSeq() = 0; + + ICE_DEPRECATED_API virtual bool* readBoolSeq(std::pair<const bool*, const bool*>&) = 0; + ICE_DEPRECATED_API virtual void readByteSeq(std::pair<const Byte*, const Byte*>&) = 0; + ICE_DEPRECATED_API virtual Short* readShortSeq(std::pair<const Short*, const Short*>&) = 0; + ICE_DEPRECATED_API virtual Int* readIntSeq(std::pair<const Int*, const Int*>&) = 0; + ICE_DEPRECATED_API virtual Long* readLongSeq(std::pair<const Long*, const Long*>&) = 0; + ICE_DEPRECATED_API virtual Float* readFloatSeq(std::pair<const Float*, const Float*>&) = 0; + ICE_DEPRECATED_API virtual Double* readDoubleSeq(std::pair<const Double*, const Double*>&) = 0; + + virtual Int readSize() = 0; + virtual Int readAndCheckSeqSize(int) = 0; + + virtual ObjectPrx readProxy() = 0; + virtual void readObject(const ReadObjectCallbackPtr&) = 0; virtual ::std::string readTypeId() = 0; - virtual void throwException() = 0; virtual void startSlice() = 0; @@ -433,73 +323,30 @@ public: virtual void readPendingObjects() = 0; virtual void rewind() = 0; - -#if defined(_MSC_VER) && (_MSC_VER < 1300) // COMPILERBUG -// -// VC++ 6 compiler bugs doesn't allow using templates for the Stream API. -// -// see: http://support.microsoft.com/kb/240866 -// http://support.microsoft.com/kb/241569 -// -#else - inline void - read(bool& v) - { - v = internalReadBool(); - } - - inline void - read(::Ice::Byte& v) - { - v = internalReadByte(); - } - - inline void - read(::Ice::Short& v) - { - v = internalReadShort(); - } - - inline void - read(Ice::Int& v) - { - v = internalReadInt(); - } - - inline void - read(Ice::Long& v) - { - v = internalReadLong(); - } - - inline void - read(Ice::Float& v) - { - v = internalReadFloat(); - } - - inline void - read(Ice::Double& v) - { - v = internalReadDouble(); - } - - inline void - read(std::string& v, bool convert = true) - { - v = internalReadString(); - } - - inline void - read(std::wstring& v) - { - v = internalReadWstring(); - } - + + virtual void read(bool&) = 0; + virtual void read(Byte&) = 0; + virtual void read(Short&) = 0; + virtual void read(Int&) = 0; + virtual void read(Long&) = 0; + virtual void read(Float&) = 0; + virtual void read(Double&) = 0; + virtual void read(std::string&, bool = true) = 0; + virtual void read(std::vector<std::string>&, bool) = 0; + virtual void read(std::wstring&) = 0; + + virtual void read(std::pair<const bool*, const bool*>&, ::IceUtil::ScopedArray<bool>&) = 0; + virtual void read(std::pair<const Byte*, const Byte*>&) = 0; + virtual void read(std::pair<const Short*, const Short*>&, ::IceUtil::ScopedArray<Short>&) = 0; + virtual void read(std::pair<const Int*, const Int*>&, ::IceUtil::ScopedArray<Int>&) = 0; + virtual void read(std::pair<const Long*, const Long*>&, ::IceUtil::ScopedArray<Long>&) = 0; + virtual void read(std::pair<const Float*, const Float*>&, ::IceUtil::ScopedArray<Float>&) = 0; + virtual void read(std::pair<const Double*, const Double*>&, ::IceUtil::ScopedArray<Double>&) = 0; + template<typename T> inline void read(::IceInternal::ProxyHandle<T>& v) { - ::Ice::ObjectPrx proxy = internalReadProxy(); + ObjectPrx proxy = readProxy(); if(!proxy) { v = 0; @@ -514,202 +361,66 @@ public: template<typename T> inline void read(::IceInternal::Handle<T>& v) { - ::Ice::ReadObjectCallbackPtr cb = new ::Ice::ReadObjectCallbackI(&__patch__Ptr< T>, &v); + ReadObjectCallbackPtr cb = new ReadObjectCallbackI<T>(v); readObject(cb); } +// +// COMPILERFIX: VC++ 6 compiler bugs doesn't allow using templates for +// the Stream API. +// +// see: http://support.microsoft.com/kb/240866 +// http://support.microsoft.com/kb/241569 +// +#if !defined(_MSC_VER) || (_MSC_VER >= 1300) template<typename T> inline void read(T& v) { - StreamReader< ::Ice::StreamTrait<T>::type>::read(this, v); + StreamReader< StreamTrait<T>::type>::read(this, v); } #endif -protected: - - virtual bool internalReadBool() = 0; - virtual ::Ice::Byte internalReadByte() = 0; - virtual ::Ice::Short internalReadShort() = 0; - virtual ::Ice::Int internalReadInt() = 0; - virtual ::Ice::Long internalReadLong() = 0; - virtual ::Ice::Float internalReadFloat() = 0; - virtual ::Ice::Double internalReadDouble() = 0; - virtual ::std::string internalReadString(bool = true) = 0; - virtual ::std::wstring internalReadWstring() = 0; - virtual ::Ice::ObjectPrx internalReadProxy() = 0; - - // - // Remove these methods when the old Stream api, is removed. - // - virtual std::vector< bool > internalReadBoolSeq() = 0; - virtual bool* internalReadBoolSeq(std::pair<const bool*, const bool*>&) = 0; - - virtual std::vector< Ice::Byte > internalReadByteSeq() = 0; - virtual void internalReadByteSeq(std::pair<const Ice::Byte*, const Ice::Byte*>&) = 0; - - virtual std::vector< Ice::Short > internalReadShortSeq() = 0; - virtual Ice::Short* internalReadShortSeq(std::pair<const Ice::Short*, const Ice::Short*>&) = 0; - - virtual std::vector< Ice::Int > internalReadIntSeq() = 0; - virtual Ice::Int* internalReadIntSeq(std::pair<const Ice::Int*, const Ice::Int*>&) = 0; - - virtual std::vector< Ice::Long > internalReadLongSeq() = 0; - virtual Ice::Long* internalReadLongSeq(std::pair<const Ice::Long*, const Ice::Long*>&) = 0; - - virtual std::vector< Ice::Float > internalReadFloatSeq() = 0; - virtual Ice::Float* internalReadFloatSeq(std::pair<const Ice::Float*, const Ice::Float*>&) = 0; - - virtual std::vector< Ice::Double > internalReadDoubleSeq() = 0; - virtual Ice::Double* internalReadDoubleSeq(std::pair<const Ice::Double*, const Ice::Double*>&) = 0; - - virtual std::vector< std::string > internalReadStringSeq(bool = true) = 0; - - virtual std::vector< std::wstring > internalReadWstringSeq() = 0; }; class ICE_API OutputStream : public ::IceUtil::Shared { public: - virtual Ice::CommunicatorPtr communicator() const = 0; - - ICE_DEPRECATED_API virtual void writeBool(bool v) - { - internalWriteBool(v); - } - - ICE_DEPRECATED_API virtual void writeBoolSeq(const ::std::vector< bool >& v) - { - internalWriteBoolSeq(v); - } - - ICE_DEPRECATED_API virtual void writeBoolSeq(const bool* begin, const bool* end) - { - internalWriteBoolSeq(begin, end); - } - - ICE_DEPRECATED_API virtual void writeByte(::Ice::Byte v) - { - internalWriteByte(v); - } - - ICE_DEPRECATED_API virtual void writeByteSeq(const ::std::vector< ::Ice::Byte >& v) - { - internalWriteByteSeq(v); - } - - ICE_DEPRECATED_API virtual void writeByteSeq(const Ice::Byte* begin, const Ice::Byte* end) - { - internalWriteByteSeq(begin, end); - } - - ICE_DEPRECATED_API virtual void writeShort(::Ice::Short v) - { - internalWriteShort(v); - } - - ICE_DEPRECATED_API virtual void writeShortSeq(const ::std::vector< ::Ice::Short >& v) - { - internalWriteShortSeq(v); - } - - ICE_DEPRECATED_API virtual void writeShortSeq(const Ice::Short* begin, const Ice::Short* end) - { - internalWriteShortSeq(begin, end); - } - - ICE_DEPRECATED_API virtual void writeInt(::Ice::Int v) - { - internalWriteInt(v); - } - - ICE_DEPRECATED_API virtual void writeIntSeq(const ::std::vector< ::Ice::Int >& v) - { - internalWriteIntSeq(v); - } - - ICE_DEPRECATED_API virtual void writeIntSeq(const Ice::Int* begin, const Ice::Int* end) - { - internalWriteIntSeq(begin, end); - } - - ICE_DEPRECATED_API virtual void writeLong(::Ice::Long v) - { - internalWriteLong(v); - } - - ICE_DEPRECATED_API virtual void writeLongSeq(const ::std::vector< ::Ice::Long >& v) - { - internalWriteLongSeq(v); - } - - ICE_DEPRECATED_API virtual void writeLongSeq(const Ice::Long* begin, const Ice::Long* end) - { - internalWriteLongSeq(begin, end); - } - - ICE_DEPRECATED_API virtual void writeFloat(::Ice::Float v) - { - internalWriteFloat(v); - } - - ICE_DEPRECATED_API virtual void writeFloatSeq(const ::std::vector< ::Ice::Float >& v) - { - internalWriteFloatSeq(v); - } - - ICE_DEPRECATED_API virtual void writeFloatSeq(const Ice::Float* begin, const Ice::Float* end) - { - internalWriteFloatSeq(begin, end); - } - - ICE_DEPRECATED_API virtual void writeDouble(::Ice::Double v) - { - internalWriteDouble(v); - } - - ICE_DEPRECATED_API virtual void writeDoubleSeq(const ::std::vector< ::Ice::Double >& v) - { - internalWriteDoubleSeq(v); - } - - ICE_DEPRECATED_API virtual void writeDoubleSeq(const Ice::Double* begin, const Ice::Double* end) - { - internalWriteDoubleSeq(begin, end); - } - - ICE_DEPRECATED_API virtual void writeString(const ::std::string& v, bool convert = true) - { - internalWriteString(v, convert); - } - - ICE_DEPRECATED_API virtual void writeStringSeq(const ::std::vector< ::std::string >& v, bool convert = true) - { - internalWriteStringSeq(v, convert); - } - - ICE_DEPRECATED_API virtual void writeWstring(const ::std::wstring& v) - { - internalWriteWstring(v); - } - - ICE_DEPRECATED_API virtual void writeWstringSeq(const ::std::vector< ::std::wstring >& v) - { - internalWriteWstringSeq(v); - } - - virtual void writeSize(::Ice::Int) = 0; - - ICE_DEPRECATED_API virtual void writeProxy(const ::Ice::ObjectPrx& v) - { - internalWriteProxy(v); - } - - virtual void writeObject(const ::Ice::ObjectPtr& v) = 0; - + virtual CommunicatorPtr communicator() const = 0; + + ICE_DEPRECATED_API virtual void writeBool(bool v) = 0; + ICE_DEPRECATED_API virtual void writeByte(Byte v) = 0; + ICE_DEPRECATED_API virtual void writeShort(Short v) = 0; + ICE_DEPRECATED_API virtual void writeInt(Int v) = 0; + ICE_DEPRECATED_API virtual void writeLong(Long v) = 0; + ICE_DEPRECATED_API virtual void writeFloat(Float v) = 0; + ICE_DEPRECATED_API virtual void writeDouble(Double v) = 0; + ICE_DEPRECATED_API virtual void writeString(const ::std::string& v, bool convert = true) = 0; + ICE_DEPRECATED_API virtual void writeWstring(const ::std::wstring& v)= 0; + + ICE_DEPRECATED_API virtual void writeBoolSeq(const ::std::vector< bool >& v) = 0; + ICE_DEPRECATED_API virtual void writeByteSeq(const ::std::vector< Byte >& v) = 0; + ICE_DEPRECATED_API virtual void writeShortSeq(const ::std::vector< Short >& v) = 0; + ICE_DEPRECATED_API virtual void writeIntSeq(const ::std::vector< Int >& v) = 0; + ICE_DEPRECATED_API virtual void writeLongSeq(const ::std::vector< Long >& v) = 0; + ICE_DEPRECATED_API virtual void writeFloatSeq(const ::std::vector< Float >& v) = 0; + ICE_DEPRECATED_API virtual void writeDoubleSeq(const ::std::vector< Double >& v) = 0; + ICE_DEPRECATED_API virtual void writeStringSeq(const ::std::vector< ::std::string >& v, bool convert = true) = 0; + ICE_DEPRECATED_API virtual void writeWstringSeq(const ::std::vector< ::std::wstring >& v) = 0; + + ICE_DEPRECATED_API virtual void writeBoolSeq(const bool* begin, const bool* end) = 0; + ICE_DEPRECATED_API virtual void writeByteSeq(const Byte* begin, const Byte* end) = 0; + ICE_DEPRECATED_API virtual void writeShortSeq(const Short* begin, const Short* end) = 0; + ICE_DEPRECATED_API virtual void writeIntSeq(const Int* begin, const Int* end) = 0; + ICE_DEPRECATED_API virtual void writeLongSeq(const Long* begin, const Long* end) = 0; + ICE_DEPRECATED_API virtual void writeFloatSeq(const Float* begin, const Float* end) = 0; + ICE_DEPRECATED_API virtual void writeDoubleSeq(const Double* begin, const Double* end) = 0; + + virtual void writeSize(Int) = 0; + virtual void writeProxy(const ObjectPrx& v) = 0; + virtual void writeObject(const ObjectPtr& v) = 0; virtual void writeTypeId(const ::std::string&) = 0; - - virtual void writeException(const ::Ice::UserException& v) = 0; + virtual void writeException(const UserException& v) = 0; virtual void startSlice() = 0; virtual void endSlice() = 0; @@ -719,82 +430,34 @@ public: virtual void writePendingObjects() = 0; - virtual void finished(::std::vector< ::Ice::Byte >&) = 0; + virtual void finished(::std::vector< Byte >&) = 0; virtual void reset(bool) = 0; - -#if defined(_MSC_VER) && (_MSC_VER < 1300) // COMPILERBUG -// -// VC++ 6 compiler bugs doesn't allow using templates for the Stream API. -// -// see: http://support.microsoft.com/kb/240866 -// http://support.microsoft.com/kb/241569 -// -#else - inline void - write(bool v) - { - internalWriteBool(v); - } - - inline void - write(::Ice::Byte v) - { - internalWriteByte(v); - } - - inline void - write(::Ice::Short v) - { - internalWriteShort(v); - } - - inline void - write(::Ice::Int v) - { - internalWriteInt(v); - } - - inline void - write(::Ice::Long v) - { - internalWriteLong(v); - } - - inline void - write(::Ice::Float v) - { - internalWriteFloat(v); - } - - inline void - write(::Ice::Double v) - { - internalWriteDouble(v); - } - - inline void - write(const std::string& v) - { - internalWriteString(v); - } - inline void - write(const char* v) - { - internalWriteString(v); - } - - inline void - write(const std::wstring& v) - { - internalWriteWstring(v); - } - + virtual void write(bool v) = 0; + virtual void write(Byte) = 0; + virtual void write(Short) = 0; + virtual void write(Int) = 0; + virtual void write(Long) = 0; + virtual void write(Float) = 0; + virtual void write(Double) = 0; + virtual void write(const std::string&, bool = true) = 0; + virtual void write(const std::vector<std::string>&, bool) = 0; + virtual void write(const char* v, bool = true) = 0; + virtual void write(const std::wstring& v) = 0; + + virtual void write(const bool* begin, const bool* end) = 0; + virtual void write(const Byte* begin, const Byte* end) = 0; + virtual void write(const Short* begin, const Short* end) = 0; + virtual void write(const Int* begin, const Int* end) = 0; + virtual void write(const Long* begin, const Long* end) = 0; + virtual void write(const Float* begin, const Float* end) = 0; + virtual void write(const Double* begin, const Double* end) = 0; + template<typename T> inline void write(const ::IceInternal::ProxyHandle<T>& v) { - internalWriteProxy(v); + writeProxy(v); } template<typename T> inline void @@ -803,68 +466,39 @@ public: writeObject(v); } + +// +// COMPILERFIX: VC++ 6 compiler bugs doesn't allow using templates for +// the Stream API. +// +// see: http://support.microsoft.com/kb/240866 +// http://support.microsoft.com/kb/241569 +// +#if !defined(_MSC_VER) || (_MSC_VER >= 1300) template<typename T> inline void write(const T& v) { - StreamWriter< ::Ice::StreamTrait<T>::type>::write(this, v); - } + StreamWriter< StreamTrait<T>::type>::write(this, v); + } #endif protected: - - virtual void internalWriteBool(bool) = 0; - virtual void internalWriteByte(::Ice::Byte) = 0; - virtual void internalWriteShort(::Ice::Short) = 0; - virtual void internalWriteInt(::Ice::Int) = 0; - virtual void internalWriteLong(::Ice::Long) = 0; - virtual void internalWriteFloat(::Ice::Float) = 0; - virtual void internalWriteDouble(::Ice::Double) = 0; - virtual void internalWriteString(const ::std::string&, bool = true) = 0; - virtual void internalWriteWstring(const ::std::wstring&) = 0; - virtual void internalWriteProxy(const ::Ice::ObjectPrx&) = 0; - // - // Remove these methods when the old Stream api, is removed. - // - virtual void internalWriteBoolSeq(const std::vector< bool >&) = 0; - virtual void internalWriteBoolSeq(const bool*, const bool*) = 0; - - virtual void internalWriteByteSeq(const std::vector< Ice::Byte >&) = 0; - virtual void internalWriteByteSeq(const Ice::Byte*, const Ice::Byte*) = 0; - - virtual void internalWriteShortSeq(const std::vector< Ice::Short >&) = 0; - virtual void internalWriteShortSeq(const Ice::Short*, const Ice::Short*) = 0; - - virtual void internalWriteIntSeq(const std::vector< Ice::Int >&) = 0; - virtual void internalWriteIntSeq(const Ice::Int*, const Ice::Int*) = 0; - - virtual void internalWriteLongSeq(const std::vector< Ice::Long >&) = 0; - virtual void internalWriteLongSeq(const Ice::Long*, const Ice::Long*) = 0; - - virtual void internalWriteFloatSeq(const std::vector< Ice::Float >&) = 0; - virtual void internalWriteFloatSeq(const Ice::Float*, const Ice::Float*) = 0; - - virtual void internalWriteDoubleSeq(const std::vector< Ice::Double >&) = 0; - virtual void internalWriteDoubleSeq(const Ice::Double*, const Ice::Double*) = 0; - - virtual void internalWriteStringSeq(const std::vector< std::string >&, bool = true) = 0; - - virtual void internalWriteWstringSeq(const std::vector< std::wstring >&) = 0; }; -#if defined(_MSC_VER) && (_MSC_VER < 1300) // COMPILERBUG // -// VC++ 6 compiler bugs doesn't allow using templates for the Stream API. +// COMPILERFIX: VC++ 6 compiler bugs doesn't allow using templates for +// the Stream API. // // see: http://support.microsoft.com/kb/240866 // http://support.microsoft.com/kb/241569 // -#else +#if !defined(_MSC_VER) || (_MSC_VER >= 1300) template<> // StreamWriter specialization for structs struct StreamWriter<StreamTraitTypeStruct> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { v.ice_write(outS); } @@ -874,7 +508,7 @@ template<> // StreamReader specialization for structs struct StreamReader<StreamTraitTypeStruct> { template<typename T> - static void read(const ::Ice::InputStreamPtr& inS, T& v) + static void read(const InputStreamPtr& inS, T& v) { v.ice_read(inS); } @@ -884,7 +518,7 @@ template<> // StreamWriter specialization for structs with cpp:class metadata struct StreamWriter<StreamTraitTypeStructClass> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { v->ice_write(outS); } @@ -894,7 +528,7 @@ template<> // StreamReader specialization for structs with cpp:class metadata struct StreamReader<StreamTraitTypeStructClass> { template<typename T> - static void read(const ::Ice::InputStreamPtr& inS, const T& v) + static void read(const InputStreamPtr& inS, const T& v) { v->ice_read(inS); } @@ -904,13 +538,13 @@ template<> // StreamWriter specialization for byte enums struct StreamWriter<StreamTraitTypeByteEnum> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { - if(static_cast<int>(v) < 0 || static_cast<int>(v) >= ::Ice::StreamTrait<T>::enumLimit) + if(static_cast<int>(v) < 0 || static_cast<int>(v) >= StreamTrait<T>::enumLimit) { - throw ::Ice::MarshalException(__FILE__, __LINE__, "enumerator out of range"); + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); } - outS->write(static_cast< ::Ice::Byte>(v)); + outS->write(static_cast< Byte>(v)); } }; @@ -918,13 +552,13 @@ template<> // StreamReader specialization for byte enums struct StreamReader<StreamTraitTypeByteEnum> { template<typename T> - static void read(const ::Ice::InputStreamPtr& inS, T& v) + static void read(const InputStreamPtr& inS, T& v) { - ::Ice::Byte val; + Byte val; inS->read(val); - if(val > ::Ice::StreamTrait<T>::enumLimit) + if(val > StreamTrait<T>::enumLimit) { - throw ::Ice::MarshalException(__FILE__, __LINE__, "enumerator out of range"); + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); } v = static_cast<T>(val); } @@ -935,13 +569,13 @@ template<> // StreamWriter specialization for short enums struct StreamWriter<StreamTraitTypeShortEnum> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { - if(static_cast<int>(v) < 0 || static_cast<int>(v) >= ::Ice::StreamTrait<T>::enumLimit) + if(static_cast<int>(v) < 0 || static_cast<int>(v) >= StreamTrait<T>::enumLimit) { - throw ::Ice::MarshalException(__FILE__, __LINE__, "enumerator out of range"); + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); } - outS->write(static_cast< ::Ice::Short>(v)); + outS->write(static_cast< Short>(v)); } }; @@ -949,13 +583,13 @@ template<> // StreamReader specialization for short enums struct StreamReader<StreamTraitTypeShortEnum> { template<typename T> - static void read(const ::Ice::InputStreamPtr& inS, T& v) + static void read(const InputStreamPtr& inS, T& v) { - ::Ice::Short val; + Short val; inS->read(val); - if(val < 0 || val > ::Ice::StreamTrait<T>::enumLimit) + if(val < 0 || val > StreamTrait<T>::enumLimit) { - throw ::Ice::MarshalException(__FILE__, __LINE__, "enumerator out of range"); + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); } v = static_cast<T>(val); } @@ -965,13 +599,13 @@ template<> // StreamWriter specialization for int enums struct StreamWriter<StreamTraitTypeIntEnum> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { - if(static_cast<int>(v) < 0 || static_cast<int>(v) >= ::Ice::StreamTrait<T>::enumLimit) + if(static_cast<int>(v) < 0 || static_cast<int>(v) >= StreamTrait<T>::enumLimit) { - throw ::Ice::MarshalException(__FILE__, __LINE__, "enumerator out of range"); + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); } - outS->write(static_cast< ::Ice::Int>(v)); + outS->write(static_cast< Int>(v)); } }; @@ -979,13 +613,13 @@ template<> // StreamReader specialization for int enums struct StreamReader<StreamTraitTypeIntEnum> { template<typename T> - static void read(const ::Ice::InputStreamPtr& inS, T& v) + static void read(const InputStreamPtr& inS, T& v) { - ::Ice::Int val; + Int val; inS->read(val); - if(val < 0 || val > ::Ice::StreamTrait<T>::enumLimit) + if(val < 0 || val > StreamTrait<T>::enumLimit) { - throw ::Ice::MarshalException(__FILE__, __LINE__, "enumerator out of range"); + throw MarshalException(__FILE__, __LINE__, "enumerator out of range"); } v = static_cast<T>(val); } @@ -995,13 +629,12 @@ template<> // StreamWriter specialization for sequences struct StreamWriter<StreamTraitTypeSequence> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { - outS->writeSize(static_cast< ::Ice::Int>(v.size())); - typename T::const_iterator p; - for(p = v.begin(); p != v.end(); ++p) + outS->writeSize(static_cast< Int>(v.size())); + for(typename T::const_iterator p = v.begin(); p != v.end(); ++p) { - outS->write((*p)); + outS->write(*p); } } }; @@ -1010,33 +643,28 @@ template<> // StreamReader specialization for sequences struct StreamReader<StreamTraitTypeSequence> { template<typename T> - static void read(const ::Ice::InputStreamPtr& inS, T& v) + static void read(const InputStreamPtr& inS, T& v) { - ::Ice::Int sz = inS->readAndCheckSeqSize(::Ice::StreamTrait<typename T::value_type>::minWireSize); + Int sz = inS->readAndCheckSeqSize(StreamTrait<typename T::value_type>::minWireSize); v.resize(sz); - for(int i = 0; i < sz; ++i) + for(typename T::iterator p = v.begin(); p != v.end(); ++p) { - inS->read(v[i]); + inS->read(*p); } } }; -// -// BCC2010 compiler bugs doesn't allow use full specialization over partial specialization. -// -# ifndef __BCPLUSPLUS__ - +#ifndef __BCPLUSPLUS__ // COMPILERFIX: See StreamTrait<vector<bool>> comment above template<> // StreamWriter specialization for sequences of bool struct StreamWriter<StreamTraitTypeSequenceBool> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { - outS->writeSize(static_cast< ::Ice::Int>(v.size())); - typename T::const_iterator p; - for(p = v.begin(); p != v.end(); ++p) + outS->writeSize(static_cast< Int>(v.size())); + for(typename T::const_iterator p = v.begin(); p != v.end(); ++p) { - outS->write((*p)); + outS->write(*p); } } }; @@ -1045,28 +673,31 @@ template<> // Reader specialization for sequences of bool struct StreamReader<StreamTraitTypeSequenceBool> { template<typename T> - static void read(const ::Ice::InputStreamPtr& inS, T& v) + static void read(const InputStreamPtr& inS, T& v) { - ::Ice::Int sz = inS->readAndCheckSeqSize(::Ice::StreamTrait<bool>::minWireSize); + Int sz = inS->readAndCheckSeqSize(StreamTrait<bool>::minWireSize); v.resize(sz); - for(int i = 0; i < sz; ++i) + for(typename T::iterator p = v.begin(); p != v.end(); ++p) { + // + // We can't just call inS->read(*p) here because *p is + // a compiler dependent bit reference. + // bool b; inS->read(b); - v[i] = b; + *p = b; } } }; - -# endif +#endif template<> // StreamWriter specialization for dictionaries. struct StreamWriter<StreamTraitTypeDictionary> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { - outS->writeSize(static_cast< ::Ice::Int>(v.size())); + outS->writeSize(static_cast< Int>(v.size())); typename T::const_iterator p; for(p = v.begin(); p != v.end(); ++p) { @@ -1080,9 +711,9 @@ template<> // StreamReader specialization for dictionaries. struct StreamReader<StreamTraitTypeDictionary> { template<typename T> - static void read(const ::Ice::InputStreamPtr& inS, T& v) + static void read(const InputStreamPtr& inS, T& v) { - ::Ice::Int sz = inS->readSize(); + Int sz = inS->readSize(); while(sz--) { typename T::value_type p; @@ -1097,7 +728,7 @@ template<> // StreamWriter specialization for UserExceptions. struct StreamWriter<StreamTraitTypeUserException> { template<typename T> - static void write(const ::Ice::OutputStreamPtr& outS, const T& v) + static void write(const OutputStreamPtr& outS, const T& v) { outS->writeException(v); } @@ -1105,7 +736,7 @@ struct StreamWriter<StreamTraitTypeUserException> #endif -class ICE_API ObjectReader : public ::Ice::Object +class ICE_API ObjectReader : public Object { public: @@ -1116,12 +747,12 @@ private: virtual void __write(::IceInternal::BasicStream*) const; virtual void __read(::IceInternal::BasicStream*, bool = true); - virtual void __write(const ::Ice::OutputStreamPtr&) const; - virtual void __read(const ::Ice::InputStreamPtr&, bool); + virtual void __write(const OutputStreamPtr&) const; + virtual void __read(const InputStreamPtr&, bool); }; typedef ::IceInternal::Handle< ObjectReader > ObjectReaderPtr; -class ICE_API ObjectWriter : public ::Ice::Object +class ICE_API ObjectWriter : public Object { public: @@ -1132,8 +763,8 @@ private: virtual void __write(::IceInternal::BasicStream*) const; virtual void __read(::IceInternal::BasicStream*, bool = true); - virtual void __write(const ::Ice::OutputStreamPtr&) const; - virtual void __read(const ::Ice::InputStreamPtr&, bool); + virtual void __write(const OutputStreamPtr&) const; + virtual void __read(const InputStreamPtr&, bool); }; typedef ::IceInternal::Handle< ObjectWriter > ObjectWriterPtr; @@ -1142,14 +773,14 @@ class ICE_API UserExceptionWriter : public UserException { public: - UserExceptionWriter(const Ice::CommunicatorPtr&); + UserExceptionWriter(const CommunicatorPtr&); ~UserExceptionWriter() throw(); virtual void write(const OutputStreamPtr&) const = 0; virtual bool usesClasses() const = 0; virtual std::string ice_name() const = 0; - virtual Ice::Exception* ice_clone() const = 0; + virtual Exception* ice_clone() const = 0; virtual void ice_throw() const = 0; virtual void __write(IceInternal::BasicStream*) const; @@ -1159,7 +790,7 @@ public: protected: - Ice::CommunicatorPtr _communicator; + const CommunicatorPtr _communicator; }; } diff --git a/cpp/include/IceUtil/ScopedArray.h b/cpp/include/IceUtil/ScopedArray.h index 6836799f04b..c2c15bd7409 100644 --- a/cpp/include/IceUtil/ScopedArray.h +++ b/cpp/include/IceUtil/ScopedArray.h @@ -12,7 +12,7 @@ #include <IceUtil/Config.h> -namespace IceUtilInternal +namespace IceUtil { template<typename T> diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp index 8afd1df630d..dff3c8394d6 100644 --- a/cpp/src/Ice/Initialize.cpp +++ b/cpp/src/Ice/Initialize.cpp @@ -7,6 +7,14 @@ // // ********************************************************************** +// +// We disable deprecation warning here, to allow clean compilation of +// of deprecated methods from StreamI.h. +// +#ifdef _MSC_VER +# pragma warning( disable : 4996 ) +#endif + #include <IceUtil/DisableWarnings.h> #include <IceUtil/ArgVector.h> #include <Ice/GC.h> diff --git a/cpp/src/Ice/Stream.cpp b/cpp/src/Ice/Stream.cpp index 20825a9aeab..ec2d636d901 100644 --- a/cpp/src/Ice/Stream.cpp +++ b/cpp/src/Ice/Stream.cpp @@ -15,14 +15,3 @@ using namespace IceInternal; IceUtil::Shared* IceInternal::upCast(InputStream* p) { return p; } IceUtil::Shared* IceInternal::upCast(OutputStream* p) { return p; } - -Ice::ReadObjectCallbackI::ReadObjectCallbackI(PatchFunc func, void* arg) : - _func(func), _arg(arg) -{ -} - -void -Ice::ReadObjectCallbackI::invoke(const ::Ice::ObjectPtr& p) -{ - _func(_arg, const_cast< ::Ice::ObjectPtr& >(p)); -} diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp index 2189deed602..c9a1dbe5b24 100644 --- a/cpp/src/Ice/StreamI.cpp +++ b/cpp/src/Ice/StreamI.cpp @@ -7,6 +7,14 @@ // // ********************************************************************** +// +// We disable deprecation warning here, to allow clean compilation of +// of deprecated methods. +// +#ifdef _MSC_VER +# pragma warning( disable : 4996 ) +#endif + #include <Ice/StreamI.h> #include <Ice/Initialize.h> #include <Ice/LocalException.h> @@ -54,7 +62,7 @@ Ice::InputStreamI::sliceObjects(bool b) } bool -Ice::InputStreamI::internalReadBool() +Ice::InputStreamI::readBool() { bool v; _is->read(v); @@ -62,7 +70,7 @@ Ice::InputStreamI::internalReadBool() } vector<bool> -Ice::InputStreamI::internalReadBoolSeq() +Ice::InputStreamI::readBoolSeq() { vector<bool> v; _is->read(v); @@ -70,13 +78,13 @@ Ice::InputStreamI::internalReadBoolSeq() } bool* -Ice::InputStreamI::internalReadBoolSeq(pair<const bool*, const bool*>& p) +Ice::InputStreamI::readBoolSeq(pair<const bool*, const bool*>& p) { return _is->read(p); } Byte -Ice::InputStreamI::internalReadByte() +Ice::InputStreamI::readByte() { Byte v; _is->read(v); @@ -84,7 +92,7 @@ Ice::InputStreamI::internalReadByte() } vector<Byte> -Ice::InputStreamI::internalReadByteSeq() +Ice::InputStreamI::readByteSeq() { pair<const Byte*, const Byte*> p; _is->read(p); @@ -93,13 +101,13 @@ Ice::InputStreamI::internalReadByteSeq() } void -Ice::InputStreamI::internalReadByteSeq(pair<const Byte*, const Byte*>& p) +Ice::InputStreamI::readByteSeq(pair<const Byte*, const Byte*>& p) { _is->read(p); } Short -Ice::InputStreamI::internalReadShort() +Ice::InputStreamI::readShort() { Short v; _is->read(v); @@ -107,7 +115,7 @@ Ice::InputStreamI::internalReadShort() } vector<Short> -Ice::InputStreamI::internalReadShortSeq() +Ice::InputStreamI::readShortSeq() { vector<Short> v; _is->read(v); @@ -115,13 +123,13 @@ Ice::InputStreamI::internalReadShortSeq() } Short* -Ice::InputStreamI::internalReadShortSeq(pair<const Short*, const Short*>& p) +Ice::InputStreamI::readShortSeq(pair<const Short*, const Short*>& p) { return _is->read(p); } Int -Ice::InputStreamI::internalReadInt() +Ice::InputStreamI::readInt() { Int v; _is->read(v); @@ -129,7 +137,7 @@ Ice::InputStreamI::internalReadInt() } vector<Int> -Ice::InputStreamI::internalReadIntSeq() +Ice::InputStreamI::readIntSeq() { vector<Int> v; _is->read(v); @@ -137,13 +145,13 @@ Ice::InputStreamI::internalReadIntSeq() } Int* -Ice::InputStreamI::internalReadIntSeq(pair<const Int*, const Int*>& p) +Ice::InputStreamI::readIntSeq(pair<const Int*, const Int*>& p) { return _is->read(p); } Long -Ice::InputStreamI::internalReadLong() +Ice::InputStreamI::readLong() { Long v; _is->read(v); @@ -151,7 +159,7 @@ Ice::InputStreamI::internalReadLong() } vector<Long> -Ice::InputStreamI::internalReadLongSeq() +Ice::InputStreamI::readLongSeq() { vector<Long> v; _is->read(v); @@ -159,13 +167,13 @@ Ice::InputStreamI::internalReadLongSeq() } Long* -Ice::InputStreamI::internalReadLongSeq(pair<const Long*, const Long*>& p) +Ice::InputStreamI::readLongSeq(pair<const Long*, const Long*>& p) { return _is->read(p); } Float -Ice::InputStreamI::internalReadFloat() +Ice::InputStreamI::readFloat() { Float v; _is->read(v); @@ -173,7 +181,7 @@ Ice::InputStreamI::internalReadFloat() } vector<Float> -Ice::InputStreamI::internalReadFloatSeq() +Ice::InputStreamI::readFloatSeq() { vector<Float> v; _is->read(v); @@ -181,13 +189,13 @@ Ice::InputStreamI::internalReadFloatSeq() } Float* -Ice::InputStreamI::internalReadFloatSeq(pair<const Float*, const Float*>& p) +Ice::InputStreamI::readFloatSeq(pair<const Float*, const Float*>& p) { return _is->read(p); } Double -Ice::InputStreamI::internalReadDouble() +Ice::InputStreamI::readDouble() { Double v; _is->read(v); @@ -195,7 +203,7 @@ Ice::InputStreamI::internalReadDouble() } vector<Double> -Ice::InputStreamI::internalReadDoubleSeq() +Ice::InputStreamI::readDoubleSeq() { vector<Double> v; _is->read(v); @@ -203,13 +211,13 @@ Ice::InputStreamI::internalReadDoubleSeq() } Double* -Ice::InputStreamI::internalReadDoubleSeq(pair<const Double*, const Double*>& p) +Ice::InputStreamI::readDoubleSeq(pair<const Double*, const Double*>& p) { return _is->read(p); } string -Ice::InputStreamI::internalReadString(bool convert) +Ice::InputStreamI::readString(bool convert) { string v; _is->read(v, convert); @@ -217,7 +225,7 @@ Ice::InputStreamI::internalReadString(bool convert) } vector<string> -Ice::InputStreamI::internalReadStringSeq(bool convert) +Ice::InputStreamI::readStringSeq(bool convert) { vector<string> v; _is->read(v, convert); @@ -225,7 +233,7 @@ Ice::InputStreamI::internalReadStringSeq(bool convert) } wstring -Ice::InputStreamI::internalReadWstring() +Ice::InputStreamI::readWstring() { wstring v; _is->read(v); @@ -233,7 +241,7 @@ Ice::InputStreamI::internalReadWstring() } vector<wstring> -Ice::InputStreamI::internalReadWstringSeq() +Ice::InputStreamI::readWstringSeq() { vector<wstring> v; _is->read(v); @@ -257,14 +265,17 @@ Ice::InputStreamI::readAndCheckSeqSize(int minSize) } ObjectPrx -Ice::InputStreamI::internalReadProxy() +Ice::InputStreamI::readProxy() { Ice::ObjectPrx v; _is->read(v); return v; } -static void +namespace +{ + +void patchObject(void* addr, ObjectPtr& v) { ReadObjectCallback* cb = static_cast<ReadObjectCallback*>(addr); @@ -272,6 +283,8 @@ patchObject(void* addr, ObjectPtr& v) cb->invoke(v); } +} + void Ice::InputStreamI::readObject(const ReadObjectCallbackPtr& cb) { @@ -288,6 +301,108 @@ Ice::InputStreamI::readTypeId() } void +Ice::InputStreamI::read(bool& v) +{ + _is->read(v); +} + +void +Ice::InputStreamI::read(::Ice::Byte& v) +{ + _is->read(v); +} + +void +Ice::InputStreamI::read(::Ice::Short& v) +{ + _is->read(v); +} + +void +Ice::InputStreamI::read(Ice::Int& v) +{ + _is->read(v); +} + +void +Ice::InputStreamI::read(Ice::Long& v) +{ + _is->read(v); +} + +void +Ice::InputStreamI::read(Ice::Float& v) +{ + _is->read(v); +} + +void +Ice::InputStreamI::read(Ice::Double& v) +{ + _is->read(v); +} + +void +Ice::InputStreamI::read(std::string& v, bool convert) +{ + _is->read(v, convert); +} + +void +Ice::InputStreamI::read(std::vector<std::string>& v, bool convert) +{ + _is->read(v, convert); +} + +void +Ice::InputStreamI::read(std::wstring& v) +{ + _is->read(v); +} + +void +Ice::InputStreamI::read(std::pair<const bool*, const bool*>& p, ::IceUtil::ScopedArray<bool>& result) +{ + result.reset(_is->read(p)); +} + +void +Ice::InputStreamI::read(std::pair<const Ice::Byte*, const Ice::Byte*>& p) +{ + _is->read(p); +} +void +Ice::InputStreamI::read(std::pair<const Ice::Short*, const Ice::Short*>& p, ::IceUtil::ScopedArray<Ice::Short>& result) +{ + result.reset(_is->read(p)); +} + +void +Ice::InputStreamI::read(std::pair<const Ice::Int*, const Ice::Int*>& p, ::IceUtil::ScopedArray<Ice::Int>& result) +{ + result.reset(_is->read(p)); +} + +void +Ice::InputStreamI::read(std::pair<const Ice::Long*, const Ice::Long*>& p, ::IceUtil::ScopedArray<Ice::Long>& result) +{ + result.reset(_is->read(p)); +} + +void +Ice::InputStreamI::read(std::pair<const Ice::Float*, const Ice::Float*>& p, ::IceUtil::ScopedArray<Ice::Float>& result) +{ + result.reset(_is->read(p)); +} + +void +Ice::InputStreamI::read(std::pair<const Ice::Double*, const Ice::Double*>& p, + ::IceUtil::ScopedArray<Ice::Double>& result) +{ + result.reset(_is->read(p)); +} + +void Ice::InputStreamI::throwException() { _is->throwException(); @@ -370,81 +485,96 @@ Ice::OutputStreamI::communicator() const } void -Ice::OutputStreamI::internalWriteBool(bool v) +Ice::OutputStreamI::writeObject(const ObjectPtr& v) { _os->write(v); } void -Ice::OutputStreamI::internalWriteBoolSeq(const vector<bool>& v) +Ice::OutputStreamI::writeException(const UserException& v) { _os->write(v); } void -Ice::OutputStreamI::internalWriteBoolSeq(const bool* begin, const bool* end) +Ice::OutputStreamI::writeProxy(const ObjectPrx& v) { - _os->write(begin, end); + _os->write(v); +} + +void +Ice::OutputStreamI::writeSize(Int sz) +{ + if(sz < 0) + { + throw MarshalException(__FILE__, __LINE__); + } + + _os->writeSize(sz); } void -Ice::OutputStreamI::internalWriteByte(Byte v) +Ice::OutputStreamI::writeTypeId(const string& id) +{ + _os->writeTypeId(id); +} + +void +Ice::OutputStreamI::write(bool v) { _os->write(v); } void -Ice::OutputStreamI::internalWriteByteSeq(const vector<Byte>& v) +Ice::OutputStreamI::write(Byte v) { - if(v.size() == 0) - { - _os->writeSize(0); - } - else - { - _os->write(&v[0], &v[0] + v.size()); - } + _os->write(v); } void -Ice::OutputStreamI::internalWriteByteSeq(const Byte* begin, const Byte* end) +Ice::OutputStreamI::write(Short v) { - _os->write(begin, end); + _os->write(v); } void -Ice::OutputStreamI::internalWriteShort(Short v) +Ice::OutputStreamI::write(Int v) { _os->write(v); } void -Ice::OutputStreamI::internalWriteShortSeq(const vector<Short>& v) +Ice::OutputStreamI::write(Long v) { - if(v.size() == 0) - { - _os->writeSize(0); - } - else - { - _os->write(&v[0], &v[0] + v.size()); - } + _os->write(v); } void -Ice::OutputStreamI::internalWriteShortSeq(const Short* begin, const Short* end) +Ice::OutputStreamI::write(Float v) { - _os->write(begin, end); + _os->write(v); } void -Ice::OutputStreamI::internalWriteInt(Int v) +Ice::OutputStreamI::write(Double v) { _os->write(v); } void -Ice::OutputStreamI::internalWriteIntSeq(const vector<Int>& v) +Ice::OutputStreamI::write(const string& v, bool convert) +{ + _os->write(v, convert); +} + +void +Ice::OutputStreamI::write(const char* v, bool convert) +{ + _os->write(v, convert); +} + +void +Ice::OutputStreamI::write(const vector<string>& v, bool convert) { if(v.size() == 0) { @@ -452,49 +582,131 @@ Ice::OutputStreamI::internalWriteIntSeq(const vector<Int>& v) } else { - _os->write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size(), convert); } } void -Ice::OutputStreamI::internalWriteIntSeq(const Int* begin, const Int* end) +Ice::OutputStreamI::write(const wstring& v) +{ + _os->write(v); +} + +void +Ice::OutputStreamI::write(const bool* begin, const bool* end) { _os->write(begin, end); } void -Ice::OutputStreamI::internalWriteLong(Long v) +Ice::OutputStreamI::write(const Byte* begin, const Byte* end) { - _os->write(v); + _os->write(begin, end); } void -Ice::OutputStreamI::internalWriteLongSeq(const vector<Long>& v) +Ice::OutputStreamI::write(const Int* begin, const Int* end) { - if(v.size() == 0) + _os->write(begin, end); +} + +void +Ice::OutputStreamI::write(const Long* begin, const Long* end) +{ + _os->write(begin, end); +} + +void +Ice::OutputStreamI::write(const Float* begin, const Float* end) +{ + _os->write(begin, end); +} + +void +Ice::OutputStreamI::write(const Double* begin, const Double* end) +{ + _os->write(begin, end); +} + +void +Ice::OutputStreamI::startSlice() +{ + _os->startWriteSlice(); +} + +void +Ice::OutputStreamI::endSlice() +{ + _os->endWriteSlice(); +} + +void +Ice::OutputStreamI::startEncapsulation() +{ + _os->startWriteEncaps(); +} + +void +Ice::OutputStreamI::endEncapsulation() +{ + _os->endWriteEncapsChecked(); +} + +void +Ice::OutputStreamI::writePendingObjects() +{ + _os->writePendingObjects(); +} + +void +Ice::OutputStreamI::finished(vector<Byte>& bytes) +{ + vector<Byte>(_os->b.begin(), _os->b.end()).swap(bytes); +} + +void +Ice::OutputStreamI::reset(bool clearBuffer) +{ + _os->clear(); + + if(clearBuffer) { - _os->writeSize(0); + _os->b.clear(); } else { - _os->write(&v[0], &v[0] + v.size()); + _os->b.reset(); } + + _os->i = _os->b.begin(); } void -Ice::OutputStreamI::internalWriteLongSeq(const Long* begin, const Long* end) +Ice::OutputStreamI::writeBool(bool v) { - _os->write(begin, end); + _os->write(v); } void -Ice::OutputStreamI::internalWriteFloat(Float v) +Ice::OutputStreamI::writeBoolSeq(const vector<bool>& v) { _os->write(v); } void -Ice::OutputStreamI::internalWriteFloatSeq(const vector<Float>& v) +Ice::OutputStreamI::writeBoolSeq(const bool* begin, const bool* end) +{ + write(begin, end); +} + +void +Ice::OutputStreamI::writeByte(Byte v) +{ + _os->write(v); +} + +void +Ice::OutputStreamI::writeByteSeq(const vector<Byte>& v) { if(v.size() == 0) { @@ -507,19 +719,19 @@ Ice::OutputStreamI::internalWriteFloatSeq(const vector<Float>& v) } void -Ice::OutputStreamI::internalWriteFloatSeq(const Float* begin, const Float* end) +Ice::OutputStreamI::writeByteSeq(const Ice::Byte* begin, const Ice::Byte* end) { - _os->write(begin, end); + write(begin, end); } void -Ice::OutputStreamI::internalWriteDouble(Double v) +Ice::OutputStreamI::writeShort(Short v) { _os->write(v); } void -Ice::OutputStreamI::internalWriteDoubleSeq(const vector<Double>& v) +Ice::OutputStreamI::writeShortSeq(const vector<Short>& v) { if(v.size() == 0) { @@ -532,19 +744,19 @@ Ice::OutputStreamI::internalWriteDoubleSeq(const vector<Double>& v) } void -Ice::OutputStreamI::internalWriteDoubleSeq(const Double* begin, const Double* end) +Ice::OutputStreamI::writeShortSeq(const Ice::Short* begin, const Ice::Short* end) { - _os->write(begin, end); + write(begin, end); } void -Ice::OutputStreamI::internalWriteString(const string& v, bool convert) +Ice::OutputStreamI::writeInt(Int v) { - _os->write(v, convert); + _os->write(v); } void -Ice::OutputStreamI::internalWriteStringSeq(const vector<string>& v, bool convert) +Ice::OutputStreamI::writeIntSeq(const vector<Int>& v) { if(v.size() == 0) { @@ -552,18 +764,24 @@ Ice::OutputStreamI::internalWriteStringSeq(const vector<string>& v, bool convert } else { - _os->write(&v[0], &v[0] + v.size(), convert); + _os->write(&v[0], &v[0] + v.size()); } } void -Ice::OutputStreamI::internalWriteWstring(const wstring& v) +Ice::OutputStreamI::writeIntSeq(const Ice::Int* begin, const Ice::Int* end) +{ + write(begin, end); +} + +void +Ice::OutputStreamI::writeLong(Long v) { _os->write(v); } void -Ice::OutputStreamI::internalWriteWstringSeq(const vector<wstring>& v) +Ice::OutputStreamI::writeLongSeq(const vector<Long>& v) { if(v.size() == 0) { @@ -576,92 +794,104 @@ Ice::OutputStreamI::internalWriteWstringSeq(const vector<wstring>& v) } void -Ice::OutputStreamI::writeSize(Int sz) +Ice::OutputStreamI::writeLongSeq(const Ice::Long* begin, const Ice::Long* end) { - if(sz < 0) - { - throw MarshalException(__FILE__, __LINE__); - } - - _os->writeSize(sz); + write(begin, end); } void -Ice::OutputStreamI::internalWriteProxy(const ObjectPrx& v) +Ice::OutputStreamI::writeFloat(Float v) { _os->write(v); } void -Ice::OutputStreamI::writeObject(const ObjectPtr& v) +Ice::OutputStreamI::writeFloatSeq(const vector<Float>& v) { - _os->write(v); + if(v.size() == 0) + { + _os->writeSize(0); + } + else + { + _os->write(&v[0], &v[0] + v.size()); + } } void -Ice::OutputStreamI::writeTypeId(const string& id) +Ice::OutputStreamI::writeFloatSeq(const Ice::Float* begin, const Ice::Float* end) { - _os->writeTypeId(id); + write(begin, end); } void -Ice::OutputStreamI::writeException(const UserException& v) +Ice::OutputStreamI::writeDouble(Double v) { _os->write(v); } void -Ice::OutputStreamI::startSlice() +Ice::OutputStreamI::writeDoubleSeq(const vector<Double>& v) { - _os->startWriteSlice(); + if(v.size() == 0) + { + _os->writeSize(0); + } + else + { + _os->write(&v[0], &v[0] + v.size()); + } } void -Ice::OutputStreamI::endSlice() +Ice::OutputStreamI::writeDoubleSeq(const Ice::Double* begin, const Ice::Double* end) { - _os->endWriteSlice(); + write(begin, end); } void -Ice::OutputStreamI::startEncapsulation() +Ice::OutputStreamI::write(const Short* begin, const Short* end) { - _os->startWriteEncaps(); + _os->write(begin, end); } void -Ice::OutputStreamI::endEncapsulation() +Ice::OutputStreamI::writeString(const string& v, bool convert) { - _os->endWriteEncapsChecked(); + _os->write(v, convert); } void -Ice::OutputStreamI::writePendingObjects() +Ice::OutputStreamI::writeStringSeq(const vector<string>& v, bool convert) { - _os->writePendingObjects(); + if(v.size() == 0) + { + _os->writeSize(0); + } + else + { + _os->write(&v[0], &v[0] + v.size(), convert); + } } void -Ice::OutputStreamI::finished(vector<Byte>& bytes) +Ice::OutputStreamI::writeWstring(const wstring& v) { - vector<Byte>(_os->b.begin(), _os->b.end()).swap(bytes); + _os->write(v); } void -Ice::OutputStreamI::reset(bool clearBuffer) +Ice::OutputStreamI::writeWstringSeq(const vector<wstring>& v) { - _os->clear(); - - if(clearBuffer) + if(v.size() == 0) { - _os->b.clear(); + _os->writeSize(0); } else { - _os->b.reset(); + _os->write(&v[0], &v[0] + v.size()); } - - _os->i = _os->b.begin(); -} +} // // ObjectReader diff --git a/cpp/src/Ice/StreamI.h b/cpp/src/Ice/StreamI.h index 4017c85d7d1..a39214885fc 100644 --- a/cpp/src/Ice/StreamI.h +++ b/cpp/src/Ice/StreamI.h @@ -11,7 +11,14 @@ #define ICE_STREAM_I_H #include <Ice/Stream.h> -#include <Ice/BasicStream.h> + +namespace IceInternal +{ + +// Forward declaration. +class BasicStream; + +}; namespace Ice { @@ -23,19 +30,56 @@ class InputStreamI : public InputStream { public: - InputStreamI(const Ice::CommunicatorPtr&, const std::vector< Ice::Byte >&); - InputStreamI(const Ice::CommunicatorPtr&, const std::pair< const Ice::Byte*, const Ice::Byte* >&); + InputStreamI(const CommunicatorPtr&, const std::vector< Byte >&); + InputStreamI(const CommunicatorPtr&, const std::pair< const Byte*, const Byte* >&); virtual ~InputStreamI(); - virtual Ice::CommunicatorPtr communicator() const; + virtual CommunicatorPtr communicator() const; virtual void sliceObjects(bool); - virtual Ice::Int readSize(); - virtual Ice::Int readAndCheckSeqSize(int); - - virtual void readObject(const Ice::ReadObjectCallbackPtr&); - + // + // These methods should be removed when the old stream API is removed. + // + virtual bool readBool(); + virtual Byte readByte(); + virtual Short readShort(); + virtual Int readInt(); + virtual Long readLong(); + virtual Float readFloat(); + virtual Double readDouble(); + virtual ::std::string readString(bool = true); + virtual ::std::wstring readWstring(); + + // + // These methods should be removed when the old stream API is removed. + // + virtual std::vector< bool > readBoolSeq(); + virtual std::vector< Byte > readByteSeq(); + virtual std::vector< Short > readShortSeq(); + virtual std::vector< Int > readIntSeq(); + virtual std::vector< Long > readLongSeq(); + virtual std::vector< Float > readFloatSeq(); + virtual std::vector< Double > readDoubleSeq(); + virtual std::vector< std::string > readStringSeq(bool = true); + virtual std::vector< std::wstring > readWstringSeq(); + + // + // These methods should be removed when the old stream API is removed. + // + virtual bool* readBoolSeq(std::pair<const bool*, const bool*>&); + virtual void readByteSeq(std::pair<const Byte*, const Byte*>&); + virtual Short* readShortSeq(std::pair<const Short*, const Short*>&); + virtual Int* readIntSeq(std::pair<const Int*, const Int*>&); + virtual Long* readLongSeq(std::pair<const Long*, const Long*>&); + virtual Float* readFloatSeq(std::pair<const Float*, const Float*>&); + virtual Double* readDoubleSeq(std::pair<const Double*, const Double*>&); + + virtual Int readSize(); + virtual Int readAndCheckSeqSize(int); + + virtual ObjectPrx readProxy(); + virtual void readObject(const ReadObjectCallbackPtr&); virtual std::string readTypeId(); virtual void throwException(); @@ -51,49 +95,28 @@ public: virtual void readPendingObjects(); virtual void rewind(); - -private: - - virtual bool internalReadBool(); - virtual ::Ice::Byte internalReadByte(); - virtual ::Ice::Short internalReadShort(); - virtual ::Ice::Int internalReadInt(); - virtual ::Ice::Long internalReadLong(); - virtual ::Ice::Float internalReadFloat(); - virtual ::Ice::Double internalReadDouble(); - virtual ::std::string internalReadString(bool = true); - virtual ::std::wstring internalReadWstring(); - virtual ::Ice::ObjectPrx internalReadProxy(); - // - // Remove these methods when the old Stream api, is removed. - // - virtual std::vector< bool > internalReadBoolSeq(); - virtual bool* internalReadBoolSeq(std::pair<const bool*, const bool*>&); - - virtual std::vector< Ice::Byte > internalReadByteSeq(); - virtual void internalReadByteSeq(std::pair<const Ice::Byte*, const Ice::Byte*>&); - - virtual std::vector< Ice::Short > internalReadShortSeq(); - virtual Ice::Short* internalReadShortSeq(std::pair<const Ice::Short*, const Ice::Short*>&); - - virtual std::vector< Ice::Int > internalReadIntSeq(); - virtual Ice::Int* internalReadIntSeq(std::pair<const Ice::Int*, const Ice::Int*>&); - - virtual std::vector< Ice::Long > internalReadLongSeq(); - virtual Ice::Long* internalReadLongSeq(std::pair<const Ice::Long*, const Ice::Long*>&); - - virtual std::vector< Ice::Float > internalReadFloatSeq(); - virtual Ice::Float* internalReadFloatSeq(std::pair<const Ice::Float*, const Ice::Float*>&); + virtual void read(bool& v); + virtual void read(Byte& v); + virtual void read(Short& v); + virtual void read(Int& v); + virtual void read(Long& v); + virtual void read(Float& v); + virtual void read(Double& v); + virtual void read(std::string& v, bool convert = true); + virtual void read(std::vector<std::string>&, bool); + virtual void read(std::wstring& v); + virtual void read(std::pair<const bool*, const bool*>&, ::IceUtil::ScopedArray<bool>&); + virtual void read(std::pair<const Byte*, const Byte*>&); + virtual void read(std::pair<const Short*, const Short*>&, ::IceUtil::ScopedArray<Short>&); + virtual void read(std::pair<const Int*, const Int*>&, ::IceUtil::ScopedArray<Int>&); + virtual void read(std::pair<const Long*, const Long*>&, ::IceUtil::ScopedArray<Long>&); + virtual void read(std::pair<const Float*, const Float*>&, ::IceUtil::ScopedArray<Float>&); + virtual void read(std::pair<const Double*, const Double*>&, ::IceUtil::ScopedArray<Double>&); - virtual std::vector< Ice::Double > internalReadDoubleSeq(); - virtual Ice::Double* internalReadDoubleSeq(std::pair<const Ice::Double*, const Ice::Double*>&); - - virtual std::vector< std::string > internalReadStringSeq(bool = true); - - virtual std::vector< std::wstring > internalReadWstringSeq(); +private: - Ice::CommunicatorPtr _communicator; + const CommunicatorPtr _communicator; IceInternal::BasicStream* _is; std::vector< ReadObjectCallbackPtr > _callbacks; }; @@ -105,18 +128,75 @@ class OutputStreamI : public OutputStream { public: - OutputStreamI(const Ice::CommunicatorPtr&, IceInternal::BasicStream* = 0); + OutputStreamI(const CommunicatorPtr&, IceInternal::BasicStream* = 0); virtual ~OutputStreamI(); - virtual Ice::CommunicatorPtr communicator() const; + virtual CommunicatorPtr communicator() const; - virtual void writeObject(const ::Ice::ObjectPtr&); - virtual void writeException(const Ice::UserException&); + // + // These methods should be removed when the old stream API is removed. + // + virtual void writeBool(bool); + virtual void writeByte(Byte); + virtual void writeShort(Short); + virtual void writeInt(Int); + virtual void writeLong(Long); + virtual void writeFloat(Float); + virtual void writeDouble(Double); + virtual void writeString(const ::std::string&, bool = true); + virtual void writeWstring(const ::std::wstring&); - virtual void writeSize(Ice::Int); + // + // These methods should be removed when the old stream API is removed. + // + virtual void writeBoolSeq(const std::vector< bool >&); + virtual void writeByteSeq(const std::vector< Byte >&); + virtual void writeShortSeq(const std::vector< Short >&); + virtual void writeIntSeq(const std::vector< Int >&); + virtual void writeLongSeq(const std::vector< Long >&); + virtual void writeFloatSeq(const std::vector< Float >&); + virtual void writeDoubleSeq(const std::vector< Double >&); + virtual void writeStringSeq(const std::vector< std::string >&, bool = true); + virtual void writeWstringSeq(const std::vector< std::wstring >&); - virtual void writeTypeId(const std::string&); + // + // These methods should be removed when the old stream API is removed. + // + virtual void writeBoolSeq(const bool*, const bool*); + virtual void writeByteSeq(const Byte*, const Byte*); + virtual void writeShortSeq(const Short*, const Short*); + virtual void writeIntSeq(const Int*, const Int*); + virtual void writeLongSeq(const Long*, const Long*); + virtual void writeFloatSeq(const Float*, const Float*); + virtual void writeDoubleSeq(const Double*, const Double*); + + virtual void writeObject(const ObjectPtr&); + virtual void writeException(const UserException&); + virtual void writeProxy(const ObjectPrx&); + + virtual void writeSize(Int); + virtual void writeTypeId(const std::string&); + + virtual void write(bool); + virtual void write(Byte); + virtual void write(Short); + virtual void write(Int); + virtual void write(Long); + virtual void write(Float); + virtual void write(Double); + virtual void write(const std::string&, bool = true); + virtual void write(const std::vector<std::string>&, bool); + virtual void write(const char* v, bool = true); + virtual void write(const std::wstring& v); + + virtual void write(const bool*, const bool*); + virtual void write(const Byte*, const Byte*); + virtual void write(const Short*, const Short*); + virtual void write(const Int*, const Int*); + virtual void write(const Long*, const Long*); + virtual void write(const Float*, const Float*); + virtual void write(const Double*, const Double*); virtual void startSlice(); virtual void endSlice(); @@ -126,54 +206,15 @@ public: virtual void writePendingObjects(); - virtual void finished(std::vector< Ice::Byte >&); + virtual void finished(std::vector< Byte >&); virtual void reset(bool); private: - - virtual void internalWriteBool(bool); - virtual void internalWriteByte(::Ice::Byte); - virtual void internalWriteShort(::Ice::Short); - virtual void internalWriteInt(::Ice::Int); - virtual void internalWriteLong(::Ice::Long); - virtual void internalWriteFloat(::Ice::Float); - virtual void internalWriteDouble(::Ice::Double); - virtual void internalWriteString(const ::std::string&, bool = true); - virtual void internalWriteWstring(const ::std::wstring&); - virtual void internalWriteProxy(const ::Ice::ObjectPrx&); - - // - // Remove these methods when the old Stream api, is removed. - // - virtual void internalWriteBoolSeq(const std::vector< bool >&); - virtual void internalWriteBoolSeq(const bool*, const bool*); - - virtual void internalWriteByteSeq(const std::vector< Ice::Byte >&); - virtual void internalWriteByteSeq(const Ice::Byte*, const Ice::Byte*); - - virtual void internalWriteShortSeq(const std::vector< Ice::Short >&); - virtual void internalWriteShortSeq(const Ice::Short*, const Ice::Short*); - - virtual void internalWriteIntSeq(const std::vector< Ice::Int >&); - virtual void internalWriteIntSeq(const Ice::Int*, const Ice::Int*); - - virtual void internalWriteLongSeq(const std::vector< Ice::Long >&); - virtual void internalWriteLongSeq(const Ice::Long*, const Ice::Long*); - - virtual void internalWriteFloatSeq(const std::vector< Ice::Float >&); - virtual void internalWriteFloatSeq(const Ice::Float*, const Ice::Float*); - - virtual void internalWriteDoubleSeq(const std::vector< Ice::Double >&); - virtual void internalWriteDoubleSeq(const Ice::Double*, const Ice::Double*); - - virtual void internalWriteStringSeq(const std::vector< std::string >&, bool = true); - - virtual void internalWriteWstringSeq(const std::vector< std::wstring >&); - Ice::CommunicatorPtr _communicator; + const CommunicatorPtr _communicator; IceInternal::BasicStream* _os; - bool _own; + const bool _own; }; } diff --git a/cpp/src/IcePatch2/FileServerI.cpp b/cpp/src/IcePatch2/FileServerI.cpp index 30235000b62..a33171edd8f 100644 --- a/cpp/src/IcePatch2/FileServerI.cpp +++ b/cpp/src/IcePatch2/FileServerI.cpp @@ -119,7 +119,7 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp return; } - IceUtilInternal::ScopedArray<Byte> bytes(new Byte[num]); + IceUtil::ScopedArray<Byte> bytes(new Byte[num]); #ifdef _WIN32 int r; if((r = diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index ba658453f1a..a944eda7250 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -145,7 +145,7 @@ sequenceTypeToString(const SequencePtr& seq, const StringList& metaData, int typ { s = " " + s; } - return "::std::pair< ::IceUtilInternal::ScopedArray<" + s + ">," + + return "::std::pair< ::IceUtil::ScopedArray<" + s + ">," + " ::std::pair<const " + s + "*, const " + s + "*> >"; } else @@ -854,7 +854,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& } else { - out << nl << "::IceUtilInternal::ScopedArray<" << s << "> ___" << fixedParam << '(' + out << nl << "::IceUtil::ScopedArray<" << s << "> ___" << fixedParam << '(' << stream << deref << func << fixedParam << "));"; } } diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 7b98df83ab9..ad30d5025eb 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -718,11 +718,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);"; H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;"; H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);"; @@ -768,11 +765,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __outS) const"; @@ -822,11 +816,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) // C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const"; C << sb; @@ -1074,11 +1065,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) if(_stream) { H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << dllExport << "void ice_write(const ::Ice::OutputStreamPtr&) const;"; H << nl << dllExport << "void ice_read(const ::Ice::InputStreamPtr&);"; @@ -1107,11 +1095,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scoped.substr(2) << "::ice_write(const ::Ice::OutputStreamPtr& __outS) const"; @@ -1146,11 +1131,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { H << sp; H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const " << p->name() << "Ptr&);"; @@ -1162,11 +1144,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name() << "(const ::Ice::OutputStreamPtr& __outS, const " << fixKwd(p->scoped() + "Ptr") << "& __v)"; @@ -1190,11 +1169,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { H << sp; H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << dllExport << "void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const " << name << "&);"; @@ -1205,11 +1181,8 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name() << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "& __v)"; @@ -1305,11 +1278,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) if(_stream) { H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << _dllExport << "ICE_DEPRECATED_API void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const " << typeName << "&);"; @@ -1375,11 +1345,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name() << "(const ::Ice::OutputStreamPtr& __outS, const " << scopedName << "& v)"; @@ -1411,9 +1378,9 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << sb; if(protobuf) { - C << nl << "std::vector< ::Ice::Byte> data;"; - C << nl << "__inS->read(data);"; - C << nl << "if(!v.ParseFromArray(data.begin(), data.end()))"; + C << nl << "std::pair<const ::Ice::Byte*, const ::Ice::Byte*> data;"; + C << nl << "__inS->readByteSeq(data);"; + C << nl << "if(!v.ParseFromArray(data.first, data.second - data.first))"; C << sb; C << nl << "throw ::Ice::MarshalException(__FILE__, __LINE__, \"ParseFromArray failed\");"; C << eb; @@ -1443,11 +1410,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) if(_stream) { H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << _dllExport << "ICE_DEPRECATED_API void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const " << name << "&);"; @@ -1485,11 +1449,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name() << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "& v)"; @@ -1561,11 +1522,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) if(_stream) { H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << _dllExport << "ICE_DEPRECATED_API void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, const " << name << "&);"; @@ -1606,11 +1564,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name() << "(const ::Ice::OutputStreamPtr& __outS, const " << scoped << "& v)"; @@ -1675,12 +1630,8 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) if(_stream) { H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H.restoreIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H << nl << _dllExport << "ICE_DEPRECATED_API void ice_write" << p->name() << "(const ::Ice::OutputStreamPtr&, " << name << ");"; H << nl << _dllExport << "ICE_DEPRECATED_API void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);"; @@ -1729,12 +1680,8 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C.restoreIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name() << "(const ::Ice::OutputStreamPtr& __outS, " << scoped << " v)"; C << sb; @@ -1825,7 +1772,7 @@ void Slice::Gen::TypesVisitor::emitUpcall(const ExceptionPtr& base, const string& call, bool isLocal) { C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX C.restoreIndent(); C << nl << (base ? fixKwd(base->name()) : string(isLocal ? "LocalException" : "UserException")) << call; C.zeroIndent(); @@ -2018,7 +1965,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_context(const ::Ice::Context& __context) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_context(__context).get());"; @@ -2038,7 +1985,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_adapterId(const std::string& __id) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_adapterId(__id).get());"; @@ -2054,7 +2001,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_endpoints(const ::Ice::EndpointSeq& __endpoints) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_endpoints(__endpoints).get());"; @@ -2070,7 +2017,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_locatorCacheTimeout(int __timeout) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_locatorCacheTimeout(__timeout).get());"; @@ -2086,7 +2033,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_connectionCached(bool __cached) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_connectionCached(__cached).get());"; @@ -2100,7 +2047,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_endpointSelection(::Ice::EndpointSelectionType __est) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_endpointSelection(__est).get());"; @@ -2116,7 +2063,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_secure(bool __secure) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_secure(__secure).get());"; @@ -2132,7 +2079,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_preferSecure(bool __preferSecure) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_preferSecure(__preferSecure).get());"; @@ -2148,7 +2095,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_router(const ::Ice::RouterPrx& __router) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_router(__router).get());"; @@ -2163,7 +2110,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_locator(const ::Ice::LocatorPrx& __locator) const"; H << sb; - H.dec(); H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H.dec(); H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_locator(__locator).get());"; @@ -2178,7 +2125,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_collocationOptimized(bool __co) const"; H << sb; - H.dec(); H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H.dec(); H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_collocationOptimized(__co).get());"; @@ -2190,7 +2137,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_twoway() const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_twoway().get());"; @@ -2206,7 +2153,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_oneway() const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_oneway().get());"; @@ -2221,7 +2168,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_batchOneway() const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_batchOneway().get());"; @@ -2237,7 +2184,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_datagram() const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_datagram().get());"; @@ -2253,7 +2200,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_batchDatagram() const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_batchDatagram().get());"; @@ -2269,7 +2216,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_compress(bool __compress) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_compress(__compress).get());"; @@ -2285,7 +2232,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_timeout(int __timeout) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_timeout(__timeout).get());"; @@ -2301,7 +2248,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << nl << "::IceInternal::ProxyHandle<" << name << "> ice_connectionId(const std::string& __id) const"; H << sb; H.dec(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.inc(); H << nl << "typedef ::IceProxy::Ice::Object _Base;"; H << nl << "return dynamic_cast<" << name << "*>(_Base::ice_connectionId(__id).get());"; @@ -2605,7 +2552,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << nl << "::Ice::AsyncResult::__check(__result, this, " << flatName << ");"; // - // COMPILERBUG: It's necessary to generate the allocate code here before + // COMPILERFIX: It's necessary to generate the allocate code here before // this if(!__result->wait()). If generated after this if block, we get // access violations errors with the test/Ice/slicing/objects test on VC9 // and Windows 64 bits when compiled with optimization (see bug 4400). @@ -4165,11 +4112,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;"; H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);"; @@ -4213,11 +4157,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __outS) const"; C << sb; @@ -4255,11 +4196,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); // // Emit placeholder functions to catch errors. @@ -5106,7 +5044,7 @@ void Slice::Gen::ObjectVisitor::emitUpcall(const ClassDefPtr& base, const string& call) { C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX C.restoreIndent(); C << nl << (base ? fixKwd(base->name()) : string("Object")) << call; C.zeroIndent(); @@ -5409,7 +5347,7 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& H << nl << "catch(::Ice::Exception& ex)"; H << sb; H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.restoreIndent(); H << nl << "__exception(__result, ex);"; H.zeroIndent(); @@ -5424,7 +5362,7 @@ Slice::Gen::AsyncCallbackTemplateVisitor::generateOperation(const OperationPtr& H << nl << "if(response)"; H << sb; H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.restoreIndent(); H << nl << "(callback.get()->*response)" << spar; if(ret) @@ -5654,11 +5592,8 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p) { H << sp; H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - H.restoreIndent(); - H << nl << "// Stream API is not supported with VC++ 6"; - H.zeroIndent(); - H << nl << "#else"; + H << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + H << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; H.restoreIndent(); H << nl << _dllExport << "ICE_DEPRECATED_API void ice_write" << name << "Prx(const ::Ice::OutputStreamPtr&, const " << name << "Prx&);"; @@ -5718,11 +5653,8 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) { C << sp; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG - C.restoreIndent(); - C << nl << "// Stream API is not supported with VC++ 6"; - C.zeroIndent(); - C << nl << "#else"; + C << nl << "// COMPILERFIX: Stream API is not supported with VC++ 6"; + C << nl << "#if !defined(_MSC_VER) || (_MSC_VER >= 1300)"; C.restoreIndent(); C << nl << "void" << nl << scope.substr(2) << "ice_write" << name << "Prx(const ::Ice::OutputStreamPtr& __outS, const " << scope << name << "Prx& v)"; @@ -5748,9 +5680,7 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "void" << nl << scope.substr(2) << "ice_read" << name << "(const ::Ice::InputStreamPtr& __inS, " << scope << name << "Ptr& __v)"; C << sb; - C << nl << "::Ice::ReadObjectCallbackPtr __cb = new ::Ice::ReadObjectCallbackI(" << scope << "__patch__" - << name << "Ptr, &__v);"; - C << nl << "__inS->readObject(__cb);"; + C << nl << "__inS->read(__v);"; C << eb; C.zeroIndent(); C << nl << "#endif"; @@ -6321,7 +6251,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) H << nl << "void __sent(bool sentSynchronously)"; H << sb; H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H.restoreIndent(); H << nl << "AMICallbackBase::__sent(sentSynchronously);"; H.zeroIndent(); @@ -6585,7 +6515,7 @@ Slice::Gen::AsyncImplVisitor::visitOperation(const OperationPtr& p) C << nl << "else"; C << sb; C.zeroIndent(); - C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + C << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX C.restoreIndent(); C << nl << "IncomingAsync::ice_exception(ex);"; C.zeroIndent(); @@ -6618,7 +6548,7 @@ Slice::Gen::StreamVisitor::visitModuleStart(const ModulePtr& m) return false; } H.zeroIndent(); - H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERBUG + H << nl << "#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug"; // COMPILERFIX H << nl << "#else"; H.restoreIndent(); H << nl << "namespace Ice" << nl << '{'; @@ -6644,7 +6574,6 @@ Slice::Gen::StreamVisitor::visitExceptionStart(const ExceptionPtr& p) H << nl << "struct StreamTrait< " << fixKwd(scoped) << ">"; H << sb; H << nl << "static const ::Ice::StreamTraitType type = ::Ice::StreamTraitTypeUserException;"; - H << nl << "static const int enumLimit = 0;"; H << eb << ";" << nl; } return true; diff --git a/cpp/test/Ice/Makefile.mak b/cpp/test/Ice/Makefile.mak index 1e8b353a9e8..9ea5e5c76ad 100644 --- a/cpp/test/Ice/Makefile.mak +++ b/cpp/test/Ice/Makefile.mak @@ -36,12 +36,12 @@ SUBDIRS = proxy \ udp \
defaultServant \
threadPoolPriority \
+ stream \
!if "$(CPP_COMPILER)" != "VC60"
SUBDIRS = $(SUBDIRS) \
ami \
custom \
- stream \
invoke
!endif
diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index e7fa1781c6c..e0367e48ae2 100644..100755 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -22,6 +22,14 @@ using namespace std; +#if defined(_MSC_VER) && (_MSC_VER < 1300) // COMPILERBUG +// +// VC++ 6 compiler bugs doesn't allow using templates for the Stream API. +// +// see: http://support.microsoft.com/kb/240866 +// http://support.microsoft.com/kb/241569 +// +#else class TestObjectWriter : public Ice::ObjectWriter { public: @@ -150,14 +158,25 @@ public: { } }; +#endif int run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) { +#if defined(_MSC_VER) && (_MSC_VER < 1300) +// +// VC++ 6 compiler bugs doesn't allow to write +// the Stream API using c++ templates. +// +// see: http://support.microsoft.com/kb/240866 +// http://support.microsoft.com/kb/241569 +// +#else MyClassFactoryWrapperPtr factoryWrapper = new MyClassFactoryWrapper; communicator->addObjectFactory(factoryWrapper, Test::MyClass::ice_staticId()); communicator->addObjectFactory(new MyInterfaceFactory, Test::MyInterface::ice_staticId()); - +#endif + Ice::InputStreamPtr in; Ice::OutputStreamPtr out; vector<Ice::Byte> data; @@ -1049,7 +1068,15 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) } cout << "ok" << endl; - +#if defined(_MSC_VER) && (_MSC_VER < 1300) +// +// VC++ 6 compiler bugs doesn't allow to write +// the Stream API using c++ templates. +// +// see: http://support.microsoft.com/kb/240866 +// http://support.microsoft.com/kb/241569 +// +#else cout << "testing constructed types... " << flush; { @@ -1094,7 +1121,7 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) Test::ice_readClassStruct(in, s2); test(s2->i == s->i); } - +#endif { Test::BoolS arr; arr.push_back(true); @@ -1208,7 +1235,15 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) Test::StringS arr2 = in->readStringSeq(); test(arr2 == arr); } - +#if defined(_MSC_VER) && (_MSC_VER < 1300) +// +// VC++ 6 compiler bugs doesn't allow to write +// the Stream API using c++ templates. +// +// see: http://support.microsoft.com/kb/240866 +// http://support.microsoft.com/kb/241569 +// +#else { Test::MyEnumS arr; arr.push_back(Test::enum3); @@ -1354,9 +1389,8 @@ run(int argc, char** argv, const Ice::CommunicatorPtr& communicator) test(reader->obj->s.e == Test::enum2); factoryWrapper->setFactory(0); } - cout << "ok" << endl; - +#endif return 0; } |