diff --git a/config/Make.project.rules b/config/Make.project.rules index debfa6474c6..15163a15a28 100644 --- a/config/Make.project.rules +++ b/config/Make.project.rules @@ -840,7 +840,7 @@ endef define create-translator-project $1_programs := $(notdir $1) $1_dependencies := Slice IceUtil -$1_cppflags := -I$1 -std=c++17 +$1_cppflags := -I$1 $1_targetdir := $(call bindir,$1) # diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index 4464ce989fd..2c0d0a09164 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -16,6 +16,9 @@ ifeq ($(os),Darwin) include $(lang_srcdir)/config/Make.xcodesdk.rules endif +# We assume Make.rules.$(os) defines cppflags. +cppflags += -std=c++17 + # Validate platforms and configs $(eval $(call validate-config)) @@ -122,7 +125,7 @@ endif # the cpp11 name to the target directory if building outside the build # directory. # -cpp11_cppflags = -DICE_CPP11_MAPPING -std=c++17 +cpp11_cppflags = -DICE_CPP11_MAPPING cpp11_ldflags = $(cpp11_cppflags) cpp11_targetname = $(if $(or $(filter-out $($1_target),program),$(filter $(bindir)%,$($4_targetdir))),++11) cpp11_targetdir = $(if $(filter %/build,$5),cpp11) diff --git a/cpp/include/Ice/Communicator.h b/cpp/include/Ice/Communicator.h index 980c3d5e3c7..d6d8b7ae7f8 100644 --- a/cpp/include/Ice/Communicator.h +++ b/cpp/include/Ice/Communicator.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cpp/include/Ice/DefaultValueFactory.h b/cpp/include/Ice/DefaultValueFactory.h index 645e8f18940..8845191bb14 100644 --- a/cpp/include/Ice/DefaultValueFactory.h +++ b/cpp/include/Ice/DefaultValueFactory.h @@ -38,9 +38,9 @@ class DefaultValueFactory : public Ice::ValueFactory } #ifndef NDEBUG - virtual ::Ice::ObjectPtr create(const ::std::string& typeId) + virtual ::Ice::ValuePtr create(const ::std::string& typeId) #else - virtual ::Ice::ObjectPtr create(const ::std::string&) + virtual ::Ice::ValuePtr create(const ::std::string&) #endif { assert(typeId == _typeId); diff --git a/cpp/include/Ice/GCObject.h b/cpp/include/Ice/GCValue.h similarity index 89% rename from cpp/include/Ice/GCObject.h rename to cpp/include/Ice/GCValue.h index d08f680b31d..04675b6f31b 100644 --- a/cpp/include/Ice/GCObject.h +++ b/cpp/include/Ice/GCValue.h @@ -7,7 +7,7 @@ #ifndef ICE_CPP11_MAPPING -#include +#include #include #include @@ -15,7 +15,7 @@ namespace IceInternal { -class GCObject; +class GCValue; class GCVisitor { @@ -25,10 +25,10 @@ class GCVisitor { } - virtual bool visit(GCObject*) = 0; + virtual bool visit(GCValue*) = 0; }; -class ICE_API GCObject : public virtual Ice::Object +class ICE_API GCValue : public virtual Ice::Value { public: diff --git a/cpp/include/Ice/Handle.h b/cpp/include/Ice/Handle.h index 8455518e188..46e0bc1265f 100644 --- a/cpp/include/Ice/Handle.h +++ b/cpp/include/Ice/Handle.h @@ -12,7 +12,7 @@ // "Handle" or "smart pointer" template for classes derived from // IceInternal::GCShared, IceUtil::Shared, or IceUtil::SimpleShared. // -// In constrast to IceUtil::Handle, IceInternal::Handle can be used +// In contrast to IceUtil::Handle, IceInternal::Handle can be used // for a type T that has been declared but not defined. The only // requirement is a declaration of the following function: // diff --git a/cpp/include/Ice/Ice.h b/cpp/include/Ice/Ice.h index 53b1981bc4d..15340e7e161 100644 --- a/cpp/include/Ice/Ice.h +++ b/cpp/include/Ice/Ice.h @@ -48,7 +48,6 @@ # include # include # include -# include # include # include # include diff --git a/cpp/include/Ice/InputStream.h b/cpp/include/Ice/InputStream.h index 621f4eec533..7f4380149ca 100644 --- a/cpp/include/Ice/InputStream.h +++ b/cpp/include/Ice/InputStream.h @@ -37,7 +37,7 @@ patchHandle(void* addr, const ValuePtr& v) } #else IceInternal::Handle* p = static_cast*>(addr); - _icePatchObjectPtr(*p, v); // Generated _icePatchObjectPtr function, necessary for forward declarations. + _icePatchValuePtr(*p, v); // Generated _icePatchValuePtr function, necessary for forward declarations. #endif } /// \endcond diff --git a/cpp/include/Ice/InterfaceByValue.h b/cpp/include/Ice/InterfaceByValue.h deleted file mode 100644 index 56901a625ac..00000000000 --- a/cpp/include/Ice/InterfaceByValue.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#ifndef ICE_INTERFACE_BY_VALUE_H -#define ICE_INTERFACE_BY_VALUE_H - -#include -#include -#include - -#ifdef ICE_CPP11_MAPPING - -namespace Ice -{ - -/** - * Represents an instance of a Slice interface that was marshaled by value. - * \headerfile Ice/Ice.h - */ -template -class InterfaceByValue : public ValueHelper, Value> -{ -public: - /** - * Obtains the Slice type ID of this exception. - * @return The fully-scoped type ID. - */ - virtual std::string ice_id() const - { - return T::ice_staticId(); - } - - /** - * Obtains the Slice type ID of this exception. - * @return The fully-scoped type ID. - */ - static const std::string& ice_staticId() - { - return T::ice_staticId(); - } - - /** - * Returns an empty tuple. - * @return The empty tuple. - */ - std::tuple<> ice_tuple() const - { - return std::tie(); - } -}; - -} - -#endif - -#endif diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h index 7fb3afdf8b6..12c7785ce09 100644 --- a/cpp/include/Ice/Object.h +++ b/cpp/include/Ice/Object.h @@ -14,20 +14,11 @@ #include #include -namespace Ice -{ - -class OutputStream; -class InputStream; - -} - namespace IceInternal { class Incoming; class Direct; -class GCVisitor; } @@ -189,7 +180,7 @@ class ICE_API Object * The base class for servants. * \headerfile Ice/Ice.h */ -class ICE_API Object : public virtual IceUtil::Shared +class ICE_API Object : public virtual IceUtil::Shared { public: @@ -239,80 +230,12 @@ class ICE_API Object : public virtual IceUtil::Shared bool _iceD_ice_id(IceInternal::Incoming&, const Current&); /// \endcond - /** - * Returns the Freeze metadata attributes for an operation. - * - * @param operation The name of the operation. - * @return The least significant bit indicates whether the operation is a read - * or write operation. If the bit is set, the operation is a write operation. - * The expression ice_operationAttributes("op") & 0x1 is true if - * the operation has a ["freeze:write"] metadata directive. - *

- * The second and third least significant bit indicate the transactional mode - * of the operation. The expression ice_operationAttributes("op") & 0x6 >> 1 - * indicates the transactional mode as follows: - *

- *
0
- *
["freeze:read:supports"]
- *
1
- *
["freeze:read:mandatory"] or ["freeze:write:mandatory"]
- *
2
- *
["freeze:read:required"] or ["freeze:write:required"]
- *
3
- *
["freeze:read:never"]
- *
- * - * Refer to the Freeze manual for more information on the TransactionalEvictor. - */ - virtual Int ice_operationAttributes(const std::string& operation) const; - - /// \cond STREAM - virtual void _iceWrite(Ice::OutputStream*) const; - virtual void _iceRead(Ice::InputStream*); - /// \endcond - - /// \cond INTERNAL - virtual bool _iceGcVisit(IceInternal::GCVisitor&) { return false; } - /// \endcond - - /** - * Determines whether this object, and by extension the graph of all objects reachable from this object, - * are eligible for garbage collection when all external references to the graph have been released. - * @param b True if the object is eligible, false otherwise. - */ - virtual void ice_collectable(bool b); - - /** - * The Ice run time invokes this method prior to marshaling an object's data members. This allows a subclass - * to override this method in order to validate its data members. - */ - virtual void ice_preMarshal(); - - /** - * The Ice run time invokes this method vafter unmarshaling an object's data members. This allows a - * subclass to override this method in order to perform additional initialization. - */ - virtual void ice_postUnmarshal(); - /** * Obtains the Slice type ID of this type. * @return The return value is always "::Ice::Object". */ static const std::string& ice_staticId(); - /** - * Returns a shallow copy of the object. - * @return The cloned object. - */ - virtual ObjectPtr ice_clone() const; - - /** - * Obtains the sliced data associated with this instance. - * @return The sliced data if the value has a preserved-slice base class and has been sliced during - * unmarshaling of the value, nil otherwise. - */ - virtual SlicedDataPtr ice_getSlicedData() const; - /** * Dispatches an invocation to a servant. This method is used by dispatch interceptors to forward an invocation * to a servant (or to another interceptor). @@ -326,28 +249,11 @@ class ICE_API Object : public virtual IceUtil::Shared virtual bool _iceDispatch(IceInternal::Incoming&, const Current&); /// \endcond -protected: + protected: - Object() {} // This class is abstract. -#if defined(__clang__) -# pragma clang diagnostic push -# pragma clang diagnostic ignored "-Wdeprecated-copy-dtor" -#endif - virtual ~Object() {} -#if defined(__clang__) -# pragma clang diagnostic pop -#endif - -protected: - - /// \cond STREAM - virtual void _iceWriteImpl(Ice::OutputStream*) const {} - virtual void _iceReadImpl(Ice::InputStream*) {} - /// \endcond - - /// \cond INTERNAL - static void _iceCheckMode(OperationMode, OperationMode); - /// \endcond + /// \cond INTERNAL + static void _iceCheckMode(OperationMode, OperationMode); + /// \endcond }; #endif diff --git a/cpp/include/Ice/ObjectAdapter.h b/cpp/include/Ice/ObjectAdapter.h index 25de8cee746..d66dc6c35cb 100644 --- a/cpp/include/Ice/ObjectAdapter.h +++ b/cpp/include/Ice/ObjectAdapter.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cpp/include/Ice/ObjectF.h b/cpp/include/Ice/ObjectF.h index 980df752fcd..c4cde83c57e 100644 --- a/cpp/include/Ice/ObjectF.h +++ b/cpp/include/Ice/ObjectF.h @@ -19,9 +19,8 @@ using ObjectPtr = ::std::shared_ptr; #else ICE_API Object* upCast(Object*); typedef IceInternal::Handle ObjectPtr; -typedef ObjectPtr ValuePtr; /// \cond INTERNAL -ICE_API void _icePatchObjectPtr(ObjectPtr&, const ObjectPtr&); +ICE_API void _icePatchValuePtr(ObjectPtr&, const ObjectPtr&); /// \endcond #endif diff --git a/cpp/include/Ice/OutputStream.h b/cpp/include/Ice/OutputStream.h index 886ec28fa49..d1915dd2f81 100644 --- a/cpp/include/Ice/OutputStream.h +++ b/cpp/include/Ice/OutputStream.h @@ -7,8 +7,14 @@ #include #include -#include -#include + +// TODO: temporary +#ifdef ICE_CPP11_MAPPING +# include +#else +# include +#endif + #include #include #include @@ -794,7 +800,7 @@ class ICE_API OutputStream : public IceInternal::Buffer * Writes a value instance to the stream. * @param v The value to be written. */ - void write(const ObjectPtr& v) + void write(const ValuePtr& v) { initEncaps(); _currentEncaps->encoder->write(v); @@ -806,7 +812,7 @@ class ICE_API OutputStream : public IceInternal::Buffer */ template void write(const IceInternal::Handle& v) { - write(ObjectPtr(upCast(v.get()))); + write(ValuePtr(upCast(v.get()))); } #endif diff --git a/cpp/include/Ice/Properties.h b/cpp/include/Ice/Properties.h index fcc1a63b703..a9af97d4e93 100644 --- a/cpp/include/Ice/Properties.h +++ b/cpp/include/Ice/Properties.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cpp/include/Ice/PropertiesF.h b/cpp/include/Ice/PropertiesF.h index ebb7f686dca..61ca36187c2 100644 --- a/cpp/include/Ice/PropertiesF.h +++ b/cpp/include/Ice/PropertiesF.h @@ -116,7 +116,7 @@ typedef ::IceInternal::Handle< PropertiesAdmin> PropertiesAdminPtr; typedef ::IceInternal::ProxyHandle< ::IceProxy::Ice::PropertiesAdmin> PropertiesAdminPrx; typedef PropertiesAdminPrx PropertiesAdminPrxPtr; /// \cond INTERNAL -ICE_API void _icePatchObjectPtr(PropertiesAdminPtr&, const ObjectPtr&); +ICE_API void _icePatchValuePtr(PropertiesAdminPtr&, const ObjectPtr&); /// \endcond } diff --git a/cpp/include/Ice/SlicedData.h b/cpp/include/Ice/SlicedData.h index ee57acb34bf..3b579ca513f 100644 --- a/cpp/include/Ice/SlicedData.h +++ b/cpp/include/Ice/SlicedData.h @@ -6,7 +6,7 @@ #define ICE_SLICED_DATA_H #include -#include +#include #include namespace Ice @@ -93,7 +93,7 @@ class ICE_API UnknownSlicedValue : #ifdef ICE_CPP11_MAPPING public Value #else - public IceInternal::GCObject + public IceInternal::GCValue #endif { public: @@ -146,10 +146,9 @@ class ICE_API UnknownSlicedValue : /** * Determine the Slice type ID associated with this instance. - * @param current The current object for this invocation. * @return The type ID supplied to the constructor. */ - virtual const std::string& ice_id(const Current& current = Ice::emptyCurrent) const; + virtual std::string ice_id() const; /// \cond INTERNAL virtual void _iceGcVisitMembers(IceInternal::GCVisitor&); diff --git a/cpp/include/Ice/Value.h b/cpp/include/Ice/Value.h index fa7f50c9b9c..738870dbc01 100644 --- a/cpp/include/Ice/Value.h +++ b/cpp/include/Ice/Value.h @@ -5,17 +5,31 @@ #ifndef ICE_VALUE_H #define ICE_VALUE_H -#ifdef ICE_CPP11_MAPPING // C++11 mapping +// TODO: temporary +#ifdef ICE_CPP11_MAPPING +# include +#else +# include +#endif -#include #include -#include -#include +namespace Ice +{ + class OutputStream; + class InputStream; +} + +namespace IceInternal +{ + class GCVisitor; +} namespace Ice { +#ifdef ICE_CPP11_MAPPING // C++11 mapping + /** * The base class for instances of Slice classes. * \headerfile Ice/Ice.h @@ -25,7 +39,7 @@ class ICE_API Value public: // See "Rule of zero" at http://en.cppreference.com/w/cpp/language/rule_of_three - // The virtual dtor is actually not stricly necessary since Values are always stored + // The virtual dtor is actually not strictly necessary since Values are always stored // in std::shared_ptr Value() = default; @@ -133,7 +147,90 @@ template class ValueHelper : public Base }; /// \endcond +#else // end C++11 mapping + +/** + * The base class for instances of Slice classes. + * \headerfile Ice/Ice.h + */ +class ICE_API Value : public virtual IceUtil::Shared +{ +public: + + virtual bool operator==(const Value&) const; + virtual bool operator<(const Value&) const; + + /// \cond STREAM + virtual void _iceWrite(Ice::OutputStream*) const; + virtual void _iceRead(Ice::InputStream*); + /// \endcond + + /// \cond INTERNAL + virtual bool _iceGcVisit(IceInternal::GCVisitor&) { return false; } + /// \endcond + + /** + * Determines whether this object, and by extension the graph of all objects reachable from this object, + * are eligible for garbage collection when all external references to the graph have been released. + * @param b True if the object is eligible, false otherwise. + */ + virtual void ice_collectable(bool b); + + /** + * The Ice run time invokes this method prior to marshaling an object's data members. This allows a subclass + * to override this method in order to validate its data members. + */ + virtual void ice_preMarshal(); + + /** + * The Ice run time invokes this method vafter unmarshaling an object's data members. This allows a + * subclass to override this method in order to perform additional initialization. + */ + virtual void ice_postUnmarshal(); + + /** + * Obtains the Slice type ID of the most-derived class implemented by this instance. + * @return The type ID. + */ + virtual std::string ice_id() const; + + /** + * Obtains the Slice type ID of this type. + * @return The return value is always "::Ice::Object". + */ + static const std::string& ice_staticId(); + + /** + * Returns a shallow copy of the object. + * @return The cloned object. + */ + virtual ValuePtr ice_clone() const; + + /** + * Obtains the sliced data associated with this instance. + * @return The sliced data if the value has a preserved-slice base class and has been sliced during + * unmarshaling of the value, nil otherwise. + */ + virtual SlicedDataPtr ice_getSlicedData() const; + +protected: + + Value() = default; + Value(const Value&) = default; + Value(Value&&) = default; + Value& operator=(const Value&) = default; + Value& operator=(Value&&) = default; + virtual ~Value() = default; + +protected: + + /// \cond STREAM + virtual void _iceWriteImpl(Ice::OutputStream*) const {} + virtual void _iceReadImpl(Ice::InputStream*) {} + /// \endcond +}; +#endif + } -#endif // C++11 mapping end #endif diff --git a/cpp/include/Ice/ValueF.h b/cpp/include/Ice/ValueF.h index 414be673592..56a29f81122 100644 --- a/cpp/include/Ice/ValueF.h +++ b/cpp/include/Ice/ValueF.h @@ -5,17 +5,27 @@ #ifndef ICE_VALUE_F_H #define ICE_VALUE_F_H -#ifdef ICE_CPP11_MAPPING #include +#include namespace Ice { + class Value; + +#ifdef ICE_CPP11_MAPPING -class Value; /// \cond INTERNAL using ValuePtr = ::std::shared_ptr; /// \endcond -} +#else + +ICE_API Value* upCast(Value*); +typedef IceInternal::Handle ValuePtr; +/// \cond INTERNAL +ICE_API void _icePatchValuePtr(ValuePtr&, const ValuePtr&); +/// \endcond #endif +} + #endif diff --git a/cpp/include/IceBox/Service.h b/cpp/include/IceBox/Service.h index f892af8c865..f82f62dfe48 100644 --- a/cpp/include/IceBox/Service.h +++ b/cpp/include/IceBox/Service.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cpp/include/IceGrid/PluginFacade.h b/cpp/include/IceGrid/PluginFacade.h index 070426eb554..70710c4079e 100644 --- a/cpp/include/IceGrid/PluginFacade.h +++ b/cpp/include/IceGrid/PluginFacade.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index 74a1928fbc7..5df56b94a0f 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -80,7 +80,7 @@ class ICE_API Shared // // Flag constant used by the Shared class. Derived classes - // such as GCObject define more flag constants. + // such as GCValue define more flag constants. // static const unsigned char NoDelete; diff --git a/cpp/src/Ice/GCObject.cpp b/cpp/src/Ice/GCValue.cpp similarity index 83% rename from cpp/src/Ice/GCObject.cpp rename to cpp/src/Ice/GCValue.cpp index 79b5bffb604..58336ac81a7 100644 --- a/cpp/src/Ice/GCObject.cpp +++ b/cpp/src/Ice/GCValue.cpp @@ -2,7 +2,7 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include +#include #ifndef ICE_CPP11_MAPPING @@ -16,7 +16,7 @@ using namespace IceInternal; namespace { -typedef ::map GCCountMap; +typedef ::map GCCountMap; Mutex* gcMutex = 0; class Init @@ -41,7 +41,7 @@ class ClearMembers : public GCVisitor { public: - virtual bool visit(GCObject*); + virtual bool visit(GCValue*); }; ClearMembers clearMembers; @@ -51,7 +51,7 @@ class DecreaseRefCounts : public GCVisitor DecreaseRefCounts(GCCountMap&); - virtual bool visit(GCObject*); + virtual bool visit(GCValue*); private: @@ -64,7 +64,7 @@ class RestoreRefCountsIfReachable : public GCVisitor RestoreRefCountsIfReachable(GCCountMap&); - virtual bool visit(GCObject*); + virtual bool visit(GCValue*); private: @@ -78,23 +78,23 @@ class MarkCollectable : public GCVisitor MarkCollectable(); - virtual bool visit(GCObject*); + virtual bool visit(GCValue*); - void visitNeighbor(GCObject*); + void visitNeighbor(GCValue*); private: int _counter; - map _numbers; - stack _p; - stack _s; + map _numbers; + stack _p; + stack _s; class VisitNeighbors : public IceInternal::GCVisitor { public: void setVisitor(MarkCollectable*); - virtual bool visit(GCObject*); + virtual bool visit(GCValue*); private: @@ -107,13 +107,13 @@ class ClearCollectable : public GCVisitor { public: - virtual bool visit(GCObject*); + virtual bool visit(GCValue*); }; } bool -ClearMembers::visit(GCObject*) +ClearMembers::visit(GCValue*) { return true; } @@ -123,7 +123,7 @@ DecreaseRefCounts::DecreaseRefCounts(GCCountMap& counts) : _counts(counts) } bool -DecreaseRefCounts::visit(GCObject* obj) +DecreaseRefCounts::visit(GCValue* obj) { // // Visit the object only once when the object is inserted for @@ -138,7 +138,7 @@ DecreaseRefCounts::visit(GCObject* obj) if(p == _counts.end()) { _counts.insert(make_pair(obj, obj->_iceGetRefUnsafe() - 1)); - if(obj->__hasFlag(GCObject::Collectable)) + if(obj->__hasFlag(GCValue::Collectable)) { obj->_iceGcVisitMembers(*this); } @@ -155,7 +155,7 @@ RestoreRefCountsIfReachable::RestoreRefCountsIfReachable(GCCountMap& counts) : _ } bool -RestoreRefCountsIfReachable::visit(GCObject* obj) +RestoreRefCountsIfReachable::visit(GCValue* obj) { GCCountMap::iterator p = _counts.find(obj); if(p == _counts.end()) @@ -208,7 +208,7 @@ MarkCollectable::MarkCollectable() : _counter(0) } bool -MarkCollectable::visit(GCObject* obj) +MarkCollectable::visit(GCValue* obj) { // // Set the collectable flag on the object graph. While setting the @@ -219,11 +219,11 @@ MarkCollectable::visit(GCObject* obj) // strong components of the graph. // - if(obj->__hasFlag(GCObject::Collectable)) + if(obj->__hasFlag(GCValue::Collectable)) { return false; } - obj->__setFlag(GCObject::Collectable); + obj->__setFlag(GCValue::Collectable); _numbers[obj] = ++_counter; _p.push(obj); @@ -233,12 +233,12 @@ MarkCollectable::visit(GCObject* obj) if(_p.top() == obj) { - GCObject* o; + GCValue* o; do { o = _s.top(); _s.pop(); - o->__setFlag(GCObject::CycleMember); + o->__setFlag(GCValue::CycleMember); } while(o != obj); _p.pop(); @@ -247,14 +247,14 @@ MarkCollectable::visit(GCObject* obj) } void -MarkCollectable::visitNeighbor(GCObject* obj) +MarkCollectable::visitNeighbor(GCValue* obj) { - map::const_iterator p = _numbers.find(obj); + map::const_iterator p = _numbers.find(obj); if(p == _numbers.end()) { visit(obj); } - else if(!obj->__hasFlag(GCObject::CycleMember)) + else if(!obj->__hasFlag(GCValue::CycleMember)) { while(_numbers[_p.top()] > p->second) { @@ -270,21 +270,21 @@ MarkCollectable::VisitNeighbors::setVisitor(MarkCollectable* visitor) } bool -MarkCollectable::VisitNeighbors::visit(GCObject* obj) +MarkCollectable::VisitNeighbors::visit(GCValue* obj) { _visitor->visitNeighbor(obj); return false; } bool -ClearCollectable::visit(GCObject* obj) +ClearCollectable::visit(GCValue* obj) { // // Clear the collectable flag on the object graph. // - if(obj->__hasFlag(GCObject::Collectable)) + if(obj->__hasFlag(GCValue::Collectable)) { - obj->__clearFlag(GCObject::Collectable | GCObject::CycleMember); + obj->__clearFlag(GCValue::Collectable | GCValue::CycleMember); obj->_iceGcVisitMembers(*this); } return false; @@ -293,22 +293,22 @@ ClearCollectable::visit(GCObject* obj) // // Flags constant used for collection of graphs. // -const unsigned char GCObject::Collectable = 2; -const unsigned char GCObject::CycleMember = 4; -const unsigned char GCObject::Visiting = 8; +const unsigned char GCValue::Collectable = 2; +const unsigned char GCValue::CycleMember = 4; +const unsigned char GCValue::Visiting = 8; // -// GCObject +// GCValue // void -IceInternal::GCObject::__incRef() +IceInternal::GCValue::__incRef() { IceUtilInternal::MutexPtrLock lock(gcMutex); ++_ref; } void -IceInternal::GCObject::__decRef() +IceInternal::GCValue::__decRef() { IceUtilInternal::MutexPtrLock lock(gcMutex); bool doDelete = false; @@ -337,27 +337,27 @@ IceInternal::GCObject::__decRef() } int -IceInternal::GCObject::__getRef() const +IceInternal::GCValue::__getRef() const { IceUtilInternal::MutexPtrLock lock(gcMutex); return _ref; } void -IceInternal::GCObject::__setNoDelete(bool b) +IceInternal::GCValue::__setNoDelete(bool b) { IceUtilInternal::MutexPtrLock lock(gcMutex); IceUtil::Shared::__setNoDelete(b); } bool -GCObject::_iceGcVisit(GCVisitor& v) +GCValue::_iceGcVisit(GCVisitor& v) { return v.visit(this); } void -GCObject::ice_collectable(bool enable) +GCValue::ice_collectable(bool enable) { IceUtilInternal::MutexPtrLock lock(gcMutex); if(enable) @@ -372,7 +372,7 @@ GCObject::ice_collectable(bool enable) } bool -GCObject::collect(IceUtilInternal::MutexPtrLock& lock) +GCValue::collect(IceUtilInternal::MutexPtrLock& lock) { GCCountMap counts; diff --git a/cpp/src/Ice/InputStream.cpp b/cpp/src/Ice/InputStream.cpp index 5cc48b188d4..030e5971733 100644 --- a/cpp/src/Ice/InputStream.cpp +++ b/cpp/src/Ice/InputStream.cpp @@ -2733,7 +2733,7 @@ Ice::InputStream::EncapsDecoder11::readSlicedData() #ifdef ICE_CPP11_MAPPING addPatchEntry(*p, &patchHandle, &instances[j++]); #else - addPatchEntry(*p, &patchHandle, &instances[j++]); + addPatchEntry(*p, &patchHandle, &instances[j++]); #endif } } diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 83d03a88e2e..ec6c2634376 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -21,12 +21,6 @@ const Current emptyCurrent = Current(); #ifndef ICE_CPP11_MAPPING Object* Ice::upCast(Object* p) { return p; } -void -Ice::_icePatchObjectPtr(ObjectPtr& obj, const ObjectPtr& v) -{ - obj = v; -} - bool Ice::Object::operator==(const Object& r) const { @@ -38,6 +32,7 @@ Ice::Object::operator<(const Object& r) const { return this < &r; } + #endif namespace @@ -108,20 +103,6 @@ Ice::Object::ice_staticId() return object_ids[0]; } -#ifndef ICE_CPP11_MAPPING -Ice::ObjectPtr -Ice::Object::ice_clone() const -{ - throw CloneNotImplementedException(__FILE__, __LINE__); -} - -Ice::SlicedDataPtr -Ice::Object::ice_getSlicedData() const -{ - return 0; -} -#endif - bool Ice::Object::_iceD_ice_isA(Incoming& inS, const Current& current) { @@ -250,45 +231,6 @@ Ice::Object::_iceDispatch(Incoming& in, const Current& current) } } -#ifndef ICE_CPP11_MAPPING -void -Ice::Object::ice_collectable(bool) -{ -} - -void -Ice::Object::ice_preMarshal() -{ -} - -void -Ice::Object::ice_postUnmarshal() -{ -} - -void -Ice::Object::_iceWrite(Ice::OutputStream* os) const -{ - os->startValue(0); - _iceWriteImpl(os); - os->endValue(); -} - -void -Ice::Object::_iceRead(Ice::InputStream* is) -{ - is->startValue(); - _iceReadImpl(is); - is->endValue(false); -} - -Ice::Int -Ice::Object::ice_operationAttributes(const string&) const -{ - return 0; -} -#endif - namespace { diff --git a/cpp/src/Ice/SlicedData.cpp b/cpp/src/Ice/SlicedData.cpp index 43b5338a1a6..154515271b3 100644 --- a/cpp/src/Ice/SlicedData.cpp +++ b/cpp/src/Ice/SlicedData.cpp @@ -2,9 +2,9 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include #include #include +#include using namespace std; using namespace Ice; @@ -52,7 +52,7 @@ Ice::SlicedData::_iceGcVisitMembers(IceInternal::GCVisitor& visitor) // for(SliceInfoSeq::const_iterator p = slices.begin(); p != slices.end(); ++p) { - for(vector::iterator q = (*p)->instances.begin(); q != (*p)->instances.end(); ++q) + for(vector::iterator q = (*p)->instances.begin(); q != (*p)->instances.end(); ++q) { if(q->get()->_iceGcVisit(visitor)) { @@ -95,8 +95,8 @@ Ice::UnknownSlicedValue::_iceCloneImpl() const #else -const string& -Ice::UnknownSlicedValue::ice_id(const Current&) const +string +Ice::UnknownSlicedValue::ice_id() const { return _unknownTypeId; } diff --git a/cpp/src/Ice/Value.cpp b/cpp/src/Ice/Value.cpp index 28c9be9e794..0b09dbf56fa 100644 --- a/cpp/src/Ice/Value.cpp +++ b/cpp/src/Ice/Value.cpp @@ -2,16 +2,22 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // -#include -#include #include #include - -#ifdef ICE_CPP11_MAPPING +#include +#include using namespace std; using namespace Ice; using namespace IceInternal; +namespace +{ + +const string iceObject = "::Ice::Object"; + +} + +#ifdef ICE_CPP11_MAPPING void Ice::Value::ice_preMarshal() @@ -39,35 +45,102 @@ Ice::Value::_iceRead(Ice::InputStream* is) is->endValue(false); } -namespace +string +Ice::Value::ice_id() const +{ + return ice_staticId(); +} + +const string& +Ice::Value::ice_staticId() { + return iceObject; +} -const string object_ids[] = +shared_ptr +Ice::Value::ice_clone() const { - "::Ice::Object" -}; + return _iceCloneImpl(); +} +shared_ptr +Ice::Value::ice_getSlicedData() const +{ + return nullptr; +} + +#else + +Value* Ice::upCast(Value* p) { return p; } + +void +Ice::_icePatchValuePtr(ValuePtr& obj, const ValuePtr& v) +{ + obj = v; +} + +bool +Ice::Value::operator==(const Value& r) const +{ + return this == &r; +} + +bool +Ice::Value::operator<(const Value& r) const +{ + return this < &r; +} + +void +Ice::Value::ice_collectable(bool) +{ +} + +void +Ice::Value::ice_preMarshal() +{ +} + +void +Ice::Value::ice_postUnmarshal() +{ +} + +void +Ice::Value::_iceWrite(Ice::OutputStream* os) const +{ + os->startValue(0); + _iceWriteImpl(os); + os->endValue(); +} + +void +Ice::Value::_iceRead(Ice::InputStream* is) +{ + is->startValue(); + _iceReadImpl(is); + is->endValue(false); } string Ice::Value::ice_id() const { - return object_ids[0]; + return ice_staticId(); } const string& Ice::Value::ice_staticId() { - return object_ids[0]; + return iceObject; } -shared_ptr +Ice::ValuePtr Ice::Value::ice_clone() const { - return _iceCloneImpl(); + throw CloneNotImplementedException(__FILE__, __LINE__); } -shared_ptr +Ice::SlicedDataPtr Ice::Value::ice_getSlicedData() const { return nullptr; diff --git a/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj b/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj index a44700b4429..e718a56b474 100644 --- a/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj +++ b/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj @@ -619,7 +619,7 @@ - + diff --git a/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj.filters b/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj.filters index a9eb60bfb47..6e362bd97bc 100644 --- a/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj.filters +++ b/cpp/src/Ice/msbuild/ice++11/ice++11.vcxproj.filters @@ -378,7 +378,7 @@ Source Files - + Source Files diff --git a/cpp/src/Ice/msbuild/ice/ice.vcxproj b/cpp/src/Ice/msbuild/ice/ice.vcxproj index 85afc57fec9..c5be624da84 100644 --- a/cpp/src/Ice/msbuild/ice/ice.vcxproj +++ b/cpp/src/Ice/msbuild/ice/ice.vcxproj @@ -624,7 +624,7 @@ - + diff --git a/cpp/src/Ice/msbuild/ice/ice.vcxproj.filters b/cpp/src/Ice/msbuild/ice/ice.vcxproj.filters index 60a3b3fd83f..311813b0572 100644 --- a/cpp/src/Ice/msbuild/ice/ice.vcxproj.filters +++ b/cpp/src/Ice/msbuild/ice/ice.vcxproj.filters @@ -377,7 +377,7 @@ Source Files - + Source Files diff --git a/cpp/src/IceStorm/Instrumentation.h b/cpp/src/IceStorm/Instrumentation.h index 122974952ce..490a409c0d6 100644 --- a/cpp/src/IceStorm/Instrumentation.h +++ b/cpp/src/IceStorm/Instrumentation.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/cpp/src/IceUtil/Shared.cpp b/cpp/src/IceUtil/Shared.cpp index a385e191726..a06ff11a5f6 100644 --- a/cpp/src/IceUtil/Shared.cpp +++ b/cpp/src/IceUtil/Shared.cpp @@ -8,7 +8,7 @@ using namespace IceUtil; // // Flag constant used by the Shared class. Derived classes -// such as GCObject define more flag constants. +// such as GCValue define more flag constants. // const unsigned char IceUtil::Shared::NoDelete = 1; diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 8a24331e3a7..1cc43bb7fe0 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -641,7 +641,7 @@ Slice::typeToString(const TypePtr& type, const string& scope, const StringList& "::Ice::Float", "::Ice::Double", "::std::string", - "::Ice::ObjectPtr", + "::Ice::ValuePtr", "::Ice::ObjectPrx", "::Ice::ValuePtr" }; @@ -656,7 +656,7 @@ Slice::typeToString(const TypePtr& type, const string& scope, const StringList& "float", "double", "::std::string", - "::std::shared_ptr<::Ice::Object>", + "::std::shared_ptr<::Ice::Value>", "::std::shared_ptr<::Ice::ObjectPrx>", "::std::shared_ptr<::Ice::Value>" }; @@ -794,7 +794,7 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const string& scope "::Ice::Float", "::Ice::Double", "const ::std::string&", - "const ::Ice::ObjectPtr&", + "const ::Ice::ValuePtr&", "const ::Ice::ObjectPrx&", "const ::Ice::ValuePtr&" }; @@ -809,7 +809,7 @@ Slice::inputTypeToString(const TypePtr& type, bool optional, const string& scope "float", "double", "const ::std::string&", - "const ::std::shared_ptr<::Ice::Object>&", + "const ::std::shared_ptr<::Ice::Value>&", "const ::std::shared_ptr<::Ice::ObjectPrx>&", "const ::std::shared_ptr<::Ice::Value>&" }; @@ -928,7 +928,7 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const string& scop "::Ice::Float&", "::Ice::Double&", "::std::string&", - "::Ice::ObjectPtr&", + "::Ice::ValuePtr&", "::Ice::ObjectPrxPtr&", "::Ice::ValuePtr&" }; @@ -943,7 +943,7 @@ Slice::outputTypeToString(const TypePtr& type, bool optional, const string& scop "float&", "double&", "::std::string&", - "::std::shared_ptr<::Ice::Object>&", + "::std::shared_ptr<::Ice::Value>&", "::std::shared_ptr<::Ice::ObjectPrx>&", "::std::shared_ptr<::Ice::Value>&" }; diff --git a/cpp/src/Slice/Makefile.mk b/cpp/src/Slice/Makefile.mk index ceb33bae003..5e514e09d7f 100644 --- a/cpp/src/Slice/Makefile.mk +++ b/cpp/src/Slice/Makefile.mk @@ -6,7 +6,6 @@ $(project)_libraries := Slice Slice_targetdir := $(libdir) Slice_libs := mcpp -Slice_cppflags := -std=c++17 # Always enable the static configuration for the Slice library and never # install it diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index b4e595cd98a..4f68b0c1e17 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -592,6 +592,7 @@ emitOpNameResult(IceUtilInternal::Output& H, const OperationPtr& p, int useWstri { string name = p->name(); + ContainerPtr container = p->container(); InterfaceDefPtr interface = p->interface(); string interfaceScope = fixKwd(interface->scope()); @@ -2593,7 +2594,7 @@ Slice::Gen::DeclVisitor::visitClassDecl(const ClassDeclPtr& p) // depends on this name // H << nl << "/// \\cond INTERNAL"; - H << nl << _dllExport << getUnqualified("::Ice::Object*", scope) << " upCast(" << name << "*);"; + H << nl << _dllExport << getUnqualified("::Ice::Value*", scope) << " upCast(" << name << "*);"; H << nl << "/// \\endcond"; H << nl << "typedef ::IceInternal::Handle< " << name << "> " << p->name() << "Ptr;"; @@ -2602,8 +2603,8 @@ Slice::Gen::DeclVisitor::visitClassDecl(const ClassDeclPtr& p) // is allowed to define classes, functions etc. that start with _. // H << nl << "/// \\cond INTERNAL"; - H << nl << _dllExport << "void _icePatchObjectPtr(" << p->name() << "Ptr&, const " - << getUnqualified("::Ice::ObjectPtr&", scope) << ");"; + H << nl << _dllExport << "void _icePatchValuePtr(" << p->name() << "Ptr&, const " + << getUnqualified("::Ice::ValuePtr&", scope) << ");"; H << nl << "/// \\endcond"; } @@ -2890,72 +2891,6 @@ Slice::Gen::InterfaceVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) C << eb; C << eb; C << nl << "/// \\endcond"; - - // - // Check if we need to generate ice_operationAttributes() - // - map attributesMap; - for(OperationList::iterator r = allOps.begin(); r != allOps.end(); ++r) - { - int attributes = (*r)->attributes(); - if(attributes != 0) - { - attributesMap.insert(map::value_type((*r)->name(), attributes)); - } - } - - if(!attributesMap.empty()) - { - H << sp; - H << nl << "/// \\cond INTERNAL"; - H << nl << "virtual " << getUnqualified("::Ice::Int", scope) - << " ice_operationAttributes(const ::std::string&) const;"; - H << nl << "/// \\endcond"; - - string opAttrFlatName = "iceC" + p->flattenedScope() + p->name() + "_operationAttributes"; - - C << sp << nl << "namespace"; - C << nl << "{"; - C << nl << "const int " << opAttrFlatName << "[] = "; - C << sb; - - for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();) - { - int attributes = 0; - string opName = *q; - map::iterator it = attributesMap.find(opName); - if(it != attributesMap.end()) - { - attributes = it->second; - } - C << nl << attributes; - - if(++q != allOpNames.end()) - { - C << ','; - } - C << " // " << opName; - } - - C << eb << ';'; - C << sp << nl << "}"; - - C << sp; - - C << nl << "::Ice::Int" << nl << scoped.substr(2) - << "::ice_operationAttributes(const ::std::string& opName) const"; - C << sb; - - C << nl << "::std::pair r = " - << "::std::equal_range(" << flatName << ", " << flatName << " + " << allOpNames.size() << ", opName);"; - C << nl << "if(r.first == r.second)"; - C << sb; - C << nl << "return -1;"; - C << eb; - - C << nl << "return " << opAttrFlatName << "[r.first - " << flatName << "];"; - C << eb; - } } H << eb << ';'; @@ -3224,14 +3159,14 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) } else { - H << "public virtual " << getUnqualified("::Ice::Object", scope); + H << "public virtual " << getUnqualified("::Ice::Value", scope); } bool override = p->canBeCyclic() && (!base || !base->canBeCyclic()); - bool hasGCObjectBaseClass = basePreserved || override || preserved; + bool hasGCValueBaseClass = basePreserved || override || preserved; if(!basePreserved && (override || preserved)) { - H << ", public ::IceInternal::GCObject"; + H << ", public ::IceInternal::GCValue"; } H.restoreIndent(); @@ -3294,7 +3229,7 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) C << sp; C << nl << "/// \\cond INTERNAL"; - C << nl << _dllExport << "::Ice::Object* " << scope.substr(2) << "upCast(" << name << "* p) { return p; }" << nl; + C << nl << _dllExport << "::Ice::Value* " << scope.substr(2) << "upCast(" << name << "* p) { return p; }" << nl; C << nl << "/// \\endcond"; // @@ -3307,9 +3242,9 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) H << nl << " * Polymorphically clones this object."; H << nl << " * @return A shallow copy of this object."; H << nl << " */"; - H << nl << "virtual " << getUnqualified("::Ice::ObjectPtr", scope) << " ice_clone() const;"; + H << nl << "virtual " << getUnqualified("::Ice::ValuePtr", scope) << " ice_clone() const;"; - if(hasGCObjectBaseClass) + if(hasGCValueBaseClass) { C.zeroIndent(); C << sp; @@ -3319,14 +3254,14 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) C << nl << "#endif"; C.restoreIndent(); } - C << nl << "::Ice::ObjectPtr"; + C << nl << "::Ice::ValuePtr"; C << nl << scoped.substr(2) << "::ice_clone() const"; C << sb; - C << nl << getUnqualified("::Ice::Object*", scope) << " p = new " << name << "(*this);"; + C << nl << getUnqualified("::Ice::Value*", scope) << " p = new " << name << "(*this);"; C << nl << "return p;"; C << eb; - if(hasGCObjectBaseClass) + if(hasGCValueBaseClass) { C.zeroIndent(); C << nl << "#if defined(_MSC_VER)"; @@ -3335,95 +3270,31 @@ Slice::Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) C.restoreIndent(); } - ClassList allBases = p->allBases(); - StringList ids; - transform( - allBases.begin(), allBases.end(), back_inserter(ids), [](const ContainedPtr& it) { return it->scoped(); }); - StringList other; - other.push_back(p->scoped()); - other.push_back("::Ice::Object"); - other.sort(); - ids.merge(other); - ids.unique(); - StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped()); - assert(scopedIter != ids.end()); - H << sp; H << nl << "/**"; - H << nl << " * Determines whether this object supports an interface with the given Slice type ID."; - H << nl << " * @param id The fully-scoped Slice type ID."; - H << nl << " * @param current The Current object for the invocation."; - H << nl << " * @return True if this object supports the interface, false, otherwise."; + H << nl << " * Obtains the Slice type ID of the most-derived class implemented by this instance."; + H << nl << " * @return The type ID."; H << nl << " */"; - H << nl << "virtual bool ice_isA(const ::std::string& id, const " << getUnqualified("::Ice::Current&", scope) - << " current = " << getUnqualified("::Ice::emptyCurrent", scope) << ") const;"; - H << sp; - H << nl << "/**"; - H << nl << " * Obtains a list of the Slice type IDs representing the interfaces supported by this object."; - H << nl << " * @param current The Current object for the invocation."; - H << nl << " * @return A list of fully-scoped type IDs."; - H << nl << " */"; - H << nl << "virtual ::std::vector< ::std::string> ice_ids(const " << getUnqualified("::Ice::Current&", scope) - << " current = " << getUnqualified("::Ice::emptyCurrent", scope) << ") const;"; - H << sp; - H << nl << "/**"; - H << nl << " * Obtains a Slice type ID representing the most-derived interface supported by this object."; - H << nl << " * @param current The Current object for the invocation."; - H << nl << " * @return A fully-scoped type ID."; - H << nl << " */"; - H << nl << "virtual const ::std::string& ice_id(const " << getUnqualified("::Ice::Current&", scope) - << " current = " << getUnqualified("::Ice::emptyCurrent", scope) << ") const;"; + H << nl << "virtual ::std::string ice_id() const;"; H << sp; H << nl << "/**"; H << nl << " * Obtains the Slice type ID corresponding to this class."; - H << nl << " * @return A fully-scoped type ID."; + H << nl << " * @return The type ID."; H << nl << " */"; H << nl << "static const ::std::string& ice_staticId();"; - string flatName = "iceC" + p->flattenedScope() + p->name() + "_ids"; - - C << sp << nl << "namespace"; - C << nl << "{"; - C << nl << "const ::std::string " << flatName << '[' << ids.size() << "] ="; - C << sb; - - for(StringList::const_iterator r = ids.begin(); r != ids.end();) - { - C << nl << '"' << *r << '"'; - if(++r != ids.end()) - { - C << ','; - } - } - C << eb << ';'; - C << sp << nl << "}"; - C << sp; - C << nl << "bool" << nl << scoped.substr(2) << "::ice_isA(const ::std::string& s, const " - << getUnqualified("::Ice::Current&", scope) << ") const"; - C << sb; - C << nl << "return ::std::binary_search(" << flatName << ", " << flatName << " + " << ids.size() << ", s);"; - C << eb; - - C << sp; - C << nl << "::std::vector< ::std::string>" << nl << scoped.substr(2) << "::ice_ids(const " - << getUnqualified("::Ice::Current&", scope) << ") const"; - C << sb; - C << nl << "return ::std::vector< ::std::string>(&" << flatName << "[0], &" << flatName << '[' << ids.size() - << "]);"; - C << eb; - - C << sp; - C << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_id(const " - << getUnqualified("::Ice::Current&", scope) << ") const"; + C << nl << "std::string" << nl << scoped.substr(2) << "::ice_id() const"; C << sb; C << nl << "return ice_staticId();"; C << eb; - C << sp; - C << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_staticId()"; + C << sp << nl << "const ::std::string&" << nl << scoped.substr(2) << "::ice_staticId()"; C << sb; - C << nl << "static const ::std::string typeId = \"" << *scopedIter << "\";"; + // + // Use local static so that ice_staticId() is usable during static construction. + // + C << nl << "static const ::std::string typeId = \"" << p->scoped() << "\";"; C << nl << "return typeId;"; C << eb; @@ -3647,8 +3518,8 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << sp; C << nl << "/// \\cond INTERNAL"; C << nl << "void"; - C << nl << scope.substr(2) << "_icePatchObjectPtr(" << p->name() << "Ptr& handle, const " - << getUnqualified("::Ice::ObjectPtr&", scope) << " v)"; + C << nl << scope.substr(2) << "_icePatchValuePtr(" << p->name() << "Ptr& handle, const " + << getUnqualified("::Ice::ValuePtr&", scope) << " v)"; C << sb; C << nl << "handle = " << p->name() << "Ptr::dynamicCast(v);"; C << nl << "if(v && !handle)"; @@ -3662,14 +3533,14 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) H << nl << "/// \\cond INTERNAL"; H << nl << "inline bool operator==(const " << fixKwd(p->name()) << "& lhs, const " << fixKwd(p->name()) << "& rhs)"; H << sb; - H << nl << "return static_cast(lhs) == static_cast(rhs);"; + H << nl << "return static_cast(lhs) == static_cast(rhs);"; H << eb; H << sp; H << nl << "inline bool operator<(const " << fixKwd(p->name()) << "& lhs, const " << fixKwd(p->name()) << "& rhs)"; H << sb; - H << nl << "return static_cast(lhs) < static_cast(rhs);"; + H << nl << "return static_cast(lhs) < static_cast(rhs);"; H << eb; H << nl << "/// \\endcond"; @@ -3949,7 +3820,7 @@ Slice::Gen::ObjectVisitor::emitUpcall(const ClassDefPtr& base, const string& cal } else { - C << getUnqualified("::Ice::Object", scope); + C << getUnqualified("::Ice::Value", scope); } C << call; } diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index 12856fa334f..eaa36939067 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -765,6 +765,7 @@ Slice::Gen::generate(const UnitPtr& p) { _H << nl << "#import "; _H << nl << "#import "; + _H << nl << "#import "; _H << nl << "#import "; } @@ -934,7 +935,6 @@ Slice::Gen::DeclVisitor::visitClassDecl(const ClassDeclPtr& p) { _H << sp; _H << nl << "@class " << fixName(p) << ";"; - _H << nl << "@protocol " << fixName(p) << ";"; } void @@ -988,19 +988,6 @@ bool Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { string name = fixName(p); - ClassDefPtr base = p->base(); - - _H << sp << nl << _dllExport << "@protocol " << name; - - if (base) - { - _H << " <" << fixName(base) << ">"; - } - else - { - _H << " "; - } - _M << sp << nl << "@implementation " << name; return true; } @@ -1013,8 +1000,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) bool basePreserved = p->inheritsMetaData("preserve-slice"); bool preserved = p->hasMetaData("preserve-slice"); - // TODO: fix the base to not include ice_id etc. - string baseName = base ? fixName(base) : "ICEServant"; + string baseName = base ? fixName(base) : "ICEValue"; DataMemberList baseDataMembers; if(base) { @@ -1024,8 +1010,6 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) DataMemberList optionalMembers = p->orderedOptionalDataMembers(); DataMemberList allDataMembers = p->allDataMembers(); - _H << nl << "@end"; - _H << sp << nl << _dllExport << "@interface " << name << " : " << baseName; if(!dataMembers.empty() || (preserved && !basePreserved)) @@ -1109,53 +1093,19 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) } _M << eb; - // TODO: the code below is a very complicated way to implement ice_staticId through ICEObject. - - ClassList allBases = p->allBases(); - StringList ids; - - transform(allBases.begin(), allBases.end(), back_inserter(ids), - [](const ContainedPtr& it) - { - return it->scoped(); - }); - - StringList other; - other.push_back(p->scoped()); - other.push_back("::Ice::Object"); - other.sort(); - ids.merge(other); - ids.unique(); - - StringList::const_iterator firstIter = ids.begin(); - StringList::const_iterator scopedIter = find(ids.begin(), ids.end(), p->scoped()); - assert(scopedIter != ids.end()); - StringList::difference_type scopedPos = std::distance(firstIter, scopedIter); + _H << nl << "+(NSString *) ice_staticId;"; + _H << nl << "-(NSString *) ice_id;"; - _M << sp << nl << "static NSString * iceS_" << name << "_ids[] ="; + _M << sp << nl << "+(NSString *) ice_staticId"; _M << sb; - { - StringList::const_iterator q = ids.begin(); - while(q != ids.end()) - { - _M << nl << "@\"" << *q << '"'; - if(++q != ids.end()) - { - _M << ','; - } - } - } - _M << eb << ";"; + _M << nl << "return @\"" << p->scoped() << "\";"; + _M << eb; - _M << sp << nl << "+(NSString * const*) iceStaticIds:(int*)count idIndex:(int*)idx"; + _M << sp << nl << "-(NSString *) ice_id"; _M << sb; - _M << nl << "*count = sizeof(iceS_" << name << "_ids) / sizeof(NSString *);"; - _M << nl << "*idx = " << scopedPos << ";"; - _M << nl << "return iceS_" << name << "_ids;"; + _M << nl << "return @\"" << p->scoped() << "\";"; _M << eb; - // end TODO - if(preserved && !basePreserved) { _M << nl << "-(id) ice_getSlicedData"; @@ -2344,11 +2294,11 @@ bool Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) { string name = moduleName(findModule(p)) + p->name() + "Helper"; - _H << sp << nl << _dllExport << "@interface " << name << " : ICEObjectHelper"; + _H << sp << nl << _dllExport << "@interface " << name << " : ICEValueHelper"; _H << nl << "@end"; _M << sp << nl << "@implementation " << name; - _M << nl << "+(void) readRetained:(ICEObject*ICE_STRONG_QUALIFIER*)obj stream:(id)stream"; + _M << nl << "+(void) readRetained:(ICEValue*ICE_STRONG_QUALIFIER*)obj stream:(id)stream"; _M << sb; _M << nl << "[stream newValue:obj expectedType:[" << fixName(p) << " class]];"; _M << eb; @@ -2505,7 +2455,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) if((valueBuiltin && (valueBuiltin->kind() == Builtin::KindObject || valueBuiltin->kind() == Builtin::KindValue)) || valueClass) { - _H << sp << nl << _dllExport << "@interface " << name << " : ICEObjectDictionaryHelper"; + _H << sp << nl << _dllExport << "@interface " << name << " : ICEValueDictionaryHelper"; _H << nl << "@end"; _M << sp << nl << "@implementation " << name; @@ -2518,7 +2468,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) } else { - _M << nl << "return [stream newValueDict:[" << keyS << " class] expectedType:[ICEObject class]];"; + _M << nl << "return [stream newValueDict:[" << keyS << " class] expectedType:[ICEValue class]];"; } _M << eb; _M << nl << "+(void) write:(id)obj stream:(id)stream"; diff --git a/cpp/src/slice2objc/ObjCUtil.cpp b/cpp/src/slice2objc/ObjCUtil.cpp index dc68f1c8f58..d941d693c1c 100644 --- a/cpp/src/slice2objc/ObjCUtil.cpp +++ b/cpp/src/slice2objc/ObjCUtil.cpp @@ -265,9 +265,9 @@ Slice::ObjCGenerator::typeToString(const TypePtr& type) "ICEFloat", "ICEDouble", "NSString", - "ICEObject", + "ICEValue", "id", - "ICEObject" + "ICEValue" }; BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); @@ -763,17 +763,17 @@ Slice::ObjCGenerator::writeMarshalUnmarshalCode(Output &out, const TypePtr& type if(marshal) { // Cast avoids warning for forward-declared classes. - out << nl << "[" << stream << " writeValue:(ICEObject*)" << param << "];"; + out << nl << "[" << stream << " writeValue:(ICEValue*)" << param << "];"; } else { if(autoreleased) { - out << nl << "[" << stream << " " << "readValue:(ICEObject**)&" << param; + out << nl << "[" << stream << " " << "readValue:(ICEValue**)&" << param; } else { - out << nl << "[" << stream << " " << "newValue:(ICEObject**)&" << param; + out << nl << "[" << stream << " " << "newValue:(ICEValue**)&" << param; } string name = moduleName(findModule(cl)) + cl->name(); diff --git a/cpp/test/Ice/exceptions/AllTests.cpp b/cpp/test/Ice/exceptions/AllTests.cpp index 707d9b42e63..263946f8359 100644 --- a/cpp/test/Ice/exceptions/AllTests.cpp +++ b/cpp/test/Ice/exceptions/AllTests.cpp @@ -38,7 +38,7 @@ class ServantLocatorI : public virtual Ice::ServantLocator class ValueFactoryI : public virtual Ice::ValueFactory { public: - virtual Ice::ObjectPtr create(const string&) { return 0; } + virtual Ice::ValuePtr create(const string&) { return 0; } }; #endif diff --git a/cpp/test/Ice/gc/Client.cpp b/cpp/test/Ice/gc/Client.cpp index 9bf572df30c..162042960a0 100644 --- a/cpp/test/Ice/gc/Client.cpp +++ b/cpp/test/Ice/gc/Client.cpp @@ -125,17 +125,17 @@ class TestHaveCycles : public IceInternal::GCVisitor { public: - virtual bool visit(IceInternal::GCObject* obj) + virtual bool visit(IceInternal::GCValue* obj) { - if(obj->__hasFlag(IceInternal::GCObject::Visiting)) + if(obj->__hasFlag(IceInternal::GCValue::Visiting)) { return false; } - test(obj->__hasFlag(IceInternal::GCObject::CycleMember) && obj->__hasFlag(IceInternal::GCObject::Collectable)); + test(obj->__hasFlag(IceInternal::GCValue::CycleMember) && obj->__hasFlag(IceInternal::GCValue::Collectable)); - obj->__setFlag(IceInternal::GCObject::Visiting); + obj->__setFlag(IceInternal::GCValue::Visiting); obj->_iceGcVisitMembers(*this); - obj->__clearFlag(IceInternal::GCObject::Visiting); + obj->__clearFlag(IceInternal::GCValue::Visiting); return false; } }; diff --git a/cpp/test/Ice/objects/Client.cpp b/cpp/test/Ice/objects/Client.cpp index c65af24d0e0..48d9f25d8f4 100644 --- a/cpp/test/Ice/objects/Client.cpp +++ b/cpp/test/Ice/objects/Client.cpp @@ -40,7 +40,7 @@ class MyValueFactory : public Ice::ValueFactory { public: - virtual Ice::ObjectPtr create(const string& type) + virtual Ice::ValuePtr create(const string& type) { if(type == "::Test::B") { diff --git a/cpp/test/Ice/objects/Collocated.cpp b/cpp/test/Ice/objects/Collocated.cpp index 5d663e65a5f..c6ebff30319 100644 --- a/cpp/test/Ice/objects/Collocated.cpp +++ b/cpp/test/Ice/objects/Collocated.cpp @@ -32,7 +32,7 @@ class MyValueFactory : public Ice::ValueFactory { public: - virtual Ice::ObjectPtr create(const string& type) + virtual Ice::ValuePtr create(const string& type) { if(type == "::Test::B") { diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index d1c4a9d5cf5..168f2a60d02 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -33,11 +33,7 @@ toArrayRange(const T* v, size_t sz) } -#ifdef ICE_CPP11_MAPPING class TestObjectReader : public Ice::Value -#else -class TestObjectReader : public Ice::Object -#endif { public: virtual void _iceWrite(Ice::OutputStream*) const { } @@ -63,11 +59,7 @@ class TestObjectReader : public Ice::Object #endif }; -#ifdef ICE_CPP11_MAPPING class BObjectReader : public Ice::Value -#else -class BObjectReader : public Ice::Object -#endif { public: virtual void _iceWrite(Ice::OutputStream*) const { } @@ -100,11 +92,7 @@ class BObjectReader : public Ice::Object #endif }; -#ifdef ICE_CPP11_MAPPING class CObjectReader : public Ice::Value -#else -class CObjectReader : public Ice::Object -#endif { public: virtual void _iceWrite(Ice::OutputStream*) const { } @@ -140,11 +128,7 @@ class CObjectReader : public Ice::Object #endif }; -#ifdef ICE_CPP11_MAPPING class DObjectWriter : public Ice::Value -#else -class DObjectWriter : public Ice::Object -#endif { public: @@ -194,11 +178,7 @@ class DObjectWriter : public Ice::Object }; -#ifdef ICE_CPP11_MAPPING class DObjectReader : public Ice::Value -#else -class DObjectReader : public Ice::Object -#endif { public: virtual void _iceWrite(Ice::OutputStream*) const { } @@ -251,11 +231,7 @@ class DObjectReader : public Ice::Object IceUtil::Optional a; }; -#ifdef ICE_CPP11_MAPPING class FObjectReader : public Ice::Value -#else -class FObjectReader : public Ice::Object -#endif { public: virtual void _iceWrite(Ice::OutputStream*) const { } @@ -1029,7 +1005,7 @@ allTests(Test::TestHelper* helper, bool) #ifdef ICE_CPP11_MAPPING out.write(1, Ice::make_optional(make_shared())); #else - out.write(1, IceUtil::makeOptional(Ice::ObjectPtr(new DObjectWriter))); + out.write(1, IceUtil::makeOptional(Ice::ValuePtr(new DObjectWriter))); #endif out.endEncapsulation(); out.finished(inEncaps); diff --git a/cpp/test/Ice/optional/TestAMDI.cpp b/cpp/test/Ice/optional/TestAMDI.cpp index 973f23b6cd6..1402917a58b 100644 --- a/cpp/test/Ice/optional/TestAMDI.cpp +++ b/cpp/test/Ice/optional/TestAMDI.cpp @@ -562,7 +562,7 @@ InitialI::shutdown_async(const ::Test::AMD_Initial_shutdownPtr& cb, void InitialI::pingPong_async(const ::Test::AMD_Initial_pingPongPtr& cb, - const Ice::ObjectPtr& obj, + const Ice::ValuePtr& obj, const Ice::Current&) { cb->ice_response(obj); diff --git a/cpp/test/Ice/optional/TestAMDI.h b/cpp/test/Ice/optional/TestAMDI.h index fbe72dd6ce5..7289015ccb0 100644 --- a/cpp/test/Ice/optional/TestAMDI.h +++ b/cpp/test/Ice/optional/TestAMDI.h @@ -284,7 +284,7 @@ class InitialI : public Test::Initial const Ice::Current&); virtual void pingPong_async(const ::Test::AMD_Initial_pingPongPtr&, - const Ice::ObjectPtr&, + const Ice::ValuePtr&, const Ice::Current&); virtual void opOptionalException_async(const ::Test::AMD_Initial_opOptionalExceptionPtr&, diff --git a/cpp/test/Ice/slicing/objects/AllTests.cpp b/cpp/test/Ice/slicing/objects/AllTests.cpp index 7c28d703dfa..d06d50b3d78 100644 --- a/cpp/test/Ice/slicing/objects/AllTests.cpp +++ b/cpp/test/Ice/slicing/objects/AllTests.cpp @@ -171,10 +171,10 @@ class Callback : public CallbackBase public: void - response_SBaseAsObject(const ::Ice::ObjectPtr& o) + response_SBaseAsObject(const ::Ice::ValuePtr& o) { test(o); - test(o->ice_id(Ice::emptyCurrent) == "::Test::SBase"); + test(o->ice_id() == "::Test::SBase"); SBasePtr sb = ICE_DYNAMIC_CAST(SBase, o); test(sb); test(sb->sb == "SBase.sb"); @@ -229,7 +229,7 @@ class Callback : public CallbackBase } void - response_SUnknownAsObject10(const Ice::ObjectPtr&) + response_SUnknownAsObject10(const Ice::ValuePtr&) { test(false); } @@ -242,7 +242,7 @@ class Callback : public CallbackBase } void - response_SUnknownAsObject11(const Ice::ObjectPtr& o) + response_SUnknownAsObject11(const Ice::ValuePtr& o) { test(ICE_DYNAMIC_CAST(Ice::UnknownSlicedValue, o)); test(ICE_DYNAMIC_CAST(Ice::UnknownSlicedValue, o)->ice_id() == "::Test::SUnknown"); @@ -663,7 +663,7 @@ class NodeFactoryI : public Ice::ValueFactory { public: - virtual Ice::ObjectPtr create(const string& id) + virtual Ice::ValuePtr create(const string& id) { if(id == PNode::ice_staticId()) { @@ -702,7 +702,7 @@ class PreservedFactoryI : public Ice::ValueFactory { public: - virtual Ice::ObjectPtr create(const string& id) + virtual Ice::ValuePtr create(const string& id) { if(id == Preserved::ice_staticId()) { diff --git a/cpp/test/Ice/slicing/objects/TestAMDI.cpp b/cpp/test/Ice/slicing/objects/TestAMDI.cpp index bbb01870f89..55ca8bb63ef 100644 --- a/cpp/test/Ice/slicing/objects/TestAMDI.cpp +++ b/cpp/test/Ice/slicing/objects/TestAMDI.cpp @@ -724,7 +724,7 @@ TestI::SUnknownAsObject_async(const AMD_TestIntf_SUnknownAsObjectPtr& cb, const void TestI::checkSUnknown_async(const AMD_TestIntf_checkSUnknownPtr& cb, - const Ice::ObjectPtr& obj, + const Ice::ValuePtr& obj, const ::Ice::Current& current) { SUnknownPtr su = SUnknownPtr::dynamicCast(obj); diff --git a/cpp/test/Ice/slicing/objects/TestAMDI.h b/cpp/test/Ice/slicing/objects/TestAMDI.h index f12a7bee5be..f1bfa74b190 100644 --- a/cpp/test/Ice/slicing/objects/TestAMDI.h +++ b/cpp/test/Ice/slicing/objects/TestAMDI.h @@ -195,7 +195,7 @@ class TestI : public virtual ::Test::TestIntf const ::Ice::Current&); virtual void SUnknownAsObject_async(const ::Test::AMD_TestIntf_SUnknownAsObjectPtr&, const ::Ice::Current&); - virtual void checkSUnknown_async(const ::Test::AMD_TestIntf_checkSUnknownPtr&, const Ice::ObjectPtr&, + virtual void checkSUnknown_async(const ::Test::AMD_TestIntf_checkSUnknownPtr&, const Ice::ValuePtr&, const ::Ice::Current&); virtual void oneElementCycle_async(const ::Test::AMD_TestIntf_oneElementCyclePtr&, const ::Ice::Current&); diff --git a/cpp/test/Ice/stream/Client.cpp b/cpp/test/Ice/stream/Client.cpp index 07bdeb86025..90a5aea33eb 100644 --- a/cpp/test/Ice/stream/Client.cpp +++ b/cpp/test/Ice/stream/Client.cpp @@ -18,7 +18,7 @@ using namespace Test2::Sub2; #ifdef ICE_CPP11_MAPPING class TestObjectWriter : public Ice::ValueHelper #else -class TestObjectWriter : public Ice::Object +class TestObjectWriter : public Ice::Value #endif { public: @@ -48,7 +48,7 @@ ICE_DEFINE_PTR(TestObjectWriterPtr, TestObjectWriter); #ifdef ICE_CPP11_MAPPING class TestObjectReader : public Ice::ValueHelper #else -class TestObjectReader : public Ice::Object +class TestObjectReader : public Ice::Value #endif { public: @@ -107,7 +107,7 @@ class TestValueFactory : public Ice::ValueFactory { public: - virtual Ice::ObjectPtr + virtual Ice::ValuePtr #ifndef NDEBUG create(const string& type) #else @@ -135,9 +135,9 @@ patchObject(void* addr, const Ice::ValuePtr& v) } #else void -patchObject(void* addr, const Ice::ObjectPtr& v) +patchObject(void* addr, const Ice::ValuePtr& v) { - Ice::ObjectPtr* p = static_cast(addr); + Ice::ValuePtr* p = static_cast(addr); assert(p); *p = v; } @@ -180,7 +180,7 @@ class MyClassFactoryWrapper : public Ice::ValueFactory clear(); } - virtual Ice::ObjectPtr create(const string& type) + virtual Ice::ValuePtr create(const string& type) { return _factory->create(type); } @@ -206,24 +206,6 @@ class MyClassFactoryWrapper : public Ice::ValueFactory typedef IceUtil::Handle MyClassFactoryWrapperPtr; #endif -#ifndef ICE_CPP11_MAPPING -class MyInterfaceFactory : public Ice::ValueFactory -{ -public: - - virtual Ice::ObjectPtr - create(const string&) - { - return new MyInterface; - } - - virtual void - destroy() - { - } -}; -#endif - void allTests(Test::TestHelper* helper) { @@ -236,7 +218,6 @@ allTests(Test::TestHelper* helper) #else MyClassFactoryWrapperPtr factoryWrapper = new MyClassFactoryWrapper; communicator->getValueFactoryManager()->add(factoryWrapper, MyClass::ice_staticId()); - communicator->getValueFactoryManager()->add(new MyInterfaceFactory, MyInterface::ice_staticId()); #endif vector data; @@ -953,7 +934,7 @@ allTests(Test::TestHelper* helper) Ice::ValuePtr w = ICE_DYNAMIC_CAST(Ice::Value, writer); out.write(w); #else - out.write(Ice::ObjectPtr(writer)); + out.write(Ice::ValuePtr(writer)); #endif out.writePendingValues(); out.finished(data); @@ -969,7 +950,7 @@ allTests(Test::TestHelper* helper) Ice::ValuePtr w = ICE_DYNAMIC_CAST(Ice::Value, writer); out.write(w); #else - out.write(Ice::ObjectPtr(writer)); + out.write(Ice::ValuePtr(writer)); #endif out.writePendingValues(); out.finished(data); @@ -983,7 +964,7 @@ allTests(Test::TestHelper* helper) #ifdef ICE_CPP11_MAPPING Ice::ValuePtr p; #else - Ice::ObjectPtr p; + Ice::ValuePtr p; #endif in.read(&patchObject, &p); in.readPendingValues(); diff --git a/objective-c/include/objc/Ice/Ice.h b/objective-c/include/objc/Ice/Ice.h index dd0b1609f8b..18c0bc60bb7 100644 --- a/objective-c/include/objc/Ice/Ice.h +++ b/objective-c/include/objc/Ice/Ice.h @@ -13,6 +13,7 @@ #import #import #import +#import #import #import #import diff --git a/objective-c/include/objc/Ice/Object.h b/objective-c/include/objc/Ice/Object.h index 6c47e39d2c3..f7e7a65b61b 100644 --- a/objective-c/include/objc/Ice/Object.h +++ b/objective-c/include/objc/Ice/Object.h @@ -36,17 +36,8 @@ ICE_API @protocol ICEObject @end ICE_API @interface ICEObject : NSObject --(BOOL) ice_isA:(NSString*)typeId; --(void) ice_ping; --(NSString*) ice_id; --(NSArray*) ice_ids; +(NSString*) ice_staticId; --(void) ice_preMarshal; --(void) ice_postUnmarshal; --(id) ice_getSlicedData; +(NSString*const*) iceStaticIds:(int*)count idIndex:(int*)idx; --(void) iceWrite:(id)os; --(void) iceRead:(id)is; @end ICE_API @interface ICEServant : ICEObject @@ -61,8 +52,6 @@ ICE_API @interface ICEServant : ICEObject +(void) iceD_ice_id:(id)servant current:(ICECurrent*)current is:(id)is os:(id)os; +(void) iceD_ice_ids:(id)servant current:(ICECurrent*)current is:(id)is os:(id)os; -(void) iceDispatch:(ICECurrent*)current is:(id)is os:(id)os; --(void) iceWriteImpl:(id)os; --(void) iceReadImpl:(id)is; -(id) iceTarget; @end diff --git a/objective-c/include/objc/Ice/ObjectFactory.h b/objective-c/include/objc/Ice/ObjectFactory.h index ab8d4e1a18b..921a186066f 100644 --- a/objective-c/include/objc/Ice/ObjectFactory.h +++ b/objective-c/include/objc/Ice/ObjectFactory.h @@ -5,6 +5,6 @@ #import ICE_API @protocol ICEObjectFactory --(ICEObject*) create:(NSString*)sliceId NS_RETURNS_RETAINED; +-(ICEValue*) create:(NSString*)sliceId NS_RETURNS_RETAINED; -(void) destroy; @end diff --git a/objective-c/include/objc/Ice/SlicedData.h b/objective-c/include/objc/Ice/SlicedData.h index 4f9c4bcbc38..ea4ce03e2e1 100644 --- a/objective-c/include/objc/Ice/SlicedData.h +++ b/objective-c/include/objc/Ice/SlicedData.h @@ -3,8 +3,7 @@ // #import - -#import +#import // // SlicedData holds the slices of unknown types. @@ -19,7 +18,7 @@ ICE_API @protocol ICESlicedData // // Unknown sliced object holds instance of unknown type. // -ICE_API @interface ICEUnknownSlicedValue : ICEObject +ICE_API @interface ICEUnknownSlicedValue : ICEValue { @private NSString* unknownTypeId_; diff --git a/objective-c/include/objc/Ice/Stream.h b/objective-c/include/objc/Ice/Stream.h index 9942c23e9f4..5b5d32d9169 100644 --- a/objective-c/include/objc/Ice/Stream.h +++ b/objective-c/include/objc/Ice/Stream.h @@ -11,6 +11,7 @@ // Forward declarations // @class ICEObject; +@class ICEValue; @protocol ICEObjectPrx; @protocol ICESlicedData; @class ICEUserException; @@ -32,7 +33,7 @@ typedef enum } ICEOptionalFormat; ICE_API @protocol ICEReadObjectCallback --(void)invoke:(ICEObject*)obj; +-(void)invoke:(ICEValue*)obj; @end // @@ -91,10 +92,10 @@ ICE_API @protocol ICEInputStream -(id) newProxy:(Class)c; -(id) readProxy:(Class)c; --(void) newValue:(ICEObject*ICE_STRONG_QUALIFIER*)object; --(void) newValue:(ICEObject*ICE_STRONG_QUALIFIER*)object expectedType:(Class)type; --(void) readValue:(ICEObject**)object; --(void) readValue:(ICEObject**)object expectedType:(Class)type; +-(void) newValue:(ICEValue*ICE_STRONG_QUALIFIER*)object; +-(void) newValue:(ICEValue*ICE_STRONG_QUALIFIER*)object expectedType:(Class)type; +-(void) readValue:(ICEValue**)object; +-(void) readValue:(ICEValue**)object expectedType:(Class)type; -(NSMutableArray*) newValueSeq:(Class)expectedType; -(NSMutableArray*) readValueSeq:(Class)expectedType; -(NSMutableDictionary*) newValueDict:(Class)keyType expectedType:(Class)type; @@ -168,7 +169,7 @@ ICE_API @protocol ICEOutputStream -(void) writeProxy:(id)v; --(void) writeValue:(ICEObject*)v; +-(void) writeValue:(ICEValue*)v; -(void) writeValueSeq:(NSArray*)v; -(void) writeValueDict:(NSDictionary*)v helper:(Class)helper; @@ -248,8 +249,8 @@ ICE_API @interface ICEDoubleHelper : ICEStreamHelper ICE_API @interface ICEStringHelper : ICEStreamHelper @end -ICE_API @interface ICEObjectHelper : ICEStreamHelper -+(void)read:(ICEObject**)v stream:(id)stream; +ICE_API @interface ICEValueHelper : ICEStreamHelper ++(void)read:(ICEValue**)v stream:(id)stream; +(void)readOptional:(id*)v stream:(id)stream tag:(ICEInt)tag; @end @@ -320,7 +321,7 @@ ICE_API @interface ICEDictionaryHelper : ICEStreamHelper + +// +// Forward declarations. +// +@protocol ICEInputStream; +@protocol ICEOutputStream; +@protocol ICESlicedData; + +ICE_API @interface ICEValue : NSObject ++(NSString*) ice_staticId; +-(NSString*) ice_id; +-(void) ice_preMarshal; +-(void) ice_postUnmarshal; +-(id) ice_getSlicedData; +-(void) iceWrite:(id)os; +-(void) iceRead:(id)is; +-(void) iceWriteImpl:(id)os; +-(void) iceReadImpl:(id)is; +@end diff --git a/objective-c/include/objc/Ice/ValueFactory.h b/objective-c/include/objc/Ice/ValueFactory.h index fde5fc2ec65..46c0ed9a9fc 100644 --- a/objective-c/include/objc/Ice/ValueFactory.h +++ b/objective-c/include/objc/Ice/ValueFactory.h @@ -6,9 +6,9 @@ #import #if defined(__clang__) && __has_feature(objc_arc) -typedef ICEObject* (^ICEValueFactory)(NSString*) NS_RETURNS_RETAINED; +typedef ICEValue* (^ICEValueFactory)(NSString*) NS_RETURNS_RETAINED; #else -typedef ICEObject* (^ICEValueFactory)(NSString*); +typedef ICEValue* (^ICEValueFactory)(NSString*); #endif ICE_API @protocol ICEValueFactoryManager diff --git a/objective-c/src/Ice/Object.mm b/objective-c/src/Ice/Object.mm index 4a7035ad363..980fe3888ac 100644 --- a/objective-c/src/Ice/Object.mm +++ b/objective-c/src/Ice/Object.mm @@ -301,36 +301,10 @@ -(void) dealloc { [super dealloc]; } --(BOOL) ice_isA:(NSString*)typeId -{ - return [self ice_isA:typeId current:nil]; -} --(void) ice_ping -{ - [self ice_ping:nil]; -} --(NSString*) ice_id -{ - return [self ice_id:nil]; -} --(NSArray*) ice_ids -{ - return [self ice_ids:nil]; -} --(void) ice_preMarshal -{ -} --(void) ice_postUnmarshal -{ -} --(id) ice_getSlicedData -{ - return nil; -} -(BOOL) ice_isA:(NSString*)__unused typeId current:(ICECurrent*)__unused current { NSAssert(NO, @"ice_isA requires override"); - return false; + return NO; } -(void) ice_ping:(ICECurrent*)__unused current { @@ -362,14 +336,6 @@ +(NSString*const*) iceStaticIds:(int*)count idIndex:(int*)idx *idx = 0; return ICEObject_ids; } --(void) iceWrite:(id)__unused os -{ - NSAssert(NO, @"iceWrite requires override"); -} --(void) iceRead:(id)__unused is -{ - NSAssert(NO, @"iceRead requires override"); -} -(id) copyWithZone:(NSZone*)zone { return [[[self class] allocWithZone:zone] init]; @@ -520,30 +486,6 @@ -(void) iceDispatch:(ICECurrent*)current is:(id)is os:(id)os -{ - [os startValue:nil]; - [self iceWriteImpl:os]; - [os endValue]; -} - --(void) iceRead:(id)is -{ - [is startValue]; - [self iceReadImpl:is]; - [is endValue:NO]; -} - --(void) iceWriteImpl:(id)__unused os -{ - NSAssert(NO, @"iceWriteImpl requires override"); -} - --(void) iceReadImpl:(id)__unused is -{ - NSAssert(NO, @"iceReadImpl requires override"); -} - -(id)iceTarget { return (iceDelegate_ == 0) ? self : iceDelegate_; @@ -699,32 +641,7 @@ -(void) ice_dispatch:(id)__unused request { @throw [ICEFeatureNotSupportedException featureNotSupportedException:__FILE__ line:__LINE__]; } --(void) iceWrite:(id)os -{ - NSException* nsex = nil; - try - { - object_->_iceWrite([(ICEOutputStream*)os os]); - } - catch(const std::exception& ex) - { - nsex = toObjCException(ex); - } - @throw nsex; -} --(void) iceRead:(id)is -{ - NSException* nsex = nil; - try - { - object_->_iceRead([(ICEInputStream*)is is]); - } - catch(const std::exception& ex) - { - nsex = toObjCException(ex); - } - @throw nsex; -} + -(Ice::Object*) iceObject { return object_; diff --git a/objective-c/src/Ice/Stream.mm b/objective-c/src/Ice/Stream.mm index 925f55127e3..01ea24b762d 100644 --- a/objective-c/src/Ice/Stream.mm +++ b/objective-c/src/Ice/Stream.mm @@ -24,11 +24,11 @@ namespace IceObjC { -class ValueWrapper : public Ice::Object +class ValueWrapper : public Ice::Value { public: - ValueWrapper(ICEObject* obj) : _obj(obj) + ValueWrapper(ICEValue* obj) : _obj(obj) { CFRetain(_obj); } @@ -74,7 +74,7 @@ virtual void ice_postUnmarshal() [_obj ice_postUnmarshal]; } - ICEObject* + ICEValue* getValue() { return _obj; @@ -82,7 +82,7 @@ virtual void ice_postUnmarshal() private: - ICEObject* _obj; + ICEValue* _obj; }; typedef IceUtil::Handle ValueWrapperPtr; @@ -100,7 +100,7 @@ virtual void ice_postUnmarshal() } virtual void invoke(const Ice::ValuePtr&) = 0; - void checkType(ICEObject*); + void checkType(ICEValue*); private: @@ -114,7 +114,7 @@ virtual void ice_postUnmarshal() } void -ReadValueBase::checkType(ICEObject* o) +ReadValueBase::checkType(ICEValue* o) { if(o != nil && ![o isKindOfClass:_expectedType]) { @@ -135,7 +135,7 @@ virtual void ice_postUnmarshal() { public: - ReadValue(ICEObject** addr, Class expectedType, bool autorelease) : + ReadValue(ICEValue** addr, Class expectedType, bool autorelease) : ReadValueBase(expectedType), _addr(addr), _autorelease(autorelease) { } @@ -147,7 +147,7 @@ virtual void ice_postUnmarshal() { if(obj) { - ICEObject* o = ValueWrapperPtr::dynamicCast(obj)->getValue(); + ICEValue* o = ValueWrapperPtr::dynamicCast(obj)->getValue(); checkType(o); *_addr = [o retain]; if(_autorelease) @@ -168,7 +168,7 @@ virtual void ice_postUnmarshal() private: - ICEObject** _addr; + ICEValue** _addr; bool _autorelease; }; @@ -188,7 +188,7 @@ virtual void ice_postUnmarshal() { if(obj) { - ICEObject* o = ValueWrapperPtr::dynamicCast(obj)->getValue(); + ICEValue* o = ValueWrapperPtr::dynamicCast(obj)->getValue(); checkType(o); [_array replaceObjectAtIndex:static_cast(_index) withObject:o]; } @@ -229,7 +229,7 @@ virtual void ice_postUnmarshal() { if(obj) { - ICEObject* o = ValueWrapperPtr::dynamicCast(obj)->getValue(); + ICEValue* o = ValueWrapperPtr::dynamicCast(obj)->getValue(); checkType(o); [_dict setObject:o forKey:_key]; } @@ -422,7 +422,7 @@ -(void) dealloc [super dealloc]; } -+(Ice::Object*)createObjectReader:(ICEObject*)obj ++(Ice::Value*)createObjectReader:(ICEValue*)obj { return new IceObjC::ValueWrapper(obj); } @@ -923,11 +923,11 @@ -(ICEInt) readAndCheckSeqSize:(ICEInt)minSize @throw nsex; return nil; // Keep the compiler happy. } --(void) readValue:(ICEObject**)object +-(void) readValue:(ICEValue**)object { - [self readValue:object expectedType:[ICEObject class]]; + [self readValue:object expectedType:[ICEValue class]]; } --(void) readValue:(ICEObject**)object expectedType:(Class)type +-(void) readValue:(ICEValue**)object expectedType:(Class)type { NSException* nsex = nil; try @@ -949,11 +949,11 @@ -(void) readValue:(ICEObject**)object expectedType:(Class)type @throw nsex; } } --(void) newValue:(ICEObject*ICE_STRONG_QUALIFIER*)object +-(void) newValue:(ICEValue*ICE_STRONG_QUALIFIER*)object { - [self newValue:object expectedType:[ICEObject class]]; + [self newValue:object expectedType:[ICEValue class]]; } --(void) newValue:(ICEObject*ICE_STRONG_QUALIFIER*)object expectedType:(Class)type +-(void) newValue:(ICEValue*ICE_STRONG_QUALIFIER*)object expectedType:(Class)type { NSException* nsex = nil; try @@ -1960,7 +1960,7 @@ -(void) writeProxy:(id)v } } --(void) writeValue:(ICEObject*)v +-(void) writeValue:(ICEValue*)v { NSException* nsex = nil; try @@ -2268,19 +2268,19 @@ -(void) reset:(BOOL)__unused clearBuffer } } --(Ice::Object*) addObject:(ICEObject*)object +-(Ice::Value*) addObject:(ICEValue*)object { // - // Ice::ValueWrapper is a subclass of Ice::Object that wraps an Objective-C object for marshaling. + // Ice::ValueWrapper is a subclass of Ice::Value that wraps an Objective-C object for marshaling. // It is possible that this Objective-C object has already been marshaled, therefore we first must // check the object map to see if this object is present. If so, we use the existing ValueWrapper, // otherwise we create a new one. // if(!objectWriters_) { - objectWriters_ = new std::map(); + objectWriters_ = new std::map(); } - std::map::const_iterator p = objectWriters_->find(object); + std::map::const_iterator p = objectWriters_->find(object); if(p != objectWriters_->end()) { return p->second.get(); @@ -2687,22 +2687,22 @@ +(ICEInt) minWireSize } @end -@implementation ICEObjectHelper +@implementation ICEValueHelper +(id) readRetained:(id)stream { // // This will only work with the 1.1 encoding. With the 1.0 encoding // objects are read when readPendingObjects is called. // - ICEObject* obj; + ICEValue* obj; [stream newValue:&obj]; return (id)obj; } -+(void)readRetained:(ICEObject**)v stream:(id)stream ++(void)readRetained:(ICEValue**)v stream:(id)stream { [stream newValue:v]; } -+(void)read:(ICEObject**)v stream:(id)stream ++(void)read:(ICEValue**)v stream:(id)stream { [stream readValue:v]; } @@ -2720,8 +2720,8 @@ +(id)readOptionalRetained:(id)stream tag:(ICEInt)tag } +(void) writeOptional:(id)v stream:(id)stream tag:(ICEInt)tag { - ICEObject* value; - if([ICEOptionalGetter get:v value:&value type:[ICEObject class]] && + ICEValue* value; + if([ICEOptionalGetter get:v value:&value type:[ICEValue class]] && [stream writeOptional:tag format:ICEOptionalFormatClass]) { [self write:value stream:stream]; @@ -2731,7 +2731,7 @@ +(void)readOptionalRetained:(id *)v stream:(id)stream tag:(ICEIn { if([stream readOptional:tag format:ICEOptionalFormatClass]) { - [self readRetained:(ICEObject**)v stream:stream]; + [self readRetained:(ICEValue**)v stream:stream]; } else { @@ -2742,7 +2742,7 @@ +(void)readOptional:(id *)v stream:(id)stream tag:(ICEInt)tag { if([stream readOptional:tag format:ICEOptionalFormatClass]) { - [self read:(ICEObject**)v stream:stream]; + [self read:(ICEValue**)v stream:stream]; } else { @@ -3134,7 +3134,7 @@ +(Class) getOptionalHelper @implementation ICEObjectSequenceHelper +(id) readRetained:(id)stream { - return [stream newValueSeq:[ICEObject class]]; + return [stream newValueSeq:[ICEValue class]]; } +(void) write:(id)obj stream:(id)stream { @@ -3142,7 +3142,7 @@ +(void) write:(id)obj stream:(id)stream } +(Class) getElementHelper { - return [ICEObjectHelper class]; + return [ICEValueHelper class]; } +(Class) getOptionalHelper { @@ -3210,16 +3210,16 @@ +(ICEInt) count:(id)obj } @end -@implementation ICEObjectDictionaryHelper +@implementation ICEValueDictionaryHelper +(id) readRetained:(id)__unused stream { - NSAssert(NO, @"ICEObjectDictionaryHelper readRetained requires override"); + NSAssert(NO, @"ICEValueDictionaryHelper readRetained requires override"); return nil; } +(void) write:(id)__unused obj stream:(id)__unused stream { - NSAssert(NO, @"ICEObjectDictionaryHelper write requires override"); + NSAssert(NO, @"ICEValueDictionaryHelper write requires override"); } +(Class) getOptionalHelper diff --git a/objective-c/src/Ice/StreamI.h b/objective-c/src/Ice/StreamI.h index e83ab6de1c5..cf143dc998a 100644 --- a/objective-c/src/Ice/StreamI.h +++ b/objective-c/src/Ice/StreamI.h @@ -18,7 +18,7 @@ NSDictionary* prefixTable_; NSData* data_; } -+(Ice::Object*)createObjectReader:(ICEObject*)obj; ++(Ice::Value*)createObjectReader:(ICEValue*)obj; -(id)initWithCxxCommunicator:(Ice::Communicator*)com data:(const std::pair&)data; -(id)initWithCommunicator:(id)com data:(NSData*)data encoding:(ICEEncodingVersion*)e; -(Ice::InputStream*) is; @@ -28,7 +28,7 @@ { Ice::OutputStream* os_; Ice::OutputStream stream_; - std::map* objectWriters_; + std::map* objectWriters_; } -(id)initWithCxxCommunicator:(Ice::Communicator*)communicator; -(id)initWithCxxStream:(Ice::OutputStream*)stream; diff --git a/objective-c/src/Ice/Util.h b/objective-c/src/Ice/Util.h index 9bee55f6a53..278117813d6 100644 --- a/objective-c/src/Ice/Util.h +++ b/objective-c/src/Ice/Util.h @@ -221,7 +221,7 @@ class Exception : public IceUtil::Exception Exception(id); Exception(const Exception&); - ~Exception(); + virtual ~Exception(); virtual std::string ice_id() const; virtual void ice_print(std::ostream& os) const; diff --git a/objective-c/src/Ice/Value.mm b/objective-c/src/Ice/Value.mm new file mode 100644 index 00000000000..80c3eb933d2 --- /dev/null +++ b/objective-c/src/Ice/Value.mm @@ -0,0 +1,68 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +#import +#import + +#import +#import + +@implementation ICEValue +-(id)init +{ + self = [super init]; + if(!self) + { + return nil; + } + return self; +} +-(void) dealloc +{ + [super dealloc]; +} +-(void) ice_preMarshal +{ +} +-(void) ice_postUnmarshal +{ +} +-(id) ice_getSlicedData +{ + return nil; +} +-(NSString*) ice_id +{ + NSAssert(NO, @"ice_id requires override"); + return nil; +} ++(NSString*) ice_staticId +{ + return @"::Ice::Object"; +} +-(void) iceWrite:(id)os +{ + [os startValue:nil]; + [self iceWriteImpl:os]; + [os endValue]; +} +-(void) iceRead:(id)is +{ + [is startValue]; + [self iceReadImpl:is]; + [is endValue:NO]; +} +-(void) iceWriteImpl:(id)__unused os +{ + NSAssert(NO, @"iceWriteImpl requires override"); +} +-(void) iceReadImpl:(id)__unused is +{ + NSAssert(NO, @"iceReadImpl requires override"); +} +-(id) copyWithZone:(NSZone*)zone +{ + return [[[self class] allocWithZone:zone] init]; +} +@end diff --git a/objective-c/src/Ice/ValueFactoryI.mm b/objective-c/src/Ice/ValueFactoryI.mm index 6faa2fb16a7..f7e9b359af6 100644 --- a/objective-c/src/Ice/ValueFactoryI.mm +++ b/objective-c/src/Ice/ValueFactoryI.mm @@ -21,11 +21,11 @@ { public: - virtual Ice::ObjectPtr + virtual Ice::ValuePtr create(const std::string&) { ICEUnknownSlicedValue* obj = [[ICEUnknownSlicedValue alloc] init]; - Ice::ObjectPtr o = [ICEInputStream createObjectReader:obj]; + Ice::ValuePtr o = [ICEInputStream createObjectReader:obj]; [obj release]; return o; } @@ -48,7 +48,7 @@ CFRelease(_prefixTable); } - virtual Ice::ObjectPtr + virtual Ice::ValuePtr create(const std::string& type) { NSString* sliceId = [[NSString alloc] initWithUTF8String:type.c_str()]; @@ -65,7 +65,7 @@ } } - ICEObject* obj = nil; + ICEValue* obj = nil; if(factory != nil) { obj = factory(sliceId); @@ -79,13 +79,13 @@ { return 0; // No value factory. } - if([c isSubclassOfClass:[ICEObject class]]) + if([c isSubclassOfClass:[ICEValue class]]) { - obj = (ICEObject*)[[c alloc] init]; + obj = (ICEValue*)[[c alloc] init]; } } - Ice::ObjectPtr o; + Ice::ValuePtr o; if(obj != nil) { o = [ICEInputStream createObjectReader:obj]; diff --git a/objective-c/test/Ice/objects/AllTests.m b/objective-c/test/Ice/objects/AllTests.m index 014700ce3fa..6cf23289417 100644 --- a/objective-c/test/Ice/objects/AllTests.m +++ b/objective-c/test/Ice/objects/AllTests.m @@ -226,7 +226,7 @@ void breakRetainCycleD(TestObjectsD* d1) tprintf("testing Value as parameter... "); { TestObjectsL* v1 = [[TestObjectsL alloc] init:@"l"]; - ICEObject* v2; + ICEValue* v2; TestObjectsL* v3 = (TestObjectsL*)[initial opValue:v1 v2:&v2]; test([v3.data isEqualToString:@"l"]); test([((TestObjectsL*)v2).data isEqualToString:@"l"]); diff --git a/objective-c/test/Ice/objects/Client.m b/objective-c/test/Ice/objects/Client.m index 53361761c66..a87e949d9d1 100644 --- a/objective-c/test/Ice/objects/Client.m +++ b/objective-c/test/Ice/objects/Client.m @@ -16,9 +16,9 @@ #endif #if defined(__clang__) && __has_feature(objc_arc) -static ICEValueFactory factory = ^ICEObject* (NSString* type) NS_RETURNS_RETAINED +static ICEValueFactory factory = ^ICEValue* (NSString* type) NS_RETURNS_RETAINED #else -static ICEValueFactory factory = ^ICEObject* (NSString* type) +static ICEValueFactory factory = ^ICEValue* (NSString* type) #endif { if([type isEqualToString:@"::Test::B"]) @@ -41,14 +41,6 @@ { return [[TestObjectsFI alloc] init]; } - else if([type isEqualToString:@"::Test::I"]) - { - return [[TestObjectsI alloc] init]; - } - else if([type isEqualToString:@"::Test::J"]) - { - return [[TestObjectsJI alloc] init]; - } else { test(NO); @@ -61,7 +53,7 @@ @interface ClientMyObjectFactory : NSObject @implementation ClientMyObjectFactory --(ICEObject*) create:(NSString*)__unused type +-(ICEValue*) create:(NSString*)__unused type { return nil; } @@ -81,8 +73,6 @@ -(void) destroy [manager add:factory sliceId:@"::Test::D"]; [manager add:factory sliceId:@"::Test::E"]; [manager add:factory sliceId:@"::Test::F"]; - [manager add:factory sliceId:@"::Test::I"]; - [manager add:factory sliceId:@"::Test::J"]; id objectFactory = ICE_AUTORELEASE([[ClientMyObjectFactory alloc] init]); [communicator addObjectFactory:objectFactory sliceId:@"TestOF" ]; diff --git a/objective-c/test/Ice/objects/Collocated.m b/objective-c/test/Ice/objects/Collocated.m index cee69f1aef6..f36b65c8388 100644 --- a/objective-c/test/Ice/objects/Collocated.m +++ b/objective-c/test/Ice/objects/Collocated.m @@ -12,9 +12,9 @@ #endif #if defined(__clang__) && __has_feature(objc_arc) -ICEValueFactory factory = ^ICEObject* (NSString* type) NS_RETURNS_RETAINED +ICEValueFactory factory = ^ICEValue* (NSString* type) NS_RETURNS_RETAINED #else -ICEValueFactory factory = ^ICEObject* (NSString* type) +ICEValueFactory factory = ^ICEValue* (NSString* type) #endif { if([type isEqualToString:@"::Test::B"]) @@ -37,14 +37,6 @@ { return [[TestObjectsFI alloc] init]; } - else if([type isEqualToString:@"::Test::I"]) - { - return [[TestObjectsI alloc] init]; - } - else if([type isEqualToString:@"::Test::J"]) - { - return [[TestObjectsJI alloc] init]; - } else { test(NO); @@ -57,7 +49,7 @@ @interface CollocatedMyObjectFactory : NSObject @implementation CollocatedMyObjectFactory --(ICEObject*) create:(NSString*)__unused type +-(ICEValue*) create:(NSString*)__unused type { return nil; } @@ -77,8 +69,6 @@ -(void) destroy [manager add:factory sliceId:@"::Test::D"]; [manager add:factory sliceId:@"::Test::E"]; [manager add:factory sliceId:@"::Test::F"]; - [manager add:factory sliceId:@"::Test::I"]; - [manager add:factory sliceId:@"::Test::J"]; id objectFactory = ICE_AUTORELEASE([[CollocatedMyObjectFactory alloc] init]); [communicator addObjectFactory:objectFactory sliceId:@"TestOF" ]; diff --git a/objective-c/test/Ice/objects/ObjectsTest.ice b/objective-c/test/Ice/objects/ObjectsTest.ice index 614a2877207..5a7122290c1 100644 --- a/objective-c/test/Ice/objects/ObjectsTest.ice +++ b/objective-c/test/Ice/objects/ObjectsTest.ice @@ -169,14 +169,14 @@ class Recursive Recursive v; } -class L +class K { - string data; + Value value; } -class K +class L { - Object value; + string data; } sequence ValueSeq; diff --git a/objective-c/test/Ice/objects/Server.m b/objective-c/test/Ice/objects/Server.m index aa818ecbb43..3d1703b7d23 100644 --- a/objective-c/test/Ice/objects/Server.m +++ b/objective-c/test/Ice/objects/Server.m @@ -6,33 +6,9 @@ #import #import -#if defined(__clang__) && __has_feature(objc_arc) -static ICEValueFactory factory = ^ICEObject* (NSString* type) NS_RETURNS_RETAINED -#else -static ICEValueFactory factory = ^ICEObject* (NSString* type) -#endif -{ - if([type isEqualToString:@"::Test::I"]) - { - return [[TestObjectsI alloc] init]; - } - else if([type isEqualToString:@"::Test::J"]) - { - return [[TestObjectsJI alloc] init]; - } - else - { - test(NO); // Should never be reached - } - return nil; -}; - static int run(id communicator) { - [[communicator getValueFactoryManager] add:factory sliceId:@"::Test::I"]; - [[communicator getValueFactoryManager] add:factory sliceId:@"::Test::J"]; - [[communicator getProperties] setProperty:@"TestAdapter.Endpoints" value:getTestEndpoint(communicator, 0)]; id adapter = [communicator createObjectAdapter:@"TestAdapter"]; ICEObject* initial = [TestObjectsInitialI initial]; diff --git a/objective-c/test/Ice/objects/TestI.h b/objective-c/test/Ice/objects/TestI.h index 44a07ec60c7..5af470c3b7c 100644 --- a/objective-c/test/Ice/objects/TestI.h +++ b/objective-c/test/Ice/objects/TestI.h @@ -5,31 +5,25 @@ #import #import -@interface TestObjectsBI : TestObjectsB +@interface TestObjectsBI : TestObjectsB { } @end -@interface TestObjectsCI : TestObjectsC +@interface TestObjectsCI : TestObjectsC { } @end -@interface TestObjectsDI : TestObjectsD +@interface TestObjectsDI : TestObjectsD { } @end -@interface TestObjectsEI : TestObjectsE +@interface TestObjectsEI : TestObjectsE @end -@interface TestObjectsFI : TestObjectsF -@end - -//@interface TestObjectsII : TestObjectsI -//@end - -@interface TestObjectsJI : TestObjectsJ +@interface TestObjectsFI : TestObjectsF @end @interface TestObjectsF2I : TestObjectsF2 diff --git a/objective-c/test/Ice/objects/TestI.m b/objective-c/test/Ice/objects/TestI.m index 5b48cd44124..16042806fda 100644 --- a/objective-c/test/Ice/objects/TestI.m +++ b/objective-c/test/Ice/objects/TestI.m @@ -64,16 +64,6 @@ -(BOOL) checkValues:(ICECurrent*)__unused current } @end -/*@implementation TestObjectsII --(void) dealloc -{ - printf("Deallocating Object"); -} -@end*/ - -@implementation TestObjectsJI -@end - @implementation TestObjectsF2I -(void) op:(ICECurrent*)__unused current { @@ -228,12 +218,12 @@ -(void) getAll:(TestObjectsB **)b1 b2:(TestObjectsB **)b2 theC:(TestObjectsC **) *theD = _d; } --(ICEObject*) getK:(ICECurrent*)__unused current +-(TestObjectsK*) getK:(ICECurrent*)__unused current { return [[TestObjectsK alloc] init:[[TestObjectsL alloc] init:@"l"]]; } --(ICEObject*) opValue:(ICEObject*)v1 v2:(ICEObject**)v2 current:(ICECurrent*)__unused current +-(ICEValue*) opValue:(ICEValue*)v1 v2:(ICEValue**)v2 current:(ICECurrent*)__unused current { *v2 = v1; return v1; diff --git a/objective-c/test/Ice/optional/AllTests.m b/objective-c/test/Ice/optional/AllTests.m index 882f6aacfb7..9a9efb5a5c3 100644 --- a/objective-c/test/Ice/optional/AllTests.m +++ b/objective-c/test/Ice/optional/AllTests.m @@ -8,7 +8,7 @@ #import -@interface TestObjectReader : ICEObject +@interface TestObjectReader : ICEValue { } @end @@ -23,7 +23,7 @@ -(void) iceRead:(id)is } @end -@interface BObjectReader : ICEObject +@interface BObjectReader : ICEValue { } @end @@ -44,7 +44,7 @@ -(void) iceRead:(id)is }; @end -@interface CObjectReader : ICEObject +@interface CObjectReader : ICEValue { } @end @@ -68,7 +68,7 @@ -(void) iceRead:(id)is }; @end -@interface DObjectWriter : ICEObject +@interface DObjectWriter : ICEValue { } @end @@ -108,7 +108,7 @@ -(void) iceWrite:(id)os } @end -@interface DObjectReader : ICEObject +@interface DObjectReader : ICEValue { TestOptionalA* a_; } @@ -137,7 +137,7 @@ -(void) iceRead:(id)is [[o objectAtIndex:2] isEqualToString:@"test3"] && [[o objectAtIndex:3] isEqualToString:@"test4"]); test([is readOptional:1000 format:ICEOptionalFormatClass]); - [is newValue:(ICEObject**)&a_ expectedType:[TestOptionalA class]]; + [is newValue:(ICEValue**)&a_ expectedType:[TestOptionalA class]]; [is endSlice]; // ::Test::B @@ -156,7 +156,7 @@ -(void) check } @end -@interface FObjectReader : ICEObject +@interface FObjectReader : ICEValue { TestOptionalF* f_; } @@ -183,11 +183,11 @@ -(void) iceRead:(id)is [is startValue]; [is startSlice]; // Don't read optional af on purpose - //[is_ readValue:(ICEObject**)&self->af expectedType:[TestOptionalA class]]; + //[is_ readValue:(ICEValue**)&self->af expectedType:[TestOptionalA class]]; [is endSlice]; [is startSlice]; TestOptionalA* ICE_AUTORELEASING_QUALIFIER ae; - [is readValue:(ICEObject**)&ae expectedType:[TestOptionalA class]]; + [is readValue:(ICEValue**)&ae expectedType:[TestOptionalA class]]; [is endSlice]; [is endValue:NO]; f_.ae = ae; @@ -207,7 +207,7 @@ -(TestOptionalF*) getF } @end -@interface FactoryI : ICEObject +@interface FactoryI : ICEValue { BOOL enabled_; } @@ -229,7 +229,7 @@ -(id) init } return self; } --(ICEObject*) create:(NSString*)typeId +-(ICEValue*) create:(NSString*)typeId { if(!enabled_) { @@ -590,7 +590,7 @@ -(void) setEnabled:(BOOL)enabled test([initial ice_invoke:@"pingPong" mode:ICENormal inEncaps:inEncaps outEncaps:&outEncaps]); id is = [ICEUtil createInputStream:communicator data:outEncaps]; [is startEncapsulation]; - ICEObject* obj; + ICEValue* obj; [is readValue:&obj]; [is endEncapsulation]; test(obj != nil && [obj isKindOfClass:[TestObjectReader class]]); @@ -779,7 +779,7 @@ -(void) setEnabled:(BOOL)enabled [factory setEnabled:YES]; os = [ICEUtil createOutputStream:communicator]; [os startEncapsulation]; - ICEObject* d = [DObjectWriter new]; + ICEValue* d = [DObjectWriter new]; [os writeValue:d]; ICE_RELEASE(d); [os endEncapsulation]; @@ -803,7 +803,7 @@ -(void) setEnabled:(BOOL)enabled [os startEncapsulation]; [os writeValue:a]; DObjectWriter* writer = [DObjectWriter new]; - [ICEObjectHelper writeOptional:writer stream:os tag:1]; + [ICEValueHelper writeOptional:writer stream:os tag:1]; ICE_RELEASE(writer); [os endEncapsulation]; inEncaps = [os finished]; @@ -1170,14 +1170,14 @@ -(void) setEnabled:(BOOL)enabled os = [ICEUtil createOutputStream:communicator]; [os startEncapsulation]; - [ICEObjectHelper writeOptional:p1 stream:os tag:2]; + [ICEValueHelper writeOptional:p1 stream:os tag:2]; [os endEncapsulation]; inEncaps = [os finished]; [initial ice_invoke:@"opOneOptional" mode:ICENormal inEncaps:inEncaps outEncaps:&outEncaps]; is = [ICEUtil createInputStream:communicator data:outEncaps]; [is startEncapsulation]; - [ICEObjectHelper readOptional:&p2 stream:is tag:1]; - [ICEObjectHelper readOptional:&p3 stream:is tag:3]; + [ICEValueHelper readOptional:&p2 stream:is tag:1]; + [ICEValueHelper readOptional:&p3 stream:is tag:3]; [is endEncapsulation]; test([p2 isKindOfClass:[TestOptionalOneOptional class]] && [p3 isKindOfClass:[TestOptionalOneOptional class]]); test(((TestOptionalOneOptional*)p2).a == 58 && ((TestOptionalOneOptional*)p3).a == 58); diff --git a/objective-c/test/Ice/slicing/objects/AllTests.m b/objective-c/test/Ice/slicing/objects/AllTests.m index d895b770983..60559049f9c 100644 --- a/objective-c/test/Ice/slicing/objects/AllTests.m +++ b/objective-c/test/Ice/slicing/objects/AllTests.m @@ -187,10 +187,10 @@ -(void) called [cond signal]; [cond unlock]; } --(void) SBaseAsObjectResponse:(ICEObject*)o +-(void) SBaseAsObjectResponse:(ICEValue*)o { test(o); - test([[o ice_id:nil] isEqualToString:@"::Test::SBase"]); + test([[o ice_id] isEqualToString:@"::Test::SBase"]); test([o isKindOfClass:[TestSlicingObjectsClientSBase class]]); TestSlicingObjectsClientSBase* sb = (TestSlicingObjectsClientSBase*)o; test([sb.sb isEqualToString:@"SBase.sb"]); @@ -259,7 +259,7 @@ -(void) SBSUnknownDerivedAsSBaseCompactException:(ICEException*)__unused exc [self called]; } --(void) SUnknownAsObjectResponse10:(ICEObject*)__unused o +-(void) SUnknownAsObjectResponse10:(ICEValue*)__unused o { test(NO); } @@ -270,7 +270,7 @@ -(void) SUnknownAsObjectException10:(ICEException*)__unused exc [self called]; } --(void) SUnknownAsObjectResponse11:(ICEObject*)o +-(void) SUnknownAsObjectResponse11:(ICEValue*)o { [self called]; [[o ice_getSlicedData] clear]; @@ -284,7 +284,7 @@ -(void) SUnknownAsObjectException11:(ICEException*)__unused exc -(void) oneElementCycleResponse:(TestSlicingObjectsClientB*)b { test(b); - test([[b ice_id:nil] isEqualToString:@"::Test::B"]); + test([[b ice_id] isEqualToString:@"::Test::B"]); test([b.sb isEqualToString:@"B1.sb"]); test(b.pb == b); breakCycles(b); @@ -299,12 +299,12 @@ -(void) oneElementCycleException:(ICEException*)__unused exc -(void) twoElementCycleResponse:(TestSlicingObjectsClientB*)b1 { test(b1); - test([[b1 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[b1 ice_id] isEqualToString:@"::Test::B"]); test([b1.sb isEqualToString:@"B1.sb"]); TestSlicingObjectsClientB* b2 = b1.pb; test(b2); - test([[b2 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[b2 ice_id] isEqualToString:@"::Test::B"]); test([b2.sb isEqualToString:@"B2.sb"]); test(b2.pb == b1); @@ -320,7 +320,7 @@ -(void) twoElementCycleException:(ICEException*)__unused exc -(void) D1AsBResponse:(TestSlicingObjectsClientB*)b1 { test(b1); - test([[b1 ice_id:nil] isEqualToString:@"::Test::D1"]); + test([[b1 ice_id] isEqualToString:@"::Test::D1"]); test([b1.sb isEqualToString:@"D1.sb"]); test(b1.pb); test(b1.pb != b1); @@ -335,7 +335,7 @@ -(void) D1AsBResponse:(TestSlicingObjectsClientB*)b1 test(b2); test(b2.pb == b1); test([b2.sb isEqualToString:@"D2.sb"]); - test([[b2 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[b2 ice_id] isEqualToString:@"::Test::B"]); breakCycles(d1); @@ -350,14 +350,14 @@ -(void) D1AsBException:(ICEException*)__unused exc -(void) D1AsD1Response:(TestSlicingObjectsClientD1*)d1 { test(d1); - test([[d1 ice_id:nil] isEqualToString:@"::Test::D1"]); + test([[d1 ice_id] isEqualToString:@"::Test::D1"]); test([d1.sb isEqualToString:@"D1.sb"]); test(d1.pb); test(d1.pb != d1); TestSlicingObjectsClientB* b2 = d1.pb; test(b2); - test([[b2 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[b2 ice_id] isEqualToString:@"::Test::B"]); test([b2.sb isEqualToString:@"D2.sb"]); test(b2.pb == d1); @@ -374,14 +374,14 @@ -(void) D1AsD1Exception:(ICEException*)__unused exc -(void) D2AsBResponse:(TestSlicingObjectsClientB*)b2 { test(b2); - test([[b2 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[b2 ice_id] isEqualToString:@"::Test::B"]); test([b2.sb isEqualToString:@"D2.sb"]); test(b2.pb); test(b2.pb != b2); TestSlicingObjectsClientB* b1 = b2.pb; test(b1); - test([[b1 ice_id:nil] isEqualToString:@"::Test::D1"]); + test([[b1 ice_id] isEqualToString:@"::Test::D1"]); test([b1.sb isEqualToString:@"D1.sb"]); test(b1.pb == b2); test([b1 isKindOfClass:[TestSlicingObjectsClientD1 class]]); @@ -402,7 +402,7 @@ -(void) D2AsBException:(ICEException*)__unused exc -(void) paramTest1Response:(TestSlicingObjectsClientB*)b1 p2:(TestSlicingObjectsClientB*)b2 { test(b1); - test([[b1 ice_id:nil] isEqualToString:@"::Test::D1"]); + test([[b1 ice_id] isEqualToString:@"::Test::D1"]); test([b1.sb isEqualToString:@"D1.sb"]); test(b1.pb == b2); test([b1 isKindOfClass:[TestSlicingObjectsClientD1 class]]); @@ -411,7 +411,7 @@ -(void) paramTest1Response:(TestSlicingObjectsClientB*)b1 p2:(TestSlicingObjects test(d1.pd1 == b2); test(b2); - test([[b2 ice_id:nil] isEqualToString:@"::Test::B"]); // No factory, must be sliced + test([[b2 ice_id] isEqualToString:@"::Test::B"]); // No factory, must be sliced test([b2.sb isEqualToString:@"D2.sb"]); test(b2.pb == b1); @@ -469,17 +469,17 @@ -(void) paramTest3Response:(TestSlicingObjectsClientB*)ret p1:(TestSlicingObject test(p1); test([p1.sb isEqualToString:@"D2.sb (p1 1)"]); test(p1.pb == 0); - test([[p1 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[p1 ice_id] isEqualToString:@"::Test::B"]); test(p2); test([p2.sb isEqualToString:@"D2.sb (p2 1)"]); test(p2.pb == 0); - test([[p2 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[p2 ice_id] isEqualToString:@"::Test::B"]); test(ret); test([ret.sb isEqualToString:@"D1.sb (p2 2)"]); test(ret.pb == 0); - test([[ret ice_id:nil] isEqualToString:@"::Test::D1"]); + test([[ret ice_id] isEqualToString:@"::Test::D1"]); [self called]; breakCycles(ret); @@ -497,12 +497,12 @@ -(void) paramTest4Response:(TestSlicingObjectsClientB*)ret p1:(TestSlicingObject test(b); test([b.sb isEqualToString:@"D4.sb (1)"]); test(b.pb == 0); - test([[b ice_id:nil] isEqualToString:@"::Test::B"]); + test([[b ice_id] isEqualToString:@"::Test::B"]); test(ret); test([ret.sb isEqualToString:@"B.sb (2)"]); test(ret.pb == 0); - test([[ret ice_id:nil] isEqualToString:@"::Test::B"]); + test([[ret ice_id] isEqualToString:@"::Test::B"]); [self called]; breakCycles(ret); @@ -745,7 +745,7 @@ -(void) exception:(ICEException*)ex tprintf("base as Object... "); { - ICEObject* o = nil; + ICEValue* o = nil; @try { o = [test SBaseAsObject]; @@ -765,7 +765,7 @@ -(void) exception:(ICEException*)ex tprintf("base as Object (AMI)... "); { TestSlicingObjectsClientCallback* cb = [TestSlicingObjectsClientCallback create]; - [test begin_SBaseAsObject:^(ICEObject* o) { [cb SBaseAsObjectResponse:o]; } + [test begin_SBaseAsObject:^(ICEValue* o) { [cb SBaseAsObjectResponse:o]; } exception:^(ICEException* ex) { [cb SBaseAsObjectException:ex]; }]; [cb check]; } @@ -928,7 +928,7 @@ -(void) exception:(ICEException*)ex tprintf("unknown with Object as Object... "); { - ICEObject* o; + ICEValue* o; @try { o = [test SUnknownAsObject]; @@ -958,12 +958,12 @@ -(void) exception:(ICEException*)ex TestSlicingObjectsClientCallback* cb = [TestSlicingObjectsClientCallback create]; if([[test ice_getEncodingVersion] isEqual:ICEEncoding_1_0]) { - [test begin_SUnknownAsObject:^(ICEObject* o) { [cb SUnknownAsObjectResponse10:o]; } + [test begin_SUnknownAsObject:^(ICEValue* o) { [cb SUnknownAsObjectResponse10:o]; } exception:^(ICEException* e) { [cb SUnknownAsObjectException10:e]; }]; } else { - [test begin_SUnknownAsObject:^(ICEObject* o) { [cb SUnknownAsObjectResponse11:o]; } + [test begin_SUnknownAsObject:^(ICEValue* o) { [cb SUnknownAsObjectResponse11:o]; } exception:^(ICEException* e) { [cb SUnknownAsObjectException11:e]; }]; } [cb check]; @@ -1343,7 +1343,7 @@ -(void) exception:(ICEException*)ex test(b1); test([b1.sb isEqualToString:@"D1.sb"]); - test([[b1 ice_id:nil] isEqualToString:@"::Test::D1"]); + test([[b1 ice_id] isEqualToString:@"::Test::D1"]); test([b1 isKindOfClass:[TestSlicingObjectsClientD1 class]]); TestSlicingObjectsClientD1* p1 = (TestSlicingObjectsClientD1*)b1; test([p1.sd1 isEqualToString:@"D1.sd1"]); @@ -1352,7 +1352,7 @@ -(void) exception:(ICEException*)ex TestSlicingObjectsClientB* b2 = b1.pb; test(b2); test([b2.sb isEqualToString:@"D3.sb"]); - test([[b2 ice_id:nil] isEqualToString:@"::Test::B"]); // Sliced by server + test([[b2 ice_id] isEqualToString:@"::Test::B"]); // Sliced by server test(b2.pb == b1); test(![b2 isKindOfClass:[TestSlicingObjectsClientD3 class]]); @@ -1442,13 +1442,13 @@ -(void) exception:(ICEException*)ex test(b1); test([b1.sb isEqualToString:@"D3.sb"]); - test([[b1 ice_id:nil] isEqualToString:@"::Test::B"]); // Sliced by server + test([[b1 ice_id] isEqualToString:@"::Test::B"]); // Sliced by server test(![b1 isKindOfClass:[TestSlicingObjectsClientD3 class]]); TestSlicingObjectsClientB* b2 = b1.pb; test(b2); test([b2.sb isEqualToString:@"D1.sb"]); - test([[b2 ice_id:nil] isEqualToString:@"::Test::D1"]); + test([[b2 ice_id] isEqualToString:@"::Test::D1"]); test(b2.pb == b1); test([b2 isKindOfClass:[TestSlicingObjectsClientD1 class]]); TestSlicingObjectsClientD1* p3 = (TestSlicingObjectsClientD1*)b2; @@ -1605,7 +1605,7 @@ -(void) exception:(ICEException*)ex TestSlicingObjectsClientB* r = cb.r; test(r); - test([[r ice_id:nil] isEqualToString:@"::Test::B"]); + test([[r ice_id] isEqualToString:@"::Test::B"]); test([r.sb isEqualToString:@"D3.sb"]); test(r.pb == r); @@ -1686,7 +1686,7 @@ -(void) exception:(ICEException*)ex [cb check]; TestSlicingObjectsClientB* r = cb.r; test(r); - test([[r ice_id:nil] isEqualToString:@"::Test::B"]); + test([[r ice_id] isEqualToString:@"::Test::B"]); test([r.sb isEqualToString:@"D3.sb"]); test(r.pb == r); @@ -1876,13 +1876,13 @@ -(void) exception:(ICEException*)ex test(ss2d1.pb == ss2b); test(ss2d3.pb == ss2b); - test([[ss1b ice_id:nil] isEqualToString:@"::Test::B"]); - test([[ss1d1 ice_id:nil] isEqualToString:@"::Test::D1"]); - test([[ss1d3 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[ss1b ice_id] isEqualToString:@"::Test::B"]); + test([[ss1d1 ice_id] isEqualToString:@"::Test::D1"]); + test([[ss1d3 ice_id] isEqualToString:@"::Test::B"]); - test([[ss2b ice_id:nil] isEqualToString:@"::Test::B"]); - test([[ss2d1 ice_id:nil] isEqualToString:@"::Test::D1"]); - test([[ss2d3 ice_id:nil] isEqualToString:@"::Test::B"]); + test([[ss2b ice_id] isEqualToString:@"::Test::B"]); + test([[ss2d1 ice_id] isEqualToString:@"::Test::D1"]); + test([[ss2d3 ice_id] isEqualToString:@"::Test::B"]); breakCycles(ss); } diff --git a/objective-c/test/Ice/slicing/objects/TestI.m b/objective-c/test/Ice/slicing/objects/TestI.m index 0bde9921668..438dac37db3 100644 --- a/objective-c/test/Ice/slicing/objects/TestI.m +++ b/objective-c/test/Ice/slicing/objects/TestI.m @@ -154,7 +154,7 @@ -(void) dealloc [super dealloc]; #endif } --(ICEObject*) SBaseAsObject:(ICECurrent*)__unused current +-(ICEValue*) SBaseAsObject:(ICECurrent*)__unused current { return [TestSlicingObjectsServerSBase sBase:@"SBase.sb"]; } @@ -188,7 +188,7 @@ -(TestSlicingObjectsServerSBase*) SBSUnknownDerivedAsSBaseCompact:(ICECurrent*)_ sbsud:@"SBSUnknownDerived.sbsud"]; } --(ICEObject*) SUnknownAsObject:(ICECurrent*)__unused current +-(ICEValue*) SUnknownAsObject:(ICECurrent*)__unused current { TestSlicingObjectsServerSUnknown* s = [TestSlicingObjectsServerSUnknown sUnknown:@"SUnknown.su" cycle:nil]; s.cycle = s; @@ -196,7 +196,7 @@ -(ICEObject*) SUnknownAsObject:(ICECurrent*)__unused current return s; } --(void) checkSUnknown:(ICEObject*)object current:(ICECurrent*)__unused current +-(void) checkSUnknown:(ICEValue*)object current:(ICECurrent*)__unused current { if([current encoding] == ICEEncoding_1_0) { diff --git a/objective-c/test/Slice/escape/Client.m b/objective-c/test/Slice/escape/Client.m index 0368663c33b..e918edb461a 100644 --- a/objective-c/test/Slice/escape/Client.m +++ b/objective-c/test/Slice/escape/Client.m @@ -18,9 +18,6 @@ @interface andcharI : andchar @interface andswitchI : andswitch @end -@interface anddoI : anddo -@end - // // This section of the test is present to ensure that the C++ types // are named correctly. It is not expected to run. diff --git a/php/src/Communicator.cpp b/php/src/Communicator.cpp index d41bfc62fe1..ae706ea58ff 100644 --- a/php/src/Communicator.cpp +++ b/php/src/Communicator.cpp @@ -2026,7 +2026,7 @@ IcePHP::FactoryWrapper::create(const string& id) return 0; } - return new ObjectReader(&obj, cls, _info); + return new ValueReader(&obj, cls, _info); } void @@ -2118,7 +2118,7 @@ IcePHP::DefaultValueFactory::create(const string& id) throw AbortMarshaling(); } - return new ObjectReader(&obj, cls, _info); + return new ValueReader(&obj, cls, _info); } void diff --git a/php/src/Operation.cpp b/php/src/Operation.cpp index 01ca9233e16..2cf9132c5df 100644 --- a/php/src/Operation.cpp +++ b/php/src/Operation.cpp @@ -539,7 +539,7 @@ IcePHP::TypedInvocation::unmarshalResults(int argc, zval* args, zval* ret, // // Store a pointer to a local StreamUtil object as the stream's closure. - // This is necessary to support object unmarshaling (see ObjectReader). + // This is necessary to support object unmarshaling (see ValueReader). // StreamUtil util; assert(!is.getClosure()); @@ -638,7 +638,7 @@ IcePHP::TypedInvocation::unmarshalException(zval* zex, const pair::iterator p = _readers.begin(); p != _readers.end(); ++p) + for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) { Ice::SlicedDataPtr slicedData = (*p)->getSlicedData(); for(Ice::SliceInfoSeq::const_iterator q = slicedData->slices.begin(); q != slicedData->slices.end(); ++q) @@ -257,7 +257,7 @@ IcePHP::StreamUtil::~StreamUtil() // the vector into a temporary and then let the temporary fall out // of scope. // - vector tmp; + vector tmp; tmp.swap((*q)->instances); } } @@ -270,7 +270,7 @@ IcePHP::StreamUtil::add(const ReadObjectCallbackPtr& callback) } void -IcePHP::StreamUtil::add(const ObjectReaderPtr& reader) +IcePHP::StreamUtil::add(const ValueReaderPtr& reader) { assert(reader->getSlicedData()); _readers.insert(reader); @@ -279,7 +279,7 @@ IcePHP::StreamUtil::add(const ObjectReaderPtr& reader) void IcePHP::StreamUtil::updateSlicedData(void) { - for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) + for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) { setSlicedDataMember((*p)->getObject(), (*p)->getSlicedData()); } @@ -376,13 +376,13 @@ IcePHP::StreamUtil::setSlicedDataMember(zval* obj, const Ice::SlicedDataPtr& sli AutoDestroy instancesDestroyer(&instances); addPropertyZval(&slice, STRCAST("instances"), &instances); - for(vector::const_iterator q = (*p)->instances.begin(); q != (*p)->instances.end(); ++q) + for(vector::const_iterator q = (*p)->instances.begin(); q != (*p)->instances.end(); ++q) { // - // Each element in the instances list is an instance of ObjectReader that wraps a PHP object. + // Each element in the instances list is an instance of ValueReader that wraps a PHP object. // assert(*q); - ObjectReaderPtr r = ObjectReaderPtr::dynamicCast(*q); + ValueReaderPtr r = ValueReaderPtr::dynamicCast(*q); assert(r); zval* o = r->getObject(); assert(Z_TYPE_P(o) == IS_OBJECT); // Should be non-nil. @@ -499,12 +499,12 @@ IcePHP::StreamUtil::getSlicedDataMember(zval* obj, ObjectMap* objectMap) { assert(Z_TYPE_P(o) == IS_OBJECT); - Ice::ObjectPtr writer; + Ice::ValuePtr writer; ObjectMap::iterator i = objectMap->find(Z_OBJ_HANDLE_P(o)); if(i == objectMap->end()) { - writer = new ObjectWriter(o, objectMap, 0); + writer = new ValueWriter(o, objectMap, 0); objectMap->insert(ObjectMap::value_type(Z_OBJ_HANDLE_P(o), writer)); } else @@ -2478,13 +2478,13 @@ IcePHP::ClassInfo::marshal(zval* zv, Ice::OutputStream* os, ObjectMap* objectMap { if(!defined) { - runtimeError("class or interface %s is declared but not defined", id.c_str()); + runtimeError("class %s is declared but not defined", id.c_str()); throw AbortMarshaling(); } if(Z_TYPE_P(zv) == IS_NULL) { - Ice::ObjectPtr nil; + Ice::ValuePtr nil; os->write(nil); return; } @@ -2493,17 +2493,17 @@ IcePHP::ClassInfo::marshal(zval* zv, Ice::OutputStream* os, ObjectMap* objectMap assert(checkClass(Z_OBJCE_P(zv), const_cast(zce))); // validate() should have caught this. // - // Ice::ObjectWriter is a subclass of Ice::Object that wraps a PHP object for marshaling. + // Ice::ValueWriter is a subclass of Ice::Value that wraps a PHP object for marshaling. // It is possible that this PHP object has already been marshaled, therefore we first must - // check the object map to see if this object is present. If so, we use the existing ObjectWriter, + // check the object map to see if this object is present. If so, we use the existing ValueWriter, // otherwise we create a new one. The key of the map is the object's handle. // - Ice::ObjectPtr writer; + Ice::ValuePtr writer; assert(objectMap); ObjectMap::iterator q = objectMap->find(Z_OBJ_HANDLE_P(zv)); if(q == objectMap->end()) { - writer = new ObjectWriter(zv, objectMap, this); + writer = new ValueWriter(zv, objectMap, this); objectMap->insert(ObjectMap::value_type(Z_OBJ_HANDLE_P(zv), writer)); } else @@ -2521,7 +2521,7 @@ namespace { void -patchObject(void* addr, const Ice::ObjectPtr& v) +patchObject(void* addr, const Ice::ValuePtr& v) { ReadObjectCallback* cb = static_cast(addr); assert(cb); @@ -2911,9 +2911,9 @@ IcePHP::ProxyInfo::getOperation(const string& name) const } // -// ObjectWriter implementation. +// ValueWriter implementation. // -IcePHP::ObjectWriter::ObjectWriter(zval* object, ObjectMap* objectMap, const ClassInfoPtr& formal) : +IcePHP::ValueWriter::ValueWriter(zval* object, ObjectMap* objectMap, const ClassInfoPtr& formal) : _map(objectMap), _formal(formal) { // Copy zval and increase ref count @@ -2932,13 +2932,13 @@ IcePHP::ObjectWriter::ObjectWriter(zval* object, ObjectMap* objectMap, const Cla } } -IcePHP::ObjectWriter::~ObjectWriter() +IcePHP::ValueWriter::~ValueWriter() { zval_ptr_dtor(&_object); } void -IcePHP::ObjectWriter::ice_preMarshal() +IcePHP::ValueWriter::ice_preMarshal() { string name = "ice_premarshal"; // Must be lowercase. if(zend_hash_str_exists(&Z_OBJCE_P(&_object)->function_table, @@ -2953,7 +2953,7 @@ IcePHP::ObjectWriter::ice_preMarshal() } void -IcePHP::ObjectWriter::_iceWrite(Ice::OutputStream* os) const +IcePHP::ValueWriter::_iceWrite(Ice::OutputStream* os) const { Ice::SlicedDataPtr slicedData; @@ -3015,10 +3015,10 @@ IcePHP::ObjectWriter::_iceWrite(Ice::OutputStream* os) const if(_info->id != "::Ice::UnknownSlicedValue") { ClassInfoPtr info = _info; - while(info && info->id != Ice::Object::ice_staticId()) + while(info && info->id != Ice::Value::ice_staticId()) { - assert(info->base); // All classes have the Ice::Object base type. - const bool lastSlice = info->base->id == Ice::Object::ice_staticId(); + assert(info->base); // All classes have the Ice::Value base type. + const bool lastSlice = info->base->id == Ice::Value::ice_staticId(); os->startSlice(info->id, info->compactId, lastSlice); writeMembers(os, info->members); @@ -3034,13 +3034,13 @@ IcePHP::ObjectWriter::_iceWrite(Ice::OutputStream* os) const } void -IcePHP::ObjectWriter::_iceRead(Ice::InputStream*) +IcePHP::ValueWriter::_iceRead(Ice::InputStream*) { assert(false); } void -IcePHP::ObjectWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& members) const +IcePHP::ValueWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& members) const { for(DataMemberList::const_iterator q = members.begin(); q != members.end(); ++q) { @@ -3078,22 +3078,22 @@ IcePHP::ObjectWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& } // -// ObjectReader implementation. +// ValueReader implementation. // -IcePHP::ObjectReader::ObjectReader(zval* object, const ClassInfoPtr& info, const CommunicatorInfoPtr& comm) : +IcePHP::ValueReader::ValueReader(zval* object, const ClassInfoPtr& info, const CommunicatorInfoPtr& comm) : _info(info), _communicator(comm) { assert(Z_TYPE_P(object) == IS_OBJECT); ZVAL_COPY(&_object, object); } -IcePHP::ObjectReader::~ObjectReader() +IcePHP::ValueReader::~ValueReader() { zval_ptr_dtor(&_object); } void -IcePHP::ObjectReader::ice_postUnmarshal() +IcePHP::ValueReader::ice_postUnmarshal() { string name = "ice_postunmarshal"; // Must be lowercase. if(zend_hash_str_exists(&Z_OBJCE(_object)->function_table, @@ -3107,13 +3107,13 @@ IcePHP::ObjectReader::ice_postUnmarshal() } void -IcePHP::ObjectReader::_iceWrite(Ice::OutputStream*) const +IcePHP::ValueReader::_iceWrite(Ice::OutputStream*) const { assert(false); } void -IcePHP::ObjectReader::_iceRead(Ice::InputStream* is) +IcePHP::ValueReader::_iceRead(Ice::InputStream* is) { is->startValue(); const bool unknown = _info->id == "::Ice::UnknownSlicedValue"; @@ -3125,7 +3125,7 @@ IcePHP::ObjectReader::_iceRead(Ice::InputStream* is) { ClassInfoPtr info = _info; - while(info && info->id != Ice::Object::ice_staticId()) + while(info && info->id != Ice::Value::ice_staticId()) { is->startSlice(); @@ -3187,19 +3187,19 @@ IcePHP::ObjectReader::_iceRead(Ice::InputStream* is) } ClassInfoPtr -IcePHP::ObjectReader::getInfo() const +IcePHP::ValueReader::getInfo() const { return _info; } zval* -IcePHP::ObjectReader::getObject() const +IcePHP::ValueReader::getObject() const { return const_cast(&_object); } Ice::SlicedDataPtr -IcePHP::ObjectReader::getSlicedData() const +IcePHP::ValueReader::getSlicedData() const { return _slicedData; } @@ -3226,7 +3226,7 @@ IcePHP::ReadObjectCallback::~ReadObjectCallback() } void -IcePHP::ReadObjectCallback::invoke(const Ice::ObjectPtr& p) +IcePHP::ReadObjectCallback::invoke(const Ice::ValuePtr& p) { #ifdef HT_ALLOW_COW_VIOLATION if(!ZVAL_IS_NULL(&_target)) @@ -3236,7 +3236,7 @@ IcePHP::ReadObjectCallback::invoke(const Ice::ObjectPtr& p) #endif if(p) { - ObjectReaderPtr reader = ObjectReaderPtr::dynamicCast(p); + ValueReaderPtr reader = ValueReaderPtr::dynamicCast(p); assert(reader); // diff --git a/php/src/Types.h b/php/src/Types.h index 059b5506e98..e36dc394899 100644 --- a/php/src/Types.h +++ b/php/src/Types.h @@ -42,10 +42,10 @@ class ClassInfo; typedef IceUtil::Handle ClassInfoPtr; typedef std::vector ClassInfoList; -typedef std::map ObjectMap; +typedef std::map ObjectMap; -class ObjectReader; -typedef IceUtil::Handle ObjectReaderPtr; +class ValueReader; +typedef IceUtil::Handle ValueReaderPtr; struct PrintObjectHistory { @@ -87,7 +87,7 @@ class ReadObjectCallback : public IceUtil::Shared ReadObjectCallback(const ClassInfoPtr&, const UnmarshalCallbackPtr&, zval*, void*); ~ReadObjectCallback(); - virtual void invoke(const ::Ice::ObjectPtr&); + virtual void invoke(const ::Ice::ValuePtr&); private: @@ -116,7 +116,7 @@ class StreamUtil // // Keep track of object instances that have preserved slices. // - void add(const ObjectReaderPtr&); + void add(const ValueReaderPtr&); void updateSlicedData(void); @@ -126,7 +126,7 @@ class StreamUtil private: std::vector _callbacks; - std::set _readers; + std::set _readers; static zend_class_entry* _slicedDataType; static zend_class_entry* _sliceInfoType; }; @@ -526,14 +526,14 @@ bool typesRequestInit(void); bool typesRequestShutdown(void); // -// ObjectWriter wraps a PHP object for marshaling. +// ValueWriter wraps a PHP object for marshaling. // -class ObjectWriter : public Ice::Object +class ValueWriter : public Ice::Value { public: - ObjectWriter(zval*, ObjectMap*, const ClassInfoPtr&); - ~ObjectWriter(); + ValueWriter(zval*, ObjectMap*, const ClassInfoPtr&); + ~ValueWriter(); virtual void ice_preMarshal(); @@ -551,14 +551,14 @@ class ObjectWriter : public Ice::Object }; // -// ObjectReader unmarshals the state of an Ice object. +// ValueReader unmarshals the state of an Ice value. // -class ObjectReader : public Ice::Object +class ValueReader : public Ice::Value { public: - ObjectReader(zval*, const ClassInfoPtr&, const CommunicatorInfoPtr&); - ~ObjectReader(); + ValueReader(zval*, const ClassInfoPtr&, const CommunicatorInfoPtr&); + ~ValueReader(); virtual void ice_postUnmarshal(); diff --git a/python/modules/IcePy/Operation.cpp b/python/modules/IcePy/Operation.cpp index 77106fc7772..55d98c39f4f 100644 --- a/python/modules/IcePy/Operation.cpp +++ b/python/modules/IcePy/Operation.cpp @@ -2054,7 +2054,7 @@ IcePy::Invocation::unmarshalResults(const OperationPtr& op, const pair::iterator p = _readers.begin(); p != _readers.end(); ++p) + for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) { Ice::SlicedDataPtr slicedData = (*p)->getSlicedData(); for(Ice::SliceInfoSeq::const_iterator q = slicedData->slices.begin(); q != slicedData->slices.end(); ++q) @@ -412,20 +412,20 @@ IcePy::StreamUtil::~StreamUtil() // the vector into a temporary and then let the temporary fall out // of scope. // - vector tmp; + vector tmp; tmp.swap((*q)->instances); } } } void -IcePy::StreamUtil::add(const ReadObjectCallbackPtr& callback) +IcePy::StreamUtil::add(const ReadValueCallbackPtr& callback) { _callbacks.push_back(callback); } void -IcePy::StreamUtil::add(const ObjectReaderPtr& reader) +IcePy::StreamUtil::add(const ValueReaderPtr& reader) { assert(reader->getSlicedData()); _readers.insert(reader); @@ -434,7 +434,7 @@ IcePy::StreamUtil::add(const ObjectReaderPtr& reader) void IcePy::StreamUtil::updateSlicedData() { - for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) + for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) { setSlicedDataMember((*p)->getObject(), (*p)->getSlicedData()); } @@ -562,13 +562,13 @@ IcePy::StreamUtil::setSlicedDataMember(PyObject* obj, const Ice::SlicedDataPtr& } int j = 0; - for(vector::iterator q = (*p)->instances.begin(); q != (*p)->instances.end(); ++q) + for(vector::iterator q = (*p)->instances.begin(); q != (*p)->instances.end(); ++q) { // - // Each element in the instances list is an instance of ObjectReader that wraps a Python object. + // Each element in the instances list is an instance of ValueReader that wraps a Python object. // assert(*q); - ObjectReaderPtr r = ObjectReaderPtr::dynamicCast(*q); + ValueReaderPtr r = ValueReaderPtr::dynamicCast(*q); assert(r); PyObject* pobj = r->getObject(); assert(pobj != Py_None); // Should be non-nil. @@ -667,12 +667,12 @@ IcePy::StreamUtil::getSlicedDataMember(PyObject* obj, ObjectMap* objectMap) { PyObject* o = PyTuple_GET_ITEM(instances.get(), j); - Ice::ObjectPtr writer; + Ice::ValuePtr writer; ObjectMap::iterator k = objectMap->find(o); if(k == objectMap->end()) { - writer = new ObjectWriter(o, objectMap, 0); + writer = new ValueWriter(o, objectMap, 0); objectMap->insert(ObjectMap::value_type(o, writer)); } else @@ -3474,7 +3474,7 @@ IcePy::ValueInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* objectM if(p == Py_None) { - Ice::ObjectPtr nil; + Ice::ValuePtr nil; os->write(nil); return; } @@ -3486,17 +3486,17 @@ IcePy::ValueInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* objectM } // - // Ice::ObjectWriter is a subclass of Ice::Object that wraps a Python object for marshaling. + // Ice::ValueWriter is a subclass of Ice::Value that wraps a Python object for marshaling. // It is possible that this Python object has already been marshaled, therefore we first must - // check the object map to see if this object is present. If so, we use the existing ObjectWriter, + // check the object map to see if this object is present. If so, we use the existing ValueWriter, // otherwise we create a new one. // - Ice::ObjectPtr writer; + Ice::ValuePtr writer; assert(objectMap); ObjectMap::iterator q = objectMap->find(p); if(q == objectMap->end()) { - writer = new ObjectWriter(p, objectMap, this); + writer = new ValueWriter(p, objectMap, this); objectMap->insert(ObjectMap::value_type(p, writer)); } else @@ -3514,9 +3514,9 @@ namespace { void -patchObject(void* addr, const Ice::ObjectPtr& v) +patchObject(void* addr, const Ice::ValuePtr& v) { - ReadObjectCallback* cb = static_cast(addr); + ReadValueCallback* cb = static_cast(addr); assert(cb); cb->invoke(v); } @@ -3538,7 +3538,7 @@ IcePy::ValueInfo::unmarshal(Ice::InputStream* is, const UnmarshalCallbackPtr& cb // attached to the stream keeps a reference to the callback object to ensure it lives // long enough. // - ReadObjectCallbackPtr rocb = new ReadObjectCallback(this, cb, target, closure); + ReadValueCallbackPtr rocb = new ReadValueCallback(this, cb, target, closure); StreamUtil* util = reinterpret_cast(is->getClosure()); assert(util); util->add(rocb); @@ -3772,9 +3772,9 @@ IcePy::ProxyInfo::print(PyObject* value, IceUtilInternal::Output& out, PrintObje } // -// ObjectWriter implementation. +// ValueWriter implementation. // -IcePy::ObjectWriter::ObjectWriter(PyObject* object, ObjectMap* objectMap, const ValueInfoPtr& formal) : +IcePy::ValueWriter::ValueWriter(PyObject* object, ObjectMap* objectMap, const ValueInfoPtr& formal) : _object(object), _map(objectMap), _formal(formal) { Py_INCREF(_object); @@ -3791,13 +3791,13 @@ IcePy::ObjectWriter::ObjectWriter(PyObject* object, ObjectMap* objectMap, const } } -IcePy::ObjectWriter::~ObjectWriter() +IcePy::ValueWriter::~ValueWriter() { Py_DECREF(_object); } void -IcePy::ObjectWriter::ice_preMarshal() +IcePy::ValueWriter::ice_preMarshal() { if(PyObject_HasAttrString(_object, STRCAST("ice_preMarshal")) == 1) { @@ -3811,7 +3811,7 @@ IcePy::ObjectWriter::ice_preMarshal() } void -IcePy::ObjectWriter::_iceWrite(Ice::OutputStream* os) const +IcePy::ValueWriter::_iceWrite(Ice::OutputStream* os) const { Ice::SlicedDataPtr slicedData; @@ -3860,13 +3860,13 @@ IcePy::ObjectWriter::_iceWrite(Ice::OutputStream* os) const } void -IcePy::ObjectWriter::_iceRead(Ice::InputStream*) +IcePy::ValueWriter::_iceRead(Ice::InputStream*) { assert(false); } void -IcePy::ObjectWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& members) const +IcePy::ValueWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& members) const { for(DataMemberList::const_iterator q = members.begin(); q != members.end(); ++q) { @@ -3907,21 +3907,21 @@ IcePy::ObjectWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& m } // -// ObjectReader implementation. +// ValueReader implementation. // -IcePy::ObjectReader::ObjectReader(PyObject* object, const ValueInfoPtr& info) : +IcePy::ValueReader::ValueReader(PyObject* object, const ValueInfoPtr& info) : _object(object), _info(info) { Py_INCREF(_object); } -IcePy::ObjectReader::~ObjectReader() +IcePy::ValueReader::~ValueReader() { Py_DECREF(_object); } void -IcePy::ObjectReader::ice_postUnmarshal() +IcePy::ValueReader::ice_postUnmarshal() { if(PyObject_HasAttrString(_object, STRCAST("ice_postUnmarshal")) == 1) { @@ -3935,13 +3935,13 @@ IcePy::ObjectReader::ice_postUnmarshal() } void -IcePy::ObjectReader::_iceWrite(Ice::OutputStream*) const +IcePy::ValueReader::_iceWrite(Ice::OutputStream*) const { assert(false); } void -IcePy::ObjectReader::_iceRead(Ice::InputStream* is) +IcePy::ValueReader::_iceRead(Ice::InputStream* is) { is->startValue(); @@ -3950,7 +3950,7 @@ IcePy::ObjectReader::_iceRead(Ice::InputStream* is) // // Unmarshal the slices of a user-defined class. // - if(!unknown && _info->id != Ice::Object::ice_staticId()) + if(!unknown && _info->id != Ice::Value::ice_staticId()) { ValueInfoPtr info = _info; while(info) @@ -4014,54 +4014,54 @@ IcePy::ObjectReader::_iceRead(Ice::InputStream* is) } ValueInfoPtr -IcePy::ObjectReader::getInfo() const +IcePy::ValueReader::getInfo() const { return _info; } PyObject* -IcePy::ObjectReader::getObject() const +IcePy::ValueReader::getObject() const { return _object; } Ice::SlicedDataPtr -IcePy::ObjectReader::getSlicedData() const +IcePy::ValueReader::getSlicedData() const { return _slicedData; } // -// ReadObjectCallback implementation. +// ReadValueCallback implementation. // -IcePy::ReadObjectCallback::ReadObjectCallback(const ValueInfoPtr& info, const UnmarshalCallbackPtr& cb, +IcePy::ReadValueCallback::ReadValueCallback(const ValueInfoPtr& info, const UnmarshalCallbackPtr& cb, PyObject* target, void* closure) : _info(info), _cb(cb), _target(target), _closure(closure) { Py_XINCREF(_target); } -IcePy::ReadObjectCallback::~ReadObjectCallback() +IcePy::ReadValueCallback::~ReadValueCallback() { Py_XDECREF(_target); } void -IcePy::ReadObjectCallback::invoke(const Ice::ObjectPtr& p) +IcePy::ReadValueCallback::invoke(const Ice::ValuePtr& p) { if(p) { - ObjectReaderPtr reader = ObjectReaderPtr::dynamicCast(p); + ValueReaderPtr reader = ValueReaderPtr::dynamicCast(p); assert(reader); // - // Verify that the object's type is compatible with the formal type. + // Verify that the value's type is compatible with the formal type. // PyObject* obj = reader->getObject(); // Borrowed reference. if(!PyObject_IsInstance(obj, _info->pythonType)) { Ice::UnexpectedObjectException ex(__FILE__, __LINE__); - ex.reason = "unmarshaled object is not an instance of " + _info->id; + ex.reason = "unmarshaled value is not an instance of " + _info->id; ex.type = reader->getInfo()->getId(); ex.expectedType = _info->id; throw ex; diff --git a/python/modules/IcePy/Types.h b/python/modules/IcePy/Types.h index f01a4ad6576..8c4ad5a194e 100644 --- a/python/modules/IcePy/Types.h +++ b/python/modules/IcePy/Types.h @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include @@ -38,10 +38,10 @@ class AbortMarshaling { }; -typedef std::map ObjectMap; +typedef std::map ObjectMap; -class ObjectReader; -typedef IceUtil::Handle ObjectReaderPtr; +class ValueReader; +typedef IceUtil::Handle ValueReaderPtr; // // The delayed nature of class unmarshaling in the Ice protocol requires us to @@ -67,17 +67,17 @@ class UnmarshalCallback : public IceUtil::Shared typedef IceUtil::Handle UnmarshalCallbackPtr; // -// ReadObjectCallback retains all of the information necessary to store an unmarshaled +// ReadValueCallback retains all of the information necessary to store an unmarshaled // Slice value as a Python object. // -class ReadObjectCallback : public IceUtil::Shared +class ReadValueCallback : public IceUtil::Shared { public: - ReadObjectCallback(const ValueInfoPtr&, const UnmarshalCallbackPtr&, PyObject*, void*); - ~ReadObjectCallback(); + ReadValueCallback(const ValueInfoPtr&, const UnmarshalCallbackPtr&, PyObject*, void*); + ~ReadValueCallback(); - void invoke(const ::Ice::ObjectPtr&); + void invoke(const ::Ice::ValuePtr&); private: @@ -86,7 +86,7 @@ class ReadObjectCallback : public IceUtil::Shared PyObject* _target; void* _closure; }; -typedef IceUtil::Handle ReadObjectCallbackPtr; +typedef IceUtil::Handle ReadValueCallbackPtr; // // This class assists during unmarshaling of Slice classes and exceptions. @@ -100,14 +100,14 @@ class StreamUtil ~StreamUtil(); // - // Keep a reference to a ReadObjectCallback for patching purposes. + // Keep a reference to a ReadValueCallback for patching purposes. // - void add(const ReadObjectCallbackPtr&); + void add(const ReadValueCallbackPtr&); // // Keep track of object instances that have preserved slices. // - void add(const ObjectReaderPtr&); + void add(const ValueReaderPtr&); // // Updated the sliced data information for all stored object instances. @@ -119,8 +119,8 @@ class StreamUtil private: - std::vector _callbacks; - std::set _readers; + std::vector _callbacks; + std::set _readers; static PyObject* _slicedDataType; static PyObject* _sliceInfoType; }; @@ -612,14 +612,14 @@ class ExceptionInfo : public IceUtil::Shared }; // -// ObjectWriter wraps a Python object for marshaling. +// ValueWriter wraps a Python object for marshaling. // -class ObjectWriter : public Ice::Object +class ValueWriter : public Ice::Value { public: - ObjectWriter(PyObject*, ObjectMap*, const ValueInfoPtr&); - ~ObjectWriter(); + ValueWriter(PyObject*, ObjectMap*, const ValueInfoPtr&); + ~ValueWriter(); virtual void ice_preMarshal(); @@ -637,14 +637,14 @@ class ObjectWriter : public Ice::Object }; // -// ObjectReader unmarshals the state of an Ice object. +// ValueReader unmarshals the state of an Ice object. // -class ObjectReader : public Ice::Object +class ValueReader : public Ice::Value { public: - ObjectReader(PyObject*, const ValueInfoPtr&); - ~ObjectReader(); + ValueReader(PyObject*, const ValueInfoPtr&); + ~ValueReader(); virtual void ice_postUnmarshal(); diff --git a/python/modules/IcePy/ValueFactoryManager.cpp b/python/modules/IcePy/ValueFactoryManager.cpp index f9020bc919e..7db6e0d5527 100644 --- a/python/modules/IcePy/ValueFactoryManager.cpp +++ b/python/modules/IcePy/ValueFactoryManager.cpp @@ -27,7 +27,7 @@ namespace ValueInfoPtr getValueInfo(const string& id) { - return id == Ice::Object::ice_staticId() ? lookupValueInfo("::Ice::UnknownSlicedValue") : lookupValueInfo(id); + return id == Ice::Value::ice_staticId() ? lookupValueInfo("::Ice::UnknownSlicedValue") : lookupValueInfo(id); } } @@ -232,7 +232,7 @@ IcePy::FactoryWrapper::create(const string& id) return 0; } - return new ObjectReader(obj.get(), info); + return new ValueReader(obj.get(), info); } PyObject* @@ -300,7 +300,7 @@ IcePy::DefaultValueFactory::create(const string& id) throw AbortMarshaling(); } - return new ObjectReader(obj.get(), info); + return new ValueReader(obj.get(), info); } void diff --git a/python/python/Ice/__init__.py b/python/python/Ice/__init__.py index 2aea0564738..113c5a722af 100644 --- a/python/python/Ice/__init__.py +++ b/python/python/Ice/__init__.py @@ -1820,7 +1820,7 @@ def _callbackOnInterruptCallback(self, sig): _signalPolicy = HandleSignals # -# Define Ice::Object and Ice::ObjectPrx. +# Define Ice::Value and Ice::ObjectPrx. # IcePy._t_Object = IcePy.defineClass('::Ice::Object', Object, (), None, ()) IcePy._t_Value = IcePy.defineValue('::Ice::Object', Value, -1, (), False, False, None, ()) diff --git a/ruby/ruby/Ice.rb b/ruby/ruby/Ice.rb index 2702722e88b..f8833b532b3 100644 --- a/ruby/ruby/Ice.rb +++ b/ruby/ruby/Ice.rb @@ -74,7 +74,7 @@ class LocalException < Exception end # - # Ice::Object + # Ice::Value # T_Value = Ice.__declareClass('::Ice::Object') T_ObjectPrx = Ice.__declareProxy('::Ice::Object') diff --git a/ruby/src/IceRuby/Operation.cpp b/ruby/src/IceRuby/Operation.cpp index 781cbf6e13a..f1932f0bfe1 100644 --- a/ruby/src/IceRuby/Operation.cpp +++ b/ruby/src/IceRuby/Operation.cpp @@ -418,7 +418,7 @@ IceRuby::OperationI::prepareRequest(const Ice::ObjectPrx& proxy, VALUE args, Ice // os->startEncapsulation(proxy->ice_getEncodingVersion(), _format); - ObjectMap objectMap; + ValueMap valueMap; ParamInfoList::iterator p; // @@ -445,7 +445,7 @@ IceRuby::OperationI::prepareRequest(const Ice::ObjectPrx& proxy, VALUE args, Ice if(!info->optional) { volatile VALUE arg = RARRAY_AREF(args, info->pos); - info->type->marshal(arg, os, &objectMap, false); + info->type->marshal(arg, os, &valueMap, false); } } @@ -458,7 +458,7 @@ IceRuby::OperationI::prepareRequest(const Ice::ObjectPrx& proxy, VALUE args, Ice volatile VALUE arg = RARRAY_AREF(args, info->pos); if(arg != Unset && os->writeOptional(info->tag, info->type->optionalFormat())) { - info->type->marshal(arg, os, &objectMap, true); + info->type->marshal(arg, os, &valueMap, true); } } @@ -492,7 +492,7 @@ IceRuby::OperationI::unmarshalResults(const vector& bytes, const Ice: // // Store a pointer to a local StreamUtil object as the stream's closure. - // This is necessary to support object unmarshaling (see ObjectReader). + // This is necessary to support object unmarshaling (see ValueReader). // StreamUtil util; assert(!is.getClosure()); @@ -561,7 +561,7 @@ IceRuby::OperationI::unmarshalException(const vector& bytes, const Ic // // Store a pointer to a local StreamUtil object as the stream's closure. - // This is necessary to support object unmarshaling (see ObjectReader). + // This is necessary to support object unmarshaling (see ValueReader). // StreamUtil util; assert(!is.getClosure()); diff --git a/ruby/src/IceRuby/Types.cpp b/ruby/src/IceRuby/Types.cpp index 21799616861..bfc42c3d951 100644 --- a/ruby/src/IceRuby/Types.cpp +++ b/ruby/src/IceRuby/Types.cpp @@ -177,9 +177,9 @@ IceRuby::StreamUtil::StreamUtil() IceRuby::StreamUtil::~StreamUtil() { // - // Make sure we break any cycles among the ObjectReaders in preserved slices. + // Make sure we break any cycles among the ValueReaders in preserved slices. // - for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) + for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) { Ice::SlicedDataPtr slicedData = (*p)->getSlicedData(); for(Ice::SliceInfoSeq::const_iterator q = slicedData->slices.begin(); q != slicedData->slices.end(); ++q) @@ -190,20 +190,20 @@ IceRuby::StreamUtil::~StreamUtil() // the vector into a temporary and then let the temporary fall out // of scope. // - vector tmp; + vector tmp; tmp.swap((*q)->instances); } } } void -IceRuby::StreamUtil::add(const ReadObjectCallbackPtr& callback) +IceRuby::StreamUtil::add(const ReadValueCallbackPtr& callback) { _callbacks.push_back(callback); } void -IceRuby::StreamUtil::add(const ObjectReaderPtr& reader) +IceRuby::StreamUtil::add(const ValueReaderPtr& reader) { assert(reader->getSlicedData()); _readers.insert(reader); @@ -212,7 +212,7 @@ IceRuby::StreamUtil::add(const ObjectReaderPtr& reader) void IceRuby::StreamUtil::updateSlicedData() { - for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) + for(set::iterator p = _readers.begin(); p != _readers.end(); ++p) { setSlicedDataMember((*p)->getObject(), (*p)->getSlicedData()); } @@ -282,13 +282,13 @@ IceRuby::StreamUtil::setSlicedDataMember(VALUE obj, const Ice::SlicedDataPtr& sl callRuby(rb_iv_set, slice, "@instances", instances); int j = 0; - for(vector::iterator q = (*p)->instances.begin(); q != (*p)->instances.end(); ++q) + for(vector::iterator q = (*p)->instances.begin(); q != (*p)->instances.end(); ++q) { // - // Each element in the instances list is an instance of ObjectReader that wraps a Ruby object. + // Each element in the instances list is an instance of ValueReader that wraps a Ruby object. // assert(*q); - ObjectReaderPtr r = ObjectReaderPtr::dynamicCast(*q); + ValueReaderPtr r = ValueReaderPtr::dynamicCast(*q); assert(r); VALUE o = r->getObject(); assert(o != Qnil); // Should be non-nil. @@ -315,7 +315,7 @@ IceRuby::StreamUtil::setSlicedDataMember(VALUE obj, const Ice::SlicedDataPtr& sl // named _ice_slicedData which is an instance of the Ruby class Ice::SlicedData. // Ice::SlicedDataPtr -IceRuby::StreamUtil::getSlicedDataMember(VALUE obj, ObjectMap* objectMap) +IceRuby::StreamUtil::getSlicedDataMember(VALUE obj, ValueMap* valueMap) { Ice::SlicedDataPtr slicedData; @@ -364,13 +364,13 @@ IceRuby::StreamUtil::getSlicedDataMember(VALUE obj, ObjectMap* objectMap) { VALUE o = RARRAY_AREF(instances, j); - Ice::ObjectPtr writer; + Ice::ValuePtr writer; - ObjectMap::iterator k = objectMap->find(o); - if(k == objectMap->end()) + ValueMap::iterator k = valueMap->find(o); + if(k == valueMap->end()) { - writer = new ObjectWriter(o, objectMap, 0); - objectMap->insert(ObjectMap::value_type(o, writer)); + writer = new ValueWriter(o, valueMap, 0); + valueMap->insert(ValueMap::value_type(o, writer)); } else { @@ -534,7 +534,7 @@ IceRuby::PrimitiveInfo::optionalFormat() const } void -IceRuby::PrimitiveInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap*, bool) +IceRuby::PrimitiveInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap*, bool) { switch(kind) { @@ -812,7 +812,7 @@ IceRuby::EnumInfo::optionalFormat() const } void -IceRuby::EnumInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap*, bool) +IceRuby::EnumInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap*, bool) { assert(callRuby(rb_obj_is_instance_of, p, rubyClass) == Qtrue); // validate() should have caught this. @@ -993,7 +993,7 @@ IceRuby::StructInfo::usesClasses() const } void -IceRuby::StructInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* objectMap, bool optional) +IceRuby::StructInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap* valueMap, bool optional) { assert(NIL_P(p) || callRuby(rb_obj_is_kind_of, p, rubyClass) == Qtrue); // validate() should have caught this. @@ -1029,7 +1029,7 @@ IceRuby::StructInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* objectMa throw RubyException(rb_eTypeError, "invalid value for %s member `%s'", const_cast(id.c_str()), member->name.c_str()); } - member->type->marshal(val, os, objectMap, false); + member->type->marshal(val, os, valueMap, false); } if(optional && _variableLength) @@ -1176,7 +1176,7 @@ IceRuby::SequenceInfo::usesClasses() const } void -IceRuby::SequenceInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* objectMap, bool optional) +IceRuby::SequenceInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap* valueMap, bool optional) { PrimitiveInfoPtr pi = PrimitiveInfoPtr::dynamicCast(elementType); @@ -1243,7 +1243,7 @@ IceRuby::SequenceInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* object throw RubyException(rb_eTypeError, "invalid value for element %ld of `%s'", i, const_cast(id.c_str())); } - elementType->marshal(RARRAY_AREF(arr, i), os, objectMap, false); + elementType->marshal(RARRAY_AREF(arr, i), os, valueMap, false); } } @@ -1731,24 +1731,24 @@ namespace { struct DictionaryMarshalIterator : public IceRuby::HashIterator { - DictionaryMarshalIterator(const IceRuby::DictionaryInfoPtr& d, Ice::OutputStream* o, IceRuby::ObjectMap* m) - : dict(d), os(o), objectMap(m) + DictionaryMarshalIterator(const IceRuby::DictionaryInfoPtr& d, Ice::OutputStream* o, IceRuby::ValueMap* m) + : dict(d), os(o), valueMap(m) { } virtual void element(VALUE key, VALUE value) { - dict->marshalElement(key, value, os, objectMap); + dict->marshalElement(key, value, os, valueMap); } IceRuby::DictionaryInfoPtr dict; Ice::OutputStream* os; - IceRuby::ObjectMap* objectMap; + IceRuby::ValueMap* valueMap; }; } void -IceRuby::DictionaryInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* objectMap, bool optional) +IceRuby::DictionaryInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap* valueMap, bool optional) { volatile VALUE hash = Qnil; @@ -1789,7 +1789,7 @@ IceRuby::DictionaryInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* obje os->writeSize(sz); if(sz > 0) { - DictionaryMarshalIterator iter(this, os, objectMap); + DictionaryMarshalIterator iter(this, os, valueMap); hashIterate(hash, iter); } } @@ -1801,7 +1801,7 @@ IceRuby::DictionaryInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* obje } void -IceRuby::DictionaryInfo::marshalElement(VALUE key, VALUE value, Ice::OutputStream* os, ObjectMap* objectMap) +IceRuby::DictionaryInfo::marshalElement(VALUE key, VALUE value, Ice::OutputStream* os, ValueMap* valueMap) { if(!keyType->validate(key)) { @@ -1813,8 +1813,8 @@ IceRuby::DictionaryInfo::marshalElement(VALUE key, VALUE value, Ice::OutputStrea throw RubyException(rb_eTypeError, "invalid value in `%s' element", const_cast(id.c_str())); } - keyType->marshal(key, os, objectMap, false); - valueType->marshal(value, os, objectMap, false); + keyType->marshal(key, os, valueMap, false); + valueType->marshal(value, os, valueMap, false); } void @@ -2069,7 +2069,7 @@ IceRuby::ClassInfo::usesClasses() const } void -IceRuby::ClassInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* objectMap, bool) +IceRuby::ClassInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap* valueMap, bool) { if(!defined) { @@ -2078,24 +2078,24 @@ IceRuby::ClassInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap* objectMap if(NIL_P(p)) { - Ice::ObjectPtr nil; + Ice::ValuePtr nil; os->write(nil); return; } // - // Ice::ObjectWriter is a subclass of Ice::Object that wraps a Ruby object for marshaling. + // Ice::ValueWriter is a subclass of Ice::Object that wraps a Ruby object for marshaling. // It is possible that this Ruby object has already been marshaled, therefore we first must - // check the object map to see if this object is present. If so, we use the existing ObjectWriter, + // check the object map to see if this object is present. If so, we use the existing ValueWriter, // otherwise we create a new one. // - Ice::ObjectPtr writer; - assert(objectMap); - ObjectMap::iterator q = objectMap->find(p); - if(q == objectMap->end()) + Ice::ValuePtr writer; + assert(valueMap); + ValueMap::iterator q = valueMap->find(p); + if(q == valueMap->end()) { - writer = new ObjectWriter(p, objectMap, this); - objectMap->insert(ObjectMap::value_type(p, writer)); + writer = new ValueWriter(p, valueMap, this); + valueMap->insert(ValueMap::value_type(p, writer)); } else { @@ -2112,9 +2112,9 @@ namespace { void -patchObject(void* addr, const Ice::ObjectPtr& v) +patchObject(void* addr, const Ice::ValuePtr& v) { - ReadObjectCallback* cb = static_cast(addr); + ReadValueCallback* cb = static_cast(addr); assert(cb); cb->invoke(v); } @@ -2134,7 +2134,7 @@ IceRuby::ClassInfo::unmarshal(Ice::InputStream* is, const UnmarshalCallbackPtr& // attached to the stream keeps a reference to the callback object to ensure it lives // long enough. // - ReadObjectCallbackPtr rocb = new ReadObjectCallback(this, cb, target, closure); + ReadValueCallbackPtr rocb = new ReadValueCallback(this, cb, target, closure); StreamUtil* util = reinterpret_cast(is->getClosure()); assert(util); util->add(rocb); @@ -2364,7 +2364,7 @@ IceRuby::ProxyInfo::optionalFormat() const } void -IceRuby::ProxyInfo::marshal(VALUE p, Ice::OutputStream* os, ObjectMap*, bool optional) +IceRuby::ProxyInfo::marshal(VALUE p, Ice::OutputStream* os, ValueMap*, bool optional) { Ice::OutputStream::size_type sizePos = 0; if(optional) @@ -2474,10 +2474,10 @@ IceRuby::ProxyInfo::destroy() } // -// ObjectWriter implementation. +// ValueWriter implementation. // -IceRuby::ObjectWriter::ObjectWriter(VALUE object, ObjectMap* objectMap, const ClassInfoPtr& formal) : - _object(object), _map(objectMap), _formal(formal) +IceRuby::ValueWriter::ValueWriter(VALUE object, ValueMap* valueMap, const ClassInfoPtr& formal) : + _object(object), _map(valueMap), _formal(formal) { // // Mark the object as in use for the lifetime of this wrapper. @@ -2493,13 +2493,13 @@ IceRuby::ObjectWriter::ObjectWriter(VALUE object, ObjectMap* objectMap, const Cl } } -IceRuby::ObjectWriter::~ObjectWriter() +IceRuby::ValueWriter::~ValueWriter() { rb_gc_unregister_address(&_object); } void -IceRuby::ObjectWriter::ice_preMarshal() +IceRuby::ValueWriter::ice_preMarshal() { ID id = rb_intern("ice_preMarshal"); if(callRuby(rb_respond_to, _object, id)) @@ -2509,7 +2509,7 @@ IceRuby::ObjectWriter::ice_preMarshal() } void -IceRuby::ObjectWriter::_iceWrite(Ice::OutputStream* os) const +IceRuby::ValueWriter::_iceWrite(Ice::OutputStream* os) const { Ice::SlicedDataPtr slicedData; @@ -2518,7 +2518,7 @@ IceRuby::ObjectWriter::_iceWrite(Ice::OutputStream* os) const // // Retrieve the SlicedData object that we stored as a hidden member of the Ruby object. // - slicedData = StreamUtil::getSlicedDataMember(_object, const_cast(_map)); + slicedData = StreamUtil::getSlicedDataMember(_object, const_cast(_map)); } os->startValue(slicedData); @@ -2551,13 +2551,13 @@ IceRuby::ObjectWriter::_iceWrite(Ice::OutputStream* os) const } void -IceRuby::ObjectWriter::_iceRead(Ice::InputStream*) +IceRuby::ValueWriter::_iceRead(Ice::InputStream*) { assert(false); } void -IceRuby::ObjectWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& members) const +IceRuby::ValueWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& members) const { for(DataMemberList::const_iterator q = members.begin(); q != members.end(); ++q) { @@ -2581,9 +2581,9 @@ IceRuby::ObjectWriter::writeMembers(Ice::OutputStream* os, const DataMemberList& } // -// ObjectReader implementation. +// ValueReader implementation. // -IceRuby::ObjectReader::ObjectReader(VALUE object, const ClassInfoPtr& info) : +IceRuby::ValueReader::ValueReader(VALUE object, const ClassInfoPtr& info) : _object(object), _info(info) { // @@ -2592,13 +2592,13 @@ IceRuby::ObjectReader::ObjectReader(VALUE object, const ClassInfoPtr& info) : rb_gc_register_address(&_object); } -IceRuby::ObjectReader::~ObjectReader() +IceRuby::ValueReader::~ValueReader() { rb_gc_unregister_address(&_object); } void -IceRuby::ObjectReader::ice_postUnmarshal() +IceRuby::ValueReader::ice_postUnmarshal() { ID id = rb_intern("ice_postUnmarshal"); if(callRuby(rb_respond_to, _object, id)) @@ -2608,13 +2608,13 @@ IceRuby::ObjectReader::ice_postUnmarshal() } void -IceRuby::ObjectReader::_iceWrite(Ice::OutputStream*) const +IceRuby::ValueReader::_iceWrite(Ice::OutputStream*) const { assert(false); } void -IceRuby::ObjectReader::_iceRead(Ice::InputStream* is) +IceRuby::ValueReader::_iceRead(Ice::InputStream* is) { is->startValue(); @@ -2682,19 +2682,19 @@ IceRuby::ObjectReader::_iceRead(Ice::InputStream* is) } ClassInfoPtr -IceRuby::ObjectReader::getInfo() const +IceRuby::ValueReader::getInfo() const { return _info; } VALUE -IceRuby::ObjectReader::getObject() const +IceRuby::ValueReader::getObject() const { return _object; } Ice::SlicedDataPtr -IceRuby::ObjectReader::getSlicedData() const +IceRuby::ValueReader::getSlicedData() const { return _slicedData; } @@ -2721,20 +2721,20 @@ IceRuby::InfoMapDestroyer::~InfoMapDestroyer() } // -// ReadObjectCallback implementation. +// ReadValueCallback implementation. // -IceRuby::ReadObjectCallback::ReadObjectCallback(const ClassInfoPtr& info, const UnmarshalCallbackPtr& cb, +IceRuby::ReadValueCallback::ReadValueCallback(const ClassInfoPtr& info, const UnmarshalCallbackPtr& cb, VALUE target, void* closure) : _info(info), _cb(cb), _target(target), _closure(closure) { } void -IceRuby::ReadObjectCallback::invoke(const Ice::ObjectPtr& p) +IceRuby::ReadValueCallback::invoke(const Ice::ValuePtr& p) { if(p) { - ObjectReaderPtr reader = ObjectReaderPtr::dynamicCast(p); + ValueReaderPtr reader = ValueReaderPtr::dynamicCast(p); assert(reader); // diff --git a/ruby/src/IceRuby/Types.h b/ruby/src/IceRuby/Types.h index 415db096e35..8d82d7037f8 100644 --- a/ruby/src/IceRuby/Types.h +++ b/ruby/src/IceRuby/Types.h @@ -35,10 +35,10 @@ class AbortMarshaling { }; -typedef std::map ObjectMap; +typedef std::map ValueMap; -class ObjectReader; -typedef IceUtil::Handle ObjectReaderPtr; +class ValueReader; +typedef IceUtil::Handle ValueReaderPtr; struct PrintObjectHistory { @@ -70,16 +70,16 @@ class UnmarshalCallback : public IceUtil::Shared typedef IceUtil::Handle UnmarshalCallbackPtr; // -// ReadObjectCallback retains all of the information necessary to store an unmarshaled +// ReadValueCallback retains all of the information necessary to store an unmarshaled // Slice value as a Ruby object. // -class ReadObjectCallback : public IceUtil::Shared +class ReadValueCallback : public IceUtil::Shared { public: - ReadObjectCallback(const ClassInfoPtr&, const UnmarshalCallbackPtr&, VALUE, void*); + ReadValueCallback(const ClassInfoPtr&, const UnmarshalCallbackPtr&, VALUE, void*); - void invoke(const ::Ice::ObjectPtr&); + void invoke(const ::Ice::ValuePtr&); private: @@ -88,7 +88,7 @@ class ReadObjectCallback : public IceUtil::Shared VALUE _target; void* _closure; }; -typedef IceUtil::Handle ReadObjectCallbackPtr; +typedef IceUtil::Handle ReadValueCallbackPtr; // // This class assists during unmarshaling of Slice classes and exceptions. @@ -102,14 +102,14 @@ class StreamUtil ~StreamUtil(); // - // Keep a reference to a ReadObjectCallback for patching purposes. + // Keep a reference to a ReadValueCallback for patching purposes. // - void add(const ReadObjectCallbackPtr&); + void add(const ReadValueCallbackPtr&); // // Keep track of object instances that have preserved slices. // - void add(const ObjectReaderPtr&); + void add(const ValueReaderPtr&); // // Updated the sliced data information for all stored object instances. @@ -117,12 +117,12 @@ class StreamUtil void updateSlicedData(); static void setSlicedDataMember(VALUE, const Ice::SlicedDataPtr&); - static Ice::SlicedDataPtr getSlicedDataMember(VALUE, ObjectMap*); + static Ice::SlicedDataPtr getSlicedDataMember(VALUE, ValueMap*); private: - std::vector _callbacks; - std::set _readers; + std::vector _callbacks; + std::set _readers; static VALUE _slicedDataType; static VALUE _sliceInfoType; }; @@ -158,7 +158,7 @@ class TypeInfo : public UnmarshalCallback // The marshal and unmarshal functions can raise Ice exceptions, and may raise // AbortMarshaling if an error occurs. // - virtual void marshal(VALUE, Ice::OutputStream*, ObjectMap*, bool) = 0; + virtual void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool) = 0; virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool) = 0; virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*) = 0; @@ -195,7 +195,7 @@ class PrimitiveInfo : public TypeInfo virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; - virtual void marshal(VALUE, Ice::OutputStream*, ObjectMap*, bool); + virtual void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool); virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); @@ -225,7 +225,7 @@ class EnumInfo : public TypeInfo virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; - virtual void marshal(VALUE, Ice::OutputStream*, ObjectMap*, bool); + virtual void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool); virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); @@ -271,7 +271,7 @@ class StructInfo : public TypeInfo virtual bool usesClasses() const; // Default implementation returns false. - virtual void marshal(VALUE, Ice::OutputStream*, ObjectMap*, bool); + virtual void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool); virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); @@ -309,7 +309,7 @@ class SequenceInfo : public TypeInfo virtual bool usesClasses() const; // Default implementation returns false. - virtual void marshal(VALUE, Ice::OutputStream*, ObjectMap*, bool); + virtual void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool); virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void unmarshaled(VALUE, VALUE, void*); @@ -347,9 +347,9 @@ class DictionaryInfo : public TypeInfo virtual bool usesClasses() const; // Default implementation returns false. - virtual void marshal(VALUE, Ice::OutputStream*, ObjectMap*, bool); + virtual void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool); virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool); - void marshalElement(VALUE, VALUE, Ice::OutputStream*, ObjectMap*); + void marshalElement(VALUE, VALUE, Ice::OutputStream*, ValueMap*); virtual void unmarshaled(VALUE, VALUE, void*); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); @@ -398,7 +398,7 @@ class ClassInfo : public TypeInfo virtual bool usesClasses() const; // Default implementation returns false. - virtual void marshal(VALUE, Ice::OutputStream*, ObjectMap*, bool); + virtual void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool); virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); @@ -442,7 +442,7 @@ class ProxyInfo : public TypeInfo virtual int wireSize() const; virtual Ice::OptionalFormat optionalFormat() const; - virtual void marshal(VALUE, Ice::OutputStream*, ObjectMap*, bool); + virtual void marshal(VALUE, Ice::OutputStream*, ValueMap*, bool); virtual void unmarshal(Ice::InputStream*, const UnmarshalCallbackPtr&, VALUE, void*, bool); virtual void print(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); @@ -481,14 +481,14 @@ class ExceptionInfo : public IceUtil::Shared }; // -// ObjectWriter wraps a Ruby object for marshaling. +// ValueWriter wraps a Ruby object for marshaling. // -class ObjectWriter : public Ice::Object +class ValueWriter : public Ice::Value { public: - ObjectWriter(VALUE, ObjectMap*, const ClassInfoPtr&); - virtual ~ObjectWriter(); + ValueWriter(VALUE, ValueMap*, const ClassInfoPtr&); + virtual ~ValueWriter(); virtual void ice_preMarshal(); @@ -500,20 +500,20 @@ class ObjectWriter : public Ice::Object void writeMembers(Ice::OutputStream*, const DataMemberList&) const; VALUE _object; - ObjectMap* _map; + ValueMap* _map; ClassInfoPtr _info; ClassInfoPtr _formal; }; // -// ObjectReader unmarshals the state of an Ice object. +// ValueReader unmarshals the state of an Ice object. // -class ObjectReader : public Ice::Object +class ValueReader : public Ice::Value { public: - ObjectReader(VALUE, const ClassInfoPtr&); - virtual ~ObjectReader(); + ValueReader(VALUE, const ClassInfoPtr&); + virtual ~ValueReader(); virtual void ice_postUnmarshal(); diff --git a/ruby/src/IceRuby/ValueFactoryManager.cpp b/ruby/src/IceRuby/ValueFactoryManager.cpp index 430ef73db3f..73870065f6d 100644 --- a/ruby/src/IceRuby/ValueFactoryManager.cpp +++ b/ruby/src/IceRuby/ValueFactoryManager.cpp @@ -268,7 +268,7 @@ IceRuby::FactoryWrapper::create(const string& id) return 0; } - return new ObjectReader(obj, info); + return new ValueReader(obj, info); } VALUE @@ -341,7 +341,7 @@ IceRuby::DefaultValueFactory::create(const string& id) // volatile VALUE obj = callRuby(rb_class_new_instance, 0, reinterpret_cast(0), info->rubyClass); assert(!NIL_P(obj)); - return new ObjectReader(obj, info); + return new ValueReader(obj, info); } void diff --git a/swift/Rakefile b/swift/Rakefile index d5fba522847..a7edbc7aea9 100644 --- a/swift/Rakefile +++ b/swift/Rakefile @@ -157,7 +157,7 @@ def create_platform_targets(project, platform, bindist) "AsyncResult.cpp", "AsyncResult.cpp", "DLLMain.cpp", - "GCObject.cpp", + "GCValue.cpp", "ResponseHandler.cpp", "SystemdJournal.cpp", "OpenSSL*",