diff options
author | Jose <jose@zeroc.com> | 2009-12-14 17:48:13 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2009-12-14 17:48:13 +0100 |
commit | 91862e81100330f3209b4272b29ca46a7bca0679 (patch) | |
tree | ca4014bd8789bc9db491e480d4791f7bdacbeebe /cpp/src | |
parent | edits to README.DEMOS (diff) | |
download | ice-91862e81100330f3209b4272b29ca46a7bca0679.tar.bz2 ice-91862e81100330f3209b4272b29ca46a7bca0679.tar.xz ice-91862e81100330f3209b4272b29ca46a7bca0679.zip |
4471 - read(std::vector<bool>) and Stream deprecate old methods.
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/FreezeScript/Data.cpp | 61 | ||||
-rw-r--r-- | cpp/src/Ice/Object.cpp | 5 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.cpp | 104 | ||||
-rw-r--r-- | cpp/src/Ice/StreamI.h | 156 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 71 |
6 files changed, 185 insertions, 216 deletions
diff --git a/cpp/src/FreezeScript/Data.cpp b/cpp/src/FreezeScript/Data.cpp index 133fb1aa42f..e9c56db5530 100644 --- a/cpp/src/FreezeScript/Data.cpp +++ b/cpp/src/FreezeScript/Data.cpp @@ -523,13 +523,13 @@ FreezeScript::BooleanData::getType() const void FreezeScript::BooleanData::marshal(const Ice::OutputStreamPtr& out) const { - out->writeBool(_value); + out->write(_value); } void FreezeScript::BooleanData::unmarshal(const Ice::InputStreamPtr& in) { - _value = in->readBool(); + in->read(_value); } bool @@ -657,22 +657,22 @@ FreezeScript::IntegerData::marshal(const Ice::OutputStreamPtr& out) const { case Slice::Builtin::KindByte: { - out->writeByte(static_cast<Ice::Byte>(_value)); + out->write(static_cast<Ice::Byte>(_value)); break; } case Slice::Builtin::KindShort: { - out->writeShort(static_cast<Ice::Short>(_value)); + out->write(static_cast<Ice::Short>(_value)); break; } case Slice::Builtin::KindInt: { - out->writeInt(static_cast<Ice::Int>(_value)); + out->write(static_cast<Ice::Int>(_value)); break; } case Slice::Builtin::KindLong: { - out->writeLong(_value); + out->write(_value); break; } @@ -694,23 +694,30 @@ FreezeScript::IntegerData::unmarshal(const Ice::InputStreamPtr& in) { case Slice::Builtin::KindByte: { - Ice::Byte val = in->readByte(); + Ice::Byte val; + in->read(val); _value = val & 0xff; break; } case Slice::Builtin::KindShort: { - _value = in->readShort(); + Ice::Short val; + in->read(val); + _value = val; break; } case Slice::Builtin::KindInt: { - _value = in->readInt(); + Ice::Int val; + in->read(val); + _value = val; break; } case Slice::Builtin::KindLong: { - _value = in->readLong(); + Ice::Long val; + in->read(val); + _value = val; break; } @@ -939,12 +946,12 @@ FreezeScript::DoubleData::marshal(const Ice::OutputStreamPtr& out) const { case Slice::Builtin::KindFloat: { - out->writeFloat(static_cast<Ice::Float>(_value)); + out->write(static_cast<Ice::Float>(_value)); break; } case Slice::Builtin::KindDouble: { - out->writeDouble(_value); + out->write(_value); break; } @@ -968,12 +975,14 @@ FreezeScript::DoubleData::unmarshal(const Ice::InputStreamPtr& in) { case Slice::Builtin::KindFloat: { - _value = in->readFloat(); + Ice::Float val; + in->read(val); + _value = val; break; } case Slice::Builtin::KindDouble: { - _value = in->readDouble(); + in->read(_value); break; } @@ -1133,13 +1142,15 @@ FreezeScript::StringData::getType() const void FreezeScript::StringData::marshal(const Ice::OutputStreamPtr& out) const { - out->writeString(_value); + out->write(_value); } void FreezeScript::StringData::unmarshal(const Ice::InputStreamPtr& in) { - setValue(in->readString()); + string val; + in->read(val); + setValue(val); } bool @@ -1276,13 +1287,13 @@ FreezeScript::ProxyData::destroy() void FreezeScript::ProxyData::marshal(const Ice::OutputStreamPtr& out) const { - out->writeProxy(_value); + out->write(_value); } void FreezeScript::ProxyData::unmarshal(const Ice::InputStreamPtr& in) { - _value = in->readProxy(); + in->read(_value); } bool @@ -1814,15 +1825,15 @@ FreezeScript::EnumData::marshal(const Ice::OutputStreamPtr& out) const { if(_count <= 127) { - out->writeByte(static_cast<Ice::Byte>(_value)); + out->write(static_cast<Ice::Byte>(_value)); } else if(_count <= 32767) { - out->writeShort(static_cast<Ice::Short>(_value)); + out->write(static_cast<Ice::Short>(_value)); } else { - out->writeInt(_value); + out->write(_value); } } @@ -1831,17 +1842,19 @@ FreezeScript::EnumData::unmarshal(const Ice::InputStreamPtr& in) { if(_count <= 127) { - Ice::Byte val = in ->readByte(); + Ice::Byte val; + in ->read(val); _value = val & 0xff; } else if(_count <= 32767) { - Ice::Short val = in->readShort(); + Ice::Short val; + in->read(val); _value = val; } else { - _value = in->readInt(); + in->read(_value); } } diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 0fd4c42c0a1..13786007e5b 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -459,12 +459,11 @@ Ice::BlobjectArrayAsync::__dispatch(Incoming& in, const Current& current) void Ice::ice_writeObject(const OutputStreamPtr& out, const ObjectPtr& p) { - out->writeObject(p); + out->write(p); } void Ice::ice_readObject(const InputStreamPtr& in, ObjectPtr& p) { - Ice::ReadObjectCallbackPtr cb = new ReadObjectCallbackI(__patch__ObjectPtr, &p); - in->readObject(cb); + in->read(p); } diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 8af65362363..ac40bcbcfcb 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -2150,11 +2150,11 @@ Ice::proxyIdentityAndFacetEqual(const ObjectPrx& lhs, const ObjectPrx& rhs) void Ice::ice_writeObjectPrx(const OutputStreamPtr& out, const ObjectPrx& v) { - out->writeProxy(v); + out->write(v); } void Ice::ice_readObjectPrx(const InputStreamPtr& in, ObjectPrx& v) { - v = in->readProxy(); + in->read(v); } diff --git a/cpp/src/Ice/StreamI.cpp b/cpp/src/Ice/StreamI.cpp index dd9dff21bc5..2189deed602 100644 --- a/cpp/src/Ice/StreamI.cpp +++ b/cpp/src/Ice/StreamI.cpp @@ -54,7 +54,7 @@ Ice::InputStreamI::sliceObjects(bool b) } bool -Ice::InputStreamI::readBool() +Ice::InputStreamI::internalReadBool() { bool v; _is->read(v); @@ -62,7 +62,7 @@ Ice::InputStreamI::readBool() } vector<bool> -Ice::InputStreamI::readBoolSeq() +Ice::InputStreamI::internalReadBoolSeq() { vector<bool> v; _is->read(v); @@ -70,13 +70,13 @@ Ice::InputStreamI::readBoolSeq() } bool* -Ice::InputStreamI::readBoolSeq(pair<const bool*, const bool*>& p) +Ice::InputStreamI::internalReadBoolSeq(pair<const bool*, const bool*>& p) { return _is->read(p); } Byte -Ice::InputStreamI::readByte() +Ice::InputStreamI::internalReadByte() { Byte v; _is->read(v); @@ -84,7 +84,7 @@ Ice::InputStreamI::readByte() } vector<Byte> -Ice::InputStreamI::readByteSeq() +Ice::InputStreamI::internalReadByteSeq() { pair<const Byte*, const Byte*> p; _is->read(p); @@ -93,13 +93,13 @@ Ice::InputStreamI::readByteSeq() } void -Ice::InputStreamI::readByteSeq(pair<const Byte*, const Byte*>& p) +Ice::InputStreamI::internalReadByteSeq(pair<const Byte*, const Byte*>& p) { _is->read(p); } Short -Ice::InputStreamI::readShort() +Ice::InputStreamI::internalReadShort() { Short v; _is->read(v); @@ -107,7 +107,7 @@ Ice::InputStreamI::readShort() } vector<Short> -Ice::InputStreamI::readShortSeq() +Ice::InputStreamI::internalReadShortSeq() { vector<Short> v; _is->read(v); @@ -115,13 +115,13 @@ Ice::InputStreamI::readShortSeq() } Short* -Ice::InputStreamI::readShortSeq(pair<const Short*, const Short*>& p) +Ice::InputStreamI::internalReadShortSeq(pair<const Short*, const Short*>& p) { return _is->read(p); } Int -Ice::InputStreamI::readInt() +Ice::InputStreamI::internalReadInt() { Int v; _is->read(v); @@ -129,7 +129,7 @@ Ice::InputStreamI::readInt() } vector<Int> -Ice::InputStreamI::readIntSeq() +Ice::InputStreamI::internalReadIntSeq() { vector<Int> v; _is->read(v); @@ -137,13 +137,13 @@ Ice::InputStreamI::readIntSeq() } Int* -Ice::InputStreamI::readIntSeq(pair<const Int*, const Int*>& p) +Ice::InputStreamI::internalReadIntSeq(pair<const Int*, const Int*>& p) { return _is->read(p); } Long -Ice::InputStreamI::readLong() +Ice::InputStreamI::internalReadLong() { Long v; _is->read(v); @@ -151,7 +151,7 @@ Ice::InputStreamI::readLong() } vector<Long> -Ice::InputStreamI::readLongSeq() +Ice::InputStreamI::internalReadLongSeq() { vector<Long> v; _is->read(v); @@ -159,13 +159,13 @@ Ice::InputStreamI::readLongSeq() } Long* -Ice::InputStreamI::readLongSeq(pair<const Long*, const Long*>& p) +Ice::InputStreamI::internalReadLongSeq(pair<const Long*, const Long*>& p) { return _is->read(p); } Float -Ice::InputStreamI::readFloat() +Ice::InputStreamI::internalReadFloat() { Float v; _is->read(v); @@ -173,7 +173,7 @@ Ice::InputStreamI::readFloat() } vector<Float> -Ice::InputStreamI::readFloatSeq() +Ice::InputStreamI::internalReadFloatSeq() { vector<Float> v; _is->read(v); @@ -181,13 +181,13 @@ Ice::InputStreamI::readFloatSeq() } Float* -Ice::InputStreamI::readFloatSeq(pair<const Float*, const Float*>& p) +Ice::InputStreamI::internalReadFloatSeq(pair<const Float*, const Float*>& p) { return _is->read(p); } Double -Ice::InputStreamI::readDouble() +Ice::InputStreamI::internalReadDouble() { Double v; _is->read(v); @@ -195,7 +195,7 @@ Ice::InputStreamI::readDouble() } vector<Double> -Ice::InputStreamI::readDoubleSeq() +Ice::InputStreamI::internalReadDoubleSeq() { vector<Double> v; _is->read(v); @@ -203,13 +203,13 @@ Ice::InputStreamI::readDoubleSeq() } Double* -Ice::InputStreamI::readDoubleSeq(pair<const Double*, const Double*>& p) +Ice::InputStreamI::internalReadDoubleSeq(pair<const Double*, const Double*>& p) { return _is->read(p); } string -Ice::InputStreamI::readString(bool convert) +Ice::InputStreamI::internalReadString(bool convert) { string v; _is->read(v, convert); @@ -217,7 +217,7 @@ Ice::InputStreamI::readString(bool convert) } vector<string> -Ice::InputStreamI::readStringSeq(bool convert) +Ice::InputStreamI::internalReadStringSeq(bool convert) { vector<string> v; _is->read(v, convert); @@ -225,7 +225,7 @@ Ice::InputStreamI::readStringSeq(bool convert) } wstring -Ice::InputStreamI::readWstring() +Ice::InputStreamI::internalReadWstring() { wstring v; _is->read(v); @@ -233,7 +233,7 @@ Ice::InputStreamI::readWstring() } vector<wstring> -Ice::InputStreamI::readWstringSeq() +Ice::InputStreamI::internalReadWstringSeq() { vector<wstring> v; _is->read(v); @@ -257,7 +257,7 @@ Ice::InputStreamI::readAndCheckSeqSize(int minSize) } ObjectPrx -Ice::InputStreamI::readProxy() +Ice::InputStreamI::internalReadProxy() { Ice::ObjectPrx v; _is->read(v); @@ -370,31 +370,31 @@ Ice::OutputStreamI::communicator() const } void -Ice::OutputStreamI::writeBool(bool v) +Ice::OutputStreamI::internalWriteBool(bool v) { _os->write(v); } void -Ice::OutputStreamI::writeBoolSeq(const vector<bool>& v) +Ice::OutputStreamI::internalWriteBoolSeq(const vector<bool>& v) { _os->write(v); } void -Ice::OutputStreamI::writeBoolSeq(const bool* begin, const bool* end) +Ice::OutputStreamI::internalWriteBoolSeq(const bool* begin, const bool* end) { _os->write(begin, end); } void -Ice::OutputStreamI::writeByte(Byte v) +Ice::OutputStreamI::internalWriteByte(Byte v) { _os->write(v); } void -Ice::OutputStreamI::writeByteSeq(const vector<Byte>& v) +Ice::OutputStreamI::internalWriteByteSeq(const vector<Byte>& v) { if(v.size() == 0) { @@ -407,19 +407,19 @@ Ice::OutputStreamI::writeByteSeq(const vector<Byte>& v) } void -Ice::OutputStreamI::writeByteSeq(const Byte* begin, const Byte* end) +Ice::OutputStreamI::internalWriteByteSeq(const Byte* begin, const Byte* end) { _os->write(begin, end); } void -Ice::OutputStreamI::writeShort(Short v) +Ice::OutputStreamI::internalWriteShort(Short v) { _os->write(v); } void -Ice::OutputStreamI::writeShortSeq(const vector<Short>& v) +Ice::OutputStreamI::internalWriteShortSeq(const vector<Short>& v) { if(v.size() == 0) { @@ -432,19 +432,19 @@ Ice::OutputStreamI::writeShortSeq(const vector<Short>& v) } void -Ice::OutputStreamI::writeShortSeq(const Short* begin, const Short* end) +Ice::OutputStreamI::internalWriteShortSeq(const Short* begin, const Short* end) { _os->write(begin, end); } void -Ice::OutputStreamI::writeInt(Int v) +Ice::OutputStreamI::internalWriteInt(Int v) { _os->write(v); } void -Ice::OutputStreamI::writeIntSeq(const vector<Int>& v) +Ice::OutputStreamI::internalWriteIntSeq(const vector<Int>& v) { if(v.size() == 0) { @@ -457,19 +457,19 @@ Ice::OutputStreamI::writeIntSeq(const vector<Int>& v) } void -Ice::OutputStreamI::writeIntSeq(const Int* begin, const Int* end) +Ice::OutputStreamI::internalWriteIntSeq(const Int* begin, const Int* end) { _os->write(begin, end); } void -Ice::OutputStreamI::writeLong(Long v) +Ice::OutputStreamI::internalWriteLong(Long v) { _os->write(v); } void -Ice::OutputStreamI::writeLongSeq(const vector<Long>& v) +Ice::OutputStreamI::internalWriteLongSeq(const vector<Long>& v) { if(v.size() == 0) { @@ -482,19 +482,19 @@ Ice::OutputStreamI::writeLongSeq(const vector<Long>& v) } void -Ice::OutputStreamI::writeLongSeq(const Long* begin, const Long* end) +Ice::OutputStreamI::internalWriteLongSeq(const Long* begin, const Long* end) { _os->write(begin, end); } void -Ice::OutputStreamI::writeFloat(Float v) +Ice::OutputStreamI::internalWriteFloat(Float v) { _os->write(v); } void -Ice::OutputStreamI::writeFloatSeq(const vector<Float>& v) +Ice::OutputStreamI::internalWriteFloatSeq(const vector<Float>& v) { if(v.size() == 0) { @@ -507,19 +507,19 @@ Ice::OutputStreamI::writeFloatSeq(const vector<Float>& v) } void -Ice::OutputStreamI::writeFloatSeq(const Float* begin, const Float* end) +Ice::OutputStreamI::internalWriteFloatSeq(const Float* begin, const Float* end) { _os->write(begin, end); } void -Ice::OutputStreamI::writeDouble(Double v) +Ice::OutputStreamI::internalWriteDouble(Double v) { _os->write(v); } void -Ice::OutputStreamI::writeDoubleSeq(const vector<Double>& v) +Ice::OutputStreamI::internalWriteDoubleSeq(const vector<Double>& v) { if(v.size() == 0) { @@ -532,19 +532,19 @@ Ice::OutputStreamI::writeDoubleSeq(const vector<Double>& v) } void -Ice::OutputStreamI::writeDoubleSeq(const Double* begin, const Double* end) +Ice::OutputStreamI::internalWriteDoubleSeq(const Double* begin, const Double* end) { _os->write(begin, end); } void -Ice::OutputStreamI::writeString(const string& v, bool convert) +Ice::OutputStreamI::internalWriteString(const string& v, bool convert) { _os->write(v, convert); } void -Ice::OutputStreamI::writeStringSeq(const vector<string>& v, bool convert) +Ice::OutputStreamI::internalWriteStringSeq(const vector<string>& v, bool convert) { if(v.size() == 0) { @@ -557,13 +557,13 @@ Ice::OutputStreamI::writeStringSeq(const vector<string>& v, bool convert) } void -Ice::OutputStreamI::writeWstring(const wstring& v) +Ice::OutputStreamI::internalWriteWstring(const wstring& v) { _os->write(v); } void -Ice::OutputStreamI::writeWstringSeq(const vector<wstring>& v) +Ice::OutputStreamI::internalWriteWstringSeq(const vector<wstring>& v) { if(v.size() == 0) { @@ -587,7 +587,7 @@ Ice::OutputStreamI::writeSize(Int sz) } void -Ice::OutputStreamI::writeProxy(const ObjectPrx& v) +Ice::OutputStreamI::internalWriteProxy(const ObjectPrx& v) { _os->write(v); } diff --git a/cpp/src/Ice/StreamI.h b/cpp/src/Ice/StreamI.h index d83140623eb..4017c85d7d1 100644 --- a/cpp/src/Ice/StreamI.h +++ b/cpp/src/Ice/StreamI.h @@ -31,45 +31,9 @@ public: virtual void sliceObjects(bool); - virtual bool readBool(); - 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::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::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::Double readDouble(); - virtual std::vector< Ice::Double > readDoubleSeq(); - virtual Ice::Double* readDoubleSeq(std::pair<const Ice::Double*, const Ice::Double*>&); - - virtual std::string readString(bool = true); - virtual std::vector< std::string > readStringSeq(bool = true); - - virtual std::wstring readWstring(); - virtual std::vector< std::wstring > readWstringSeq(); - virtual Ice::Int readSize(); virtual Ice::Int readAndCheckSeqSize(int); - virtual Ice::ObjectPrx readProxy(); - virtual void readObject(const Ice::ReadObjectCallbackPtr&); virtual std::string readTypeId(); @@ -89,6 +53,45 @@ public: 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 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(); Ice::CommunicatorPtr _communicator; IceInternal::BasicStream* _is; @@ -107,49 +110,13 @@ public: virtual Ice::CommunicatorPtr communicator() const; - virtual void writeBool(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 writeByteSeq(const Ice::Byte*, const Ice::Byte*); - - 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 writeIntSeq(const Ice::Int*, const Ice::Int*); - - 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 writeFloatSeq(const Ice::Float*, const Ice::Float*); - - 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&, bool = true); - virtual void writeStringSeq(const std::vector< std::string >&, bool = true); - - virtual void writeWstring(const std::wstring&); - virtual void writeWstringSeq(const std::vector< std::wstring >&); - + virtual void writeObject(const ::Ice::ObjectPtr&); + virtual void writeException(const Ice::UserException&); + virtual void writeSize(Ice::Int); - virtual void writeProxy(const Ice::ObjectPrx&); - - virtual void writeObject(const Ice::ObjectPtr&); - virtual void writeTypeId(const std::string&); - virtual void writeException(const Ice::UserException&); virtual void startSlice(); virtual void endSlice(); @@ -164,6 +131,45 @@ public: 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; IceInternal::BasicStream* _os; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index f71bfd8d7cd..b8564c4aea9 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -777,7 +777,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __outS) const"; C << sb; - C << nl << "__outS->writeString(::std::string(\"" << p->scoped() << "\"));"; + C << nl << "__outS->write(::std::string(\"" << p->scoped() << "\"));"; C << nl << "__outS->startSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { @@ -796,7 +796,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) C << sb; C << nl << "if(__rid)"; C << sb; - C << nl << "__inS->readString();"; + C << nl << "std::string s;"; + C << nl << "__inS->read(s);"; C << eb; C << nl << "__inS->startSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) @@ -1392,7 +1393,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << eb; C << nl << "v.SerializeToArray(&data[0], data.size());"; - C << nl << "__outS->writeByteSeq(data);"; + C << nl << "__outS->write(data);"; } else { @@ -1410,9 +1411,9 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << sb; if(protobuf) { - 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 << nl << "std::vectpr< ::Ice::Byte> data;"; + C << nl << "__inS->read(data);"; + C << nl << "if(!v.ParseFromArray(data.begin(), data.end()))"; C << sb; C << nl << "throw ::Ice::MarshalException(__FILE__, __LINE__, \"ParseFromArray failed\");"; C << eb; @@ -1737,54 +1738,13 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) C << nl << "void" << nl << scope.substr(2) << "ice_write" << p->name() << "(const ::Ice::OutputStreamPtr& __outS, " << scoped << " v)"; C << sb; - C << nl << "if("; - if(sz > 0x7f) - { - C << "static_cast<int>(val) < 0 || "; - } - C << "static_cast<int>(v) >= " << sz << ")"; - C << sb; - C << nl << "throw ::Ice::MarshalException(__FILE__, __LINE__, \"enumerator out of range\");"; - C << eb; - if(sz <= 0x7f) - { - C << nl << "__outS->writeByte(static_cast< ::Ice::Byte>(v));"; - } - else if(sz <= 0x7fff) - { - C << nl << "__outS->writeShort(static_cast< ::Ice::Short>(v));"; - } - else - { - C << nl << "__outS->writeInt(static_cast< ::Ice::Int>(v));"; - } + C << nl << "__outS->write(v);"; C << eb; C << sp << nl << "void" << nl << scope.substr(2) << "ice_read" << p->name() << "(const ::Ice::InputStreamPtr& __inS, " << scoped << "& v)"; C << sb; - if(sz <= 0x7f) - { - C << nl << "::Ice::Byte val = __inS->readByte();"; - } - else if(sz <= 0x7fff) - { - C << nl << "::Ice::Short val = __inS->readShort();"; - } - else - { - C << nl << "::Ice::Int val = __inS->readInt();"; - } - C << nl << "if("; - if(sz > 0x7f) - { - C << "val < 0 || "; - } - C << "val > " << sz << ")"; - C << sb; - C << nl << "throw ::Ice::MarshalException(__FILE__, __LINE__, \"enumerator out of range\");"; - C << eb; - C << nl << "v = static_cast< " << scoped << ">(val);"; + C << nl << "__inS->read(v);"; C << eb; C.zeroIndent(); C << nl << "#endif"; @@ -5767,23 +5727,14 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "void" << nl << scope.substr(2) << "ice_write" << name << "Prx(const ::Ice::OutputStreamPtr& __outS, const " << scope << name << "Prx& v)"; C << sb; - C << nl << "__outS->writeProxy(v);"; + C << nl << "__outS->write(v);"; C << eb; C << sp; C << nl << "void" << nl << scope.substr(2) << "ice_read" << name << "Prx(const ::Ice::InputStreamPtr& __inS, " << scope << name << "Prx& v)"; C << sb; - C << nl << "::Ice::ObjectPrx proxy = __inS->readProxy();"; - C << nl << "if(!proxy)"; - C << sb; - C << nl << "v = 0;"; - C << eb; - C << nl << "else"; - C << sb; - C << nl << "v = new ::IceProxy" << scoped << ';'; - C << nl << "v->__copyFrom(proxy);"; - C << eb; + C << nl << "__inS->read(v);"; C << eb; C << sp; |