diff options
author | Mark Spruiell <mes@zeroc.com> | 2007-11-05 12:19:49 -0800 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2007-11-05 12:19:49 -0800 |
commit | 3c8924663df8629b33c2ddd38907c4bf2eeb83cd (patch) | |
tree | 83b63f2396201019163d140555e42d79f82e46d3 /cpp | |
parent | Merge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff) | |
download | ice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.tar.bz2 ice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.tar.xz ice-3c8924663df8629b33c2ddd38907c4bf2eeb83cd.zip |
- Fixing bug 2522 for Python. This involved adding the C++ class
UserExceptionWriter so that the Python extension can wrap a native
Python user exception into something that the C++ run time can
marshal. Also ported the changes to the servantLocator test.
- Implementing UserExceptionWriter in Java and C#.
- Consolidating the source files for the C# streaming API.
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 29 | ||||
-rw-r--r-- | cpp/include/Ice/BasicStream.h | 8 | ||||
-rw-r--r-- | cpp/include/Ice/Stream.h | 24 | ||||
-rw-r--r-- | cpp/src/Ice/BasicStream.cpp | 17 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.cpp | 268 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.h | 150 |
6 files changed, 277 insertions, 219 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 61922a58a8f..6f0948b395f 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -4,10 +4,11 @@ Changes since version 3.2.X (binary incompatible) - Changed servant locators so both locate() and finished() can throw user exceptions. (See the manual for details.) -- slice2vb has been removed from the distribution and is no longer supported. - To use Visual Basic .NET with Ice, use slice2cs to generate C# code from - Slice definitions, and then use a C# compiler to create a DLL from the - generated code. Then link against that DLL in your Visual Basic project. +- slice2vb has been removed from the distribution and is no longer + supported. To use Visual Basic .NET with Ice, use slice2cs to + generate C# code from Slice definitions, and then use a C# compiler + to create a DLL from the generated code. Then link against that DLL + in your Visual Basic project. See the manual and the Visual Basic demos for more information. @@ -18,8 +19,11 @@ Changes since version 3.2.X (binary incompatible) return a proxy of the same type as the target. This way, you don't need to uncheckedCast the returned proxy. For example, you can now write: - hello = hello.ice_oneway(); + + hello = hello->ice_oneway(); + instead of: + hello = HelloPrx::uncheckedCast(hello->ice_oneway()); - Added a fix to prevent the IceGrid node from printing an annoying @@ -28,11 +32,15 @@ Changes since version 3.2.X (binary incompatible) - Fixed IceGrid bug where updates to IceBox services were not correctly sent to the IceGrid GUI or IceGrid registry slaves. -- Added Ice::createInput(const CommunicatorPtr&, const pair< const Byte*, const Byte*>&); +- Added a new overloading of the Ice::createInputStream method: + + Ice::InputStreamPtr createInputStream( + const CommunicatorPtr&, + const pair< const Byte*, const Byte*>&); - Setting IceBox.ServiceManager.Endpoints is no longer necessary in order to run the IceBox service. If no endpoints are specified - the the ServiceManager interface is not created. + then the ServiceManager interface is not created. - The property Ice.Plugin.Logger is now reserved to allow setting of the communicator's logger from properties. This plugin must @@ -42,8 +50,8 @@ Changes since version 3.2.X (binary incompatible) would be generated when C++ reserved words are used as Slice identifiers. -- It is no longer possible to provide input files on the - command line for icestormadmin nor icegridadmin. +- It is no longer possible to provide input files on the command line + for icestormadmin or icegridadmin. - The thread stack size specified with the IceUtil::Thread::start() method parameter is now adjusted to PTHREAD_STACK_MIN if it's @@ -70,11 +78,12 @@ Changes since version 3.2.X (binary incompatible) present when the adapter was created. - Freeze evictor update: + - the existing evictor was renamed BackgroundSaveEvictor - added new TransactionalEvictor - Fixed a bug in the encoding of user exceptions with a class - attribute and returned by AMD dispatched invocations. An extra byte + attribute and returned by AMD-dispatched invocations. An extra byte was encoded at the end. This fix doesn't affect on the wire compatibility with old Ice clients. diff --git a/cpp/include/Ice/BasicStream.h b/cpp/include/Ice/BasicStream.h index 7cab7da51ef..30edcafb305 100644 --- a/cpp/include/Ice/BasicStream.h +++ b/cpp/include/Ice/BasicStream.h @@ -97,6 +97,9 @@ public: // Instance* instance() const { return _instance; } // Inlined for performance reasons. + void* closure() const; + void* closure(void*); + void swap(BasicStream&); void resize(Container::size_type sz) @@ -594,6 +597,11 @@ private: // Instance* _instance; + // + // The public stream API needs to attach data to a stream. + // + void* _closure; + class ICE_API ReadEncaps : private ::IceUtil::noncopyable { public: diff --git a/cpp/include/Ice/Stream.h b/cpp/include/Ice/Stream.h index 30955233120..526df7e11ad 100644 --- a/cpp/include/Ice/Stream.h +++ b/cpp/include/Ice/Stream.h @@ -198,6 +198,30 @@ private: void* _arg; }; +class ICE_API UserExceptionWriter : public UserException +{ +public: + + UserExceptionWriter(const Ice::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 void ice_throw() const = 0; + + virtual void __write(IceInternal::BasicStream*) const; + virtual void __read(IceInternal::BasicStream*, bool); + + virtual bool __usesClasses() const; + +protected: + + Ice::CommunicatorPtr _communicator; +}; + } #endif diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 3ffadc78573..2a94e724f86 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -33,6 +33,7 @@ using namespace IceInternal; IceInternal::BasicStream::BasicStream(Instance* instance, bool unlimited) : IceInternal::Buffer(instance->messageSizeMax()), _instance(instance), + _closure(0), _currentReadEncaps(0), _currentWriteEncaps(0), _traceSlicing(-1), @@ -73,6 +74,20 @@ IceInternal::BasicStream::clear() delete _objectList; } +void* +IceInternal::BasicStream::closure() const +{ + return _closure; +} + +void* +IceInternal::BasicStream::closure(void* p) +{ + void* prev = _closure; + _closure = p; + return prev; +} + void IceInternal::BasicStream::swap(BasicStream& other) { @@ -80,6 +95,8 @@ IceInternal::BasicStream::swap(BasicStream& other) Buffer::swap(other); + std::swap(_closure, other._closure); + // // Swap is never called for BasicStreams that have more than one // encaps. diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp index 989e98a9313..b0458637dfe 100644 --- a/cpp/src/Ice/StreamI.cpp +++ b/cpp/src/Ice/StreamI.cpp @@ -12,42 +12,32 @@ using namespace std; using namespace Ice; - -// -// BasicInputStream -// -IceInternal::BasicInputStream::BasicInputStream(IceInternal::Instance* instance, InputStream* in) : - BasicStream(instance), _in(in) -{ -} - -// -// BasicOutputStream -// -IceInternal::BasicOutputStream::BasicOutputStream(IceInternal::Instance* instance, OutputStream* out) : - BasicStream(instance), _out(out) -{ -} +using namespace IceInternal; // // InputStreamI // Ice::InputStreamI::InputStreamI(const Ice::CommunicatorPtr& communicator, const vector<Byte>& data) : - _communicator(communicator), _is(IceInternal::getInstance(communicator).get(), this) + _communicator(communicator) { - _is.writeBlob(data); - _is.i = _is.b.begin(); + _is = new BasicStream(getInstance(communicator).get()); + _is->closure(this); + _is->writeBlob(data); + _is->i = _is->b.begin(); } Ice::InputStreamI::InputStreamI(const Ice::CommunicatorPtr& communicator, const pair<const Byte*, const Byte*>& data) : - _communicator(communicator), _is(IceInternal::getInstance(communicator).get(), this) + _communicator(communicator) { - _is.writeBlob(data.first, data.second - data.first); - _is.i = _is.b.begin(); + _is = new BasicStream(getInstance(communicator).get()); + _is->closure(this); + _is->writeBlob(data.first, data.second - data.first); + _is->i = _is->b.begin(); } Ice::InputStreamI::~InputStreamI() { + delete _is; } CommunicatorPtr @@ -59,14 +49,14 @@ Ice::InputStreamI::communicator() const void Ice::InputStreamI::sliceObjects(bool b) { - _is.sliceObjects(b); + _is->sliceObjects(b); } bool Ice::InputStreamI::readBool() { bool v; - _is.read(v); + _is->read(v); return v; } @@ -74,21 +64,21 @@ vector<bool> Ice::InputStreamI::readBoolSeq() { vector<bool> v; - _is.read(v); + _is->read(v); return v; } bool* Ice::InputStreamI::readBoolSeq(pair<const bool*, const bool*>& p) { - return _is.read(p); + return _is->read(p); } Byte Ice::InputStreamI::readByte() { Byte v; - _is.read(v); + _is->read(v); return v; } @@ -96,7 +86,7 @@ vector<Byte> Ice::InputStreamI::readByteSeq() { pair<const Byte*, const Byte*> p; - _is.read(p); + _is->read(p); vector<Byte> v(p.first, p.second); return v; } @@ -104,14 +94,14 @@ Ice::InputStreamI::readByteSeq() void Ice::InputStreamI::readByteSeq(pair<const Byte*, const Byte*>& p) { - _is.read(p); + _is->read(p); } Short Ice::InputStreamI::readShort() { Short v; - _is.read(v); + _is->read(v); return v; } @@ -119,21 +109,21 @@ vector<Short> Ice::InputStreamI::readShortSeq() { vector<Short> v; - _is.read(v); + _is->read(v); return v; } Short* Ice::InputStreamI::readShortSeq(pair<const Short*, const Short*>& p) { - return _is.read(p); + return _is->read(p); } Int Ice::InputStreamI::readInt() { Int v; - _is.read(v); + _is->read(v); return v; } @@ -141,21 +131,21 @@ vector<Int> Ice::InputStreamI::readIntSeq() { vector<Int> v; - _is.read(v); + _is->read(v); return v; } Int* Ice::InputStreamI::readIntSeq(pair<const Int*, const Int*>& p) { - return _is.read(p); + return _is->read(p); } Long Ice::InputStreamI::readLong() { Long v; - _is.read(v); + _is->read(v); return v; } @@ -163,21 +153,21 @@ vector<Long> Ice::InputStreamI::readLongSeq() { vector<Long> v; - _is.read(v); + _is->read(v); return v; } Long* Ice::InputStreamI::readLongSeq(pair<const Long*, const Long*>& p) { - return _is.read(p); + return _is->read(p); } Float Ice::InputStreamI::readFloat() { Float v; - _is.read(v); + _is->read(v); return v; } @@ -185,21 +175,21 @@ vector<Float> Ice::InputStreamI::readFloatSeq() { vector<Float> v; - _is.read(v); + _is->read(v); return v; } Float* Ice::InputStreamI::readFloatSeq(pair<const Float*, const Float*>& p) { - return _is.read(p); + return _is->read(p); } Double Ice::InputStreamI::readDouble() { Double v; - _is.read(v); + _is->read(v); return v; } @@ -207,21 +197,21 @@ vector<Double> Ice::InputStreamI::readDoubleSeq() { vector<Double> v; - _is.read(v); + _is->read(v); return v; } Double* Ice::InputStreamI::readDoubleSeq(pair<const Double*, const Double*>& p) { - return _is.read(p); + return _is->read(p); } string Ice::InputStreamI::readString() { string v; - _is.read(v); + _is->read(v); return v; } @@ -229,7 +219,7 @@ vector<string> Ice::InputStreamI::readStringSeq() { vector<string> v; - _is.read(v); + _is->read(v); return v; } @@ -237,7 +227,7 @@ wstring Ice::InputStreamI::readWstring() { wstring v; - _is.read(v); + _is->read(v); return v; } @@ -245,7 +235,7 @@ vector<wstring> Ice::InputStreamI::readWstringSeq() { vector<wstring> v; - _is.read(v); + _is->read(v); return v; } @@ -253,7 +243,7 @@ Int Ice::InputStreamI::readSize() { Int sz; - _is.readSize(sz); + _is->readSize(sz); return sz; } @@ -261,7 +251,7 @@ ObjectPrx Ice::InputStreamI::readProxy() { Ice::ObjectPrx v; - _is.read(v); + _is->read(v); return v; } @@ -277,69 +267,78 @@ void Ice::InputStreamI::readObject(const ReadObjectCallbackPtr& cb) { _callbacks.push_back(cb); // Keep reference to callback. - _is.read(patchObject, cb.get()); + _is->read(patchObject, cb.get()); } string Ice::InputStreamI::readTypeId() { string id; - _is.readTypeId(id); + _is->readTypeId(id); return id; } void Ice::InputStreamI::throwException() { - _is.throwException(); + _is->throwException(); } void Ice::InputStreamI::startSlice() { - _is.startReadSlice(); + _is->startReadSlice(); } void Ice::InputStreamI::endSlice() { - _is.endReadSlice(); + _is->endReadSlice(); } void Ice::InputStreamI::startEncapsulation() { - _is.startReadEncaps(); + _is->startReadEncaps(); } void Ice::InputStreamI::endEncapsulation() { - _is.endReadEncaps(); + _is->endReadEncaps(); } void Ice::InputStreamI::skipSlice() { - _is.skipSlice(); + _is->skipSlice(); } void Ice::InputStreamI::readPendingObjects() { - _is.readPendingObjects(); + _is->readPendingObjects(); } // // OutputStreamI // -Ice::OutputStreamI::OutputStreamI(const Ice::CommunicatorPtr& communicator) : - _communicator(communicator), _os(IceInternal::getInstance(communicator).get(), this) +Ice::OutputStreamI::OutputStreamI(const Ice::CommunicatorPtr& communicator, BasicStream* os) : + _communicator(communicator), _os(os), _own(!os) { + if(!_os) + { + _os = new BasicStream(getInstance(communicator).get()); + } + _os->closure(this); } Ice::OutputStreamI::~OutputStreamI() { + if(_own) + { + delete _os; + } } CommunicatorPtr @@ -351,25 +350,25 @@ Ice::OutputStreamI::communicator() const void Ice::OutputStreamI::writeBool(bool v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::writeBoolSeq(const vector<bool>& v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::writeBoolSeq(const bool* begin, const bool* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeByte(Byte v) { - _os.write(v); + _os->write(v); } void @@ -377,24 +376,24 @@ Ice::OutputStreamI::writeByteSeq(const vector<Byte>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeByteSeq(const Byte* begin, const Byte* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeShort(Short v) { - _os.write(v); + _os->write(v); } void @@ -402,24 +401,24 @@ Ice::OutputStreamI::writeShortSeq(const vector<Short>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeShortSeq(const Short* begin, const Short* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeInt(Int v) { - _os.write(v); + _os->write(v); } void @@ -427,24 +426,24 @@ Ice::OutputStreamI::writeIntSeq(const vector<Int>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeIntSeq(const Int* begin, const Int* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeLong(Long v) { - _os.write(v); + _os->write(v); } void @@ -452,24 +451,24 @@ Ice::OutputStreamI::writeLongSeq(const vector<Long>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeLongSeq(const Long* begin, const Long* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeFloat(Float v) { - _os.write(v); + _os->write(v); } void @@ -477,24 +476,24 @@ Ice::OutputStreamI::writeFloatSeq(const vector<Float>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeFloatSeq(const Float* begin, const Float* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeDouble(Double v) { - _os.write(v); + _os->write(v); } void @@ -502,24 +501,24 @@ Ice::OutputStreamI::writeDoubleSeq(const vector<Double>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeDoubleSeq(const Double* begin, const Double* end) { - _os.write(begin, end); + _os->write(begin, end); } void Ice::OutputStreamI::writeString(const string& v) { - _os.write(v); + _os->write(v); } void @@ -527,18 +526,18 @@ Ice::OutputStreamI::writeStringSeq(const vector<string>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeWstring(const wstring& v) { - _os.write(v); + _os->write(v); } void @@ -546,105 +545,105 @@ Ice::OutputStreamI::writeWstringSeq(const vector<wstring>& v) { if(v.size() == 0) { - _os.writeSize(0); + _os->writeSize(0); } else { - _os.write(&v[0], &v[0] + v.size()); + _os->write(&v[0], &v[0] + v.size()); } } void Ice::OutputStreamI::writeSize(Int sz) { - _os.writeSize(sz); + _os->writeSize(sz); } void Ice::OutputStreamI::writeProxy(const ObjectPrx& v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::writeObject(const ObjectPtr& v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::writeTypeId(const string& id) { - _os.writeTypeId(id); + _os->writeTypeId(id); } void Ice::OutputStreamI::writeException(const UserException& v) { - _os.write(v); + _os->write(v); } void Ice::OutputStreamI::startSlice() { - _os.startWriteSlice(); + _os->startWriteSlice(); } void Ice::OutputStreamI::endSlice() { - _os.endWriteSlice(); + _os->endWriteSlice(); } void Ice::OutputStreamI::startEncapsulation() { - _os.startWriteEncaps(); + _os->startWriteEncaps(); } void Ice::OutputStreamI::endEncapsulation() { - _os.endWriteEncaps(); + _os->endWriteEncaps(); } void Ice::OutputStreamI::writePendingObjects() { - _os.writePendingObjects(); + _os->writePendingObjects(); } void Ice::OutputStreamI::finished(vector<Byte>& bytes) { - vector<Byte>(_os.b.begin(), _os.b.end()).swap(bytes); + vector<Byte>(_os->b.begin(), _os->b.end()).swap(bytes); } // // ObjectReader // void -Ice::ObjectReader::__write(::IceInternal::BasicStream*) const +Ice::ObjectReader::__write(BasicStream*) const { assert(false); } void -Ice::ObjectReader::__read(::IceInternal::BasicStream* is, bool rid) +Ice::ObjectReader::__read(BasicStream* is, bool rid) { - IceInternal::BasicInputStream* bis = dynamic_cast<IceInternal::BasicInputStream*>(is); - assert(bis); - read(bis->_in, rid); + InputStreamI* stream = reinterpret_cast<InputStreamI*>(is->closure()); + assert(stream); + read(stream, rid); } void -Ice::ObjectReader::__write(const ::Ice::OutputStreamPtr&) const +Ice::ObjectReader::__write(const Ice::OutputStreamPtr&) const { assert(false); } void -Ice::ObjectReader::__read(const ::Ice::InputStreamPtr&, bool) +Ice::ObjectReader::__read(const Ice::InputStreamPtr&, bool) { assert(false); } @@ -653,27 +652,58 @@ Ice::ObjectReader::__read(const ::Ice::InputStreamPtr&, bool) // ObjectWriter // void -Ice::ObjectWriter::__write(::IceInternal::BasicStream* os) const +Ice::ObjectWriter::__write(BasicStream* os) const { - IceInternal::BasicOutputStream* bos = dynamic_cast<IceInternal::BasicOutputStream*>(os); - assert(bos); - write(bos->_out); + OutputStreamI* stream = reinterpret_cast<OutputStreamI*>(os->closure()); + assert(stream); + write(stream); } void -Ice::ObjectWriter::__read(::IceInternal::BasicStream*, bool) +Ice::ObjectWriter::__read(BasicStream*, bool) { assert(false); } void -Ice::ObjectWriter::__write(const ::Ice::OutputStreamPtr&) const +Ice::ObjectWriter::__write(const Ice::OutputStreamPtr&) const { assert(false); } void -Ice::ObjectWriter::__read(const ::Ice::InputStreamPtr&, bool) +Ice::ObjectWriter::__read(const Ice::InputStreamPtr&, bool) { assert(false); } + +// +// UserExceptionWriter +// +Ice::UserExceptionWriter::UserExceptionWriter(const Ice::CommunicatorPtr& communicator) : + _communicator(communicator) +{ +} + +Ice::UserExceptionWriter::~UserExceptionWriter() throw() +{ +} + +void +Ice::UserExceptionWriter::__write(BasicStream* os) const +{ + OutputStreamPtr stream = new OutputStreamI(_communicator, os); + write(stream); +} + +void +Ice::UserExceptionWriter::__read(BasicStream*, bool) +{ + assert(false); +} + +bool +Ice::UserExceptionWriter::__usesClasses() const +{ + return usesClasses(); +} diff --git a/cpp/src/Ice/StreamI.h b/cpp/src/Ice/StreamI.h index 70f5e8dd1c3..1f00533612d 100644 --- a/cpp/src/Ice/StreamI.h +++ b/cpp/src/Ice/StreamI.h @@ -13,48 +13,18 @@ #include <Ice/Stream.h> #include <Ice/BasicStream.h> -namespace IceInternal -{ - -// -// Subclass BasicStream in order to associate an InputStream with it. -// -class BasicInputStream : public BasicStream -{ -public: - - BasicInputStream(Instance*, Ice::InputStream*); - - Ice::InputStream* _in; -}; - -// -// Subclass BasicStream in order to associate an OutputStream with it. -// -class BasicOutputStream : public BasicStream -{ -public: - - BasicOutputStream(Instance*, Ice::OutputStream*); - - Ice::OutputStream* _out; -}; - -} - namespace Ice { // -// Implement InputStream as a wrapper around BasicInputStream. +// Implement InputStream as a wrapper around BasicStream. // class InputStreamI : public InputStream { public: - //InputStreamI(const IceInternal::InstancePtr&, const ::std::vector< ::Ice::Byte >&); - InputStreamI(const Ice::CommunicatorPtr&, const ::std::vector< ::Ice::Byte >&); - InputStreamI(const Ice::CommunicatorPtr&, const ::std::pair< const ::Ice::Byte*, const ::Ice::Byte* >&); + InputStreamI(const Ice::CommunicatorPtr&, const std::vector< Ice::Byte >&); + InputStreamI(const Ice::CommunicatorPtr&, const std::pair< const Ice::Byte*, const Ice::Byte* >&); virtual ~InputStreamI(); virtual Ice::CommunicatorPtr communicator() const; @@ -62,46 +32,46 @@ public: virtual void sliceObjects(bool); virtual bool readBool(); - virtual ::std::vector< bool > readBoolSeq(); - virtual bool* readBoolSeq(::std::pair<const bool*, const bool*>&); + virtual std::vector< bool > readBoolSeq(); + virtual bool* readBoolSeq(std::pair<const bool*, const bool*>&); - virtual ::Ice::Byte readByte(); - virtual ::std::vector< ::Ice::Byte > readByteSeq(); - virtual void readByteSeq(::std::pair<const ::Ice::Byte*, const ::Ice::Byte*>&); + virtual Ice::Byte readByte(); + virtual std::vector< Ice::Byte > readByteSeq(); + virtual void readByteSeq(std::pair<const Ice::Byte*, const Ice::Byte*>&); - virtual ::Ice::Short readShort(); - virtual ::std::vector< ::Ice::Short > readShortSeq(); - virtual ::Ice::Short* readShortSeq(::std::pair<const ::Ice::Short*, const ::Ice::Short*>&); + virtual Ice::Short readShort(); + virtual std::vector< Ice::Short > readShortSeq(); + virtual Ice::Short* readShortSeq(std::pair<const Ice::Short*, const Ice::Short*>&); - virtual ::Ice::Int readInt(); - virtual ::std::vector< ::Ice::Int > readIntSeq(); - virtual ::Ice::Int* readIntSeq(::std::pair<const ::Ice::Int*, const ::Ice::Int*>&); + virtual Ice::Int readInt(); + virtual std::vector< Ice::Int > readIntSeq(); + virtual Ice::Int* readIntSeq(std::pair<const Ice::Int*, const Ice::Int*>&); - virtual ::Ice::Long readLong(); - virtual ::std::vector< ::Ice::Long > readLongSeq(); - virtual ::Ice::Long* readLongSeq(::std::pair<const ::Ice::Long*, const ::Ice::Long*>&); + virtual Ice::Long readLong(); + virtual std::vector< Ice::Long > readLongSeq(); + virtual Ice::Long* readLongSeq(std::pair<const Ice::Long*, const Ice::Long*>&); - virtual ::Ice::Float readFloat(); - virtual ::std::vector< ::Ice::Float > readFloatSeq(); - virtual ::Ice::Float* readFloatSeq(::std::pair<const ::Ice::Float*, const ::Ice::Float*>&); + virtual Ice::Float readFloat(); + virtual std::vector< Ice::Float > readFloatSeq(); + virtual Ice::Float* readFloatSeq(std::pair<const Ice::Float*, const Ice::Float*>&); - virtual ::Ice::Double readDouble(); - virtual ::std::vector< ::Ice::Double > readDoubleSeq(); - virtual ::Ice::Double* readDoubleSeq(::std::pair<const ::Ice::Double*, const ::Ice::Double*>&); + virtual Ice::Double readDouble(); + virtual std::vector< Ice::Double > readDoubleSeq(); + virtual Ice::Double* readDoubleSeq(std::pair<const Ice::Double*, const Ice::Double*>&); - virtual ::std::string readString(); - virtual ::std::vector< ::std::string > readStringSeq(); + virtual std::string readString(); + virtual std::vector< std::string > readStringSeq(); - virtual ::std::wstring readWstring(); - virtual ::std::vector< ::std::wstring > readWstringSeq(); + virtual std::wstring readWstring(); + virtual std::vector< std::wstring > readWstringSeq(); - virtual ::Ice::Int readSize(); + virtual Ice::Int readSize(); - virtual ::Ice::ObjectPrx readProxy(); + virtual Ice::ObjectPrx readProxy(); - virtual void readObject(const ::Ice::ReadObjectCallbackPtr&); + virtual void readObject(const Ice::ReadObjectCallbackPtr&); - virtual ::std::string readTypeId(); + virtual std::string readTypeId(); virtual void throwException(); @@ -117,66 +87,65 @@ public: private: Ice::CommunicatorPtr _communicator; - IceInternal::BasicInputStream _is; - ::std::vector< ReadObjectCallbackPtr > _callbacks; + IceInternal::BasicStream* _is; + std::vector< ReadObjectCallbackPtr > _callbacks; }; // -// Implement OutputStream as a wrapper around BasicOutputStream. +// Implement OutputStream as a wrapper around BasicStream. // class OutputStreamI : public OutputStream { public: - //OutputStreamI(const IceInternal::InstancePtr&); - OutputStreamI(const Ice::CommunicatorPtr&); + OutputStreamI(const Ice::CommunicatorPtr&, IceInternal::BasicStream* = 0); virtual ~OutputStreamI(); virtual Ice::CommunicatorPtr communicator() const; virtual void writeBool(bool); - virtual void writeBoolSeq(const ::std::vector< bool >&); + virtual void writeBoolSeq(const std::vector< bool >&); virtual void writeBoolSeq(const bool*, const bool*); - virtual void writeByte(::Ice::Byte); - virtual void writeByteSeq(const ::std::vector< ::Ice::Byte >&); + virtual void writeByte(Ice::Byte); + virtual void writeByteSeq(const std::vector< Ice::Byte >&); virtual void writeByteSeq(const Ice::Byte*, const Ice::Byte*); - virtual void writeShort(::Ice::Short); - virtual void writeShortSeq(const ::std::vector< ::Ice::Short >&); + virtual void writeShort(Ice::Short); + virtual void writeShortSeq(const std::vector< Ice::Short >&); virtual void writeShortSeq(const Ice::Short*, const Ice::Short*); - virtual void writeInt(::Ice::Int); - virtual void writeIntSeq(const ::std::vector< ::Ice::Int >&); + virtual void writeInt(Ice::Int); + virtual void writeIntSeq(const std::vector< Ice::Int >&); virtual void writeIntSeq(const Ice::Int*, const Ice::Int*); - virtual void writeLong(::Ice::Long); - virtual void writeLongSeq(const ::std::vector< ::Ice::Long >&); + virtual void writeLong(Ice::Long); + virtual void writeLongSeq(const std::vector< Ice::Long >&); virtual void writeLongSeq(const Ice::Long*, const Ice::Long*); - virtual void writeFloat(::Ice::Float); - virtual void writeFloatSeq(const ::std::vector< ::Ice::Float >&); + virtual void writeFloat(Ice::Float); + virtual void writeFloatSeq(const std::vector< Ice::Float >&); virtual void writeFloatSeq(const Ice::Float*, const Ice::Float*); - virtual void writeDouble(::Ice::Double); - virtual void writeDoubleSeq(const ::std::vector< ::Ice::Double >&); + virtual void writeDouble(Ice::Double); + virtual void writeDoubleSeq(const std::vector< Ice::Double >&); virtual void writeDoubleSeq(const Ice::Double*, const Ice::Double*); - virtual void writeString(const ::std::string&); - virtual void writeStringSeq(const ::std::vector< ::std::string >&); + virtual void writeString(const std::string&); + virtual void writeStringSeq(const std::vector< std::string >&); - virtual void writeWstring(const ::std::wstring&); - virtual void writeWstringSeq(const ::std::vector< ::std::wstring >&); + virtual void writeWstring(const std::wstring&); + virtual void writeWstringSeq(const std::vector< std::wstring >&); - virtual void writeSize(::Ice::Int); + virtual void writeSize(Ice::Int); - virtual void writeProxy(const ::Ice::ObjectPrx&); + virtual void writeProxy(const Ice::ObjectPrx&); - virtual void writeObject(const ::Ice::ObjectPtr&); + virtual void writeObject(const Ice::ObjectPtr&); - virtual void writeTypeId(const ::std::string&); + virtual void writeTypeId(const std::string&); - virtual void writeException(const ::Ice::UserException&); + virtual void writeException(const Ice::UserException&); virtual void startSlice(); virtual void endSlice(); @@ -186,12 +155,13 @@ public: virtual void writePendingObjects(); - virtual void finished(::std::vector< ::Ice::Byte >&); + virtual void finished(std::vector< Ice::Byte >&); private: Ice::CommunicatorPtr _communicator; - IceInternal::BasicOutputStream _os; + IceInternal::BasicStream* _os; + bool _own; }; } |