diff options
author | Benoit Foucher <benoit@zeroc.com> | 2007-03-23 16:37:45 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2007-03-23 16:37:45 +0000 |
commit | dd66c50ce1cd9c8fc45d286d68c059e35073de0d (patch) | |
tree | cabb1fd247cefdf130f221c04d1eb8952ec46672 /cpp/src | |
parent | fix timestamp string (diff) | |
download | ice-dd66c50ce1cd9c8fc45d286d68c059e35073de0d.tar.bz2 ice-dd66c50ce1cd9c8fc45d286d68c059e35073de0d.tar.xz ice-dd66c50ce1cd9c8fc45d286d68c059e35073de0d.zip |
Bug 1873.
Diffstat (limited to 'cpp/src')
52 files changed, 281 insertions, 450 deletions
diff --git a/cpp/src/Ice/Acceptor.cpp b/cpp/src/Ice/Acceptor.cpp index 85cbce8b8dc..b2797a28922 100644 --- a/cpp/src/Ice/Acceptor.cpp +++ b/cpp/src/Ice/Acceptor.cpp @@ -13,5 +13,4 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(Acceptor* p) { p->__incRef(); } -void IceInternal::decRef(Acceptor* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(Acceptor* p) { return p; } diff --git a/cpp/src/Ice/AcceptorF.h b/cpp/src/Ice/AcceptorF.h index 96de1f1451d..83749db2618 100644 --- a/cpp/src/Ice/AcceptorF.h +++ b/cpp/src/Ice/AcceptorF.h @@ -10,14 +10,15 @@ #ifndef ICE_ACCEPTOR_F_H #define ICE_ACCEPTOR_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class Acceptor; -ICE_API void incRef(Acceptor*); -ICE_API void decRef(Acceptor*); +ICE_API IceUtil::Shared* upCast(Acceptor*); typedef Handle<Acceptor> AcceptorPtr; } diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp index aa5d713a623..785d6264508 100644 --- a/cpp/src/Ice/ConnectionFactory.cpp +++ b/cpp/src/Ice/ConnectionFactory.cpp @@ -32,11 +32,8 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(OutgoingConnectionFactory* p) { p->__incRef(); } -void IceInternal::decRef(OutgoingConnectionFactory* p) { p->__decRef(); } - -void IceInternal::incRef(IncomingConnectionFactory* p) { p->__incRef(); } -void IceInternal::decRef(IncomingConnectionFactory* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(OutgoingConnectionFactory* p) { return p; } +IceUtil::Shared* IceInternal::upCast(IncomingConnectionFactory* p) { return p; } void IceInternal::OutgoingConnectionFactory::destroy() diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index bb3052b86e1..6cf36a3435a 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -31,8 +31,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(ConnectionI* p) { p->__incRef(); } -void IceInternal::decRef(ConnectionI* p) { p->__decRef(); } +Ice::LocalObject* IceInternal::upCast(ConnectionI* p) { return p; } void Ice::ConnectionI::validate() diff --git a/cpp/src/Ice/ConnectionMonitor.cpp b/cpp/src/Ice/ConnectionMonitor.cpp index 3c9eee7845a..1be8a4f374e 100644 --- a/cpp/src/Ice/ConnectionMonitor.cpp +++ b/cpp/src/Ice/ConnectionMonitor.cpp @@ -17,8 +17,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(ConnectionMonitor* p) { p->__incRef(); } -void IceInternal::decRef(ConnectionMonitor* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(ConnectionMonitor* p) { return p; } void IceInternal::ConnectionMonitor::destroy() diff --git a/cpp/src/Ice/Connector.cpp b/cpp/src/Ice/Connector.cpp index 001c93f59b6..710ceed5658 100644 --- a/cpp/src/Ice/Connector.cpp +++ b/cpp/src/Ice/Connector.cpp @@ -13,5 +13,4 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(Connector* p) { p->__incRef(); } -void IceInternal::decRef(Connector* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(Connector* p) { return p; } diff --git a/cpp/src/Ice/ConnectorF.h b/cpp/src/Ice/ConnectorF.h index 0a6257aed35..4b166bdd140 100644 --- a/cpp/src/Ice/ConnectorF.h +++ b/cpp/src/Ice/ConnectorF.h @@ -10,14 +10,15 @@ #ifndef ICE_CONNECTOR_F_H #define ICE_CONNECTOR_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class Connector; -ICE_API void incRef(Connector*); -ICE_API void decRef(Connector*); +ICE_API IceUtil::Shared* upCast(Connector*); typedef Handle<Connector> ConnectorPtr; } diff --git a/cpp/src/Ice/DefaultsAndOverrides.cpp b/cpp/src/Ice/DefaultsAndOverrides.cpp index 64bcd99b63b..bf5d69d85f8 100644 --- a/cpp/src/Ice/DefaultsAndOverrides.cpp +++ b/cpp/src/Ice/DefaultsAndOverrides.cpp @@ -16,8 +16,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(DefaultsAndOverrides* p) { p->__incRef(); } -void IceInternal::decRef(DefaultsAndOverrides* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(DefaultsAndOverrides* p) { return p; } IceInternal::DefaultsAndOverrides::DefaultsAndOverrides(const PropertiesPtr& properties) : overrideTimeout(false), diff --git a/cpp/src/Ice/DefaultsAndOverridesF.h b/cpp/src/Ice/DefaultsAndOverridesF.h index 65249638a8a..6d70ca302f9 100644 --- a/cpp/src/Ice/DefaultsAndOverridesF.h +++ b/cpp/src/Ice/DefaultsAndOverridesF.h @@ -10,14 +10,15 @@ #ifndef ICE_DEFAULTS_AND_OVERRIDES_F_H #define ICE_DEFAULTS_AND_OVERRIDES_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class DefaultsAndOverrides; -void incRef(DefaultsAndOverrides*); -void decRef(DefaultsAndOverrides*); +IceUtil::Shared* upCast(DefaultsAndOverrides*); typedef Handle<DefaultsAndOverrides> DefaultsAndOverridesPtr; } diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp index 769b0368b19..b883ed5f615 100644 --- a/cpp/src/Ice/DynamicLibrary.cpp +++ b/cpp/src/Ice/DynamicLibrary.cpp @@ -17,11 +17,8 @@ using namespace Ice; using namespace IceInternal; using namespace std; -void IceInternal::incRef(DynamicLibrary* p) { p->__incRef(); } -void IceInternal::decRef(DynamicLibrary* p) { p->__decRef(); } - -void IceInternal::incRef(DynamicLibraryList* p) { p->__incRef(); } -void IceInternal::decRef(DynamicLibraryList* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(DynamicLibrary* p) { return p; } +IceUtil::Shared* IceInternal::upCast(DynamicLibraryList* p) { return p; } IceInternal::DynamicLibrary::DynamicLibrary() : _hnd(0) diff --git a/cpp/src/Ice/EndpointFactory.cpp b/cpp/src/Ice/EndpointFactory.cpp index e61734c8b4d..d635d4f5745 100644 --- a/cpp/src/Ice/EndpointFactory.cpp +++ b/cpp/src/Ice/EndpointFactory.cpp @@ -13,8 +13,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(EndpointFactory* p) { p->__incRef(); } -void IceInternal::decRef(EndpointFactory* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(EndpointFactory* p) { return p; } IceInternal::EndpointFactory::EndpointFactory() { diff --git a/cpp/src/Ice/EndpointFactoryManager.cpp b/cpp/src/Ice/EndpointFactoryManager.cpp index 25db4169e20..27c334d0712 100644 --- a/cpp/src/Ice/EndpointFactoryManager.cpp +++ b/cpp/src/Ice/EndpointFactoryManager.cpp @@ -20,8 +20,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(EndpointFactoryManager* p) { p->__incRef(); } -void IceInternal::decRef(EndpointFactoryManager* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(EndpointFactoryManager* p) { return p; } IceInternal::EndpointFactoryManager::EndpointFactoryManager(const InstancePtr& instance) : _instance(instance) diff --git a/cpp/src/Ice/EndpointFactoryManagerF.h b/cpp/src/Ice/EndpointFactoryManagerF.h index 28be62a782f..948abfec79b 100644 --- a/cpp/src/Ice/EndpointFactoryManagerF.h +++ b/cpp/src/Ice/EndpointFactoryManagerF.h @@ -10,14 +10,15 @@ #ifndef ICE_ENDPOINT_FACTORY_MANAGER_F_H #define ICE_ENDPOINT_FACTORY_MANAGER_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class EndpointFactoryManager; -void incRef(EndpointFactoryManager*); -void decRef(EndpointFactoryManager*); +IceUtil::Shared* upCast(EndpointFactoryManager*); typedef Handle<EndpointFactoryManager> EndpointFactoryManagerPtr; } diff --git a/cpp/src/Ice/EndpointI.cpp b/cpp/src/Ice/EndpointI.cpp index 7464d23c2bb..45f88a6cde8 100644 --- a/cpp/src/Ice/EndpointI.cpp +++ b/cpp/src/Ice/EndpointI.cpp @@ -11,5 +11,4 @@ using namespace Ice; -void IceInternal::incRef(EndpointI* p) { p->__incRef(); } -void IceInternal::decRef(EndpointI* p) { p->__decRef(); } +Ice::LocalObject* IceInternal::upCast(EndpointI* p) { return p; } diff --git a/cpp/src/Ice/EventHandler.cpp b/cpp/src/Ice/EventHandler.cpp index 989935c9626..6a92e51788d 100644 --- a/cpp/src/Ice/EventHandler.cpp +++ b/cpp/src/Ice/EventHandler.cpp @@ -14,8 +14,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(EventHandler* p) { p->__incRef(); } -void IceInternal::decRef(EventHandler* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(EventHandler* p) { return p; } InstancePtr IceInternal::EventHandler::instance() const diff --git a/cpp/src/Ice/EventHandlerF.h b/cpp/src/Ice/EventHandlerF.h index 9462870bc5f..576fbaac575 100644 --- a/cpp/src/Ice/EventHandlerF.h +++ b/cpp/src/Ice/EventHandlerF.h @@ -10,14 +10,15 @@ #ifndef ICE_EVENT_HANDLER_F_H #define ICE_EVENT_HANDLER_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class EventHandler; -void incRef(EventHandler*); -void decRef(EventHandler*); +IceUtil::Shared* upCast(EventHandler*); typedef Handle<EventHandler> EventHandlerPtr; } diff --git a/cpp/src/Ice/ImplicitContextI.cpp b/cpp/src/Ice/ImplicitContextI.cpp index 1a398c269d4..cbdf69c2982 100644 --- a/cpp/src/Ice/ImplicitContextI.cpp +++ b/cpp/src/Ice/ImplicitContextI.cpp @@ -214,19 +214,19 @@ SharedImplicitContext::write(const Context& proxyCtx, ::IceInternal::BasicStream IceUtil::Mutex::Lock lock(_mutex); if(proxyCtx.size() == 0) { - __write(s, _context, __U__Context()); + __writeContext(s, _context); } else if(_context.size() == 0) { lock.release(); - __write(s, proxyCtx, __U__Context()); + __writeContext(s, proxyCtx); } else { Context combined = proxyCtx; combined.insert(_context.begin(), _context.end()); lock.release(); - __write(s, combined, __U__Context()); + __writeContext(s, combined); } } @@ -572,17 +572,17 @@ PerThreadImplicitContext::write(const Context& proxyCtx, ::IceInternal::BasicStr if(threadCtx == 0 || threadCtx->size() == 0) { - __write(s, proxyCtx, __U__Context()); + __writeContext(s, proxyCtx); } else if(proxyCtx.size() == 0) { - __write(s, *threadCtx, __U__Context()); + __writeContext(s, *threadCtx); } else { Context combined = proxyCtx; combined.insert(threadCtx->begin(), threadCtx->end()); - __write(s, combined, __U__Context()); + __writeContext(s, combined); } } diff --git a/cpp/src/Ice/IncomingAsync.cpp b/cpp/src/Ice/IncomingAsync.cpp index b7c60f8592d..0d9b31ca944 100644 --- a/cpp/src/Ice/IncomingAsync.cpp +++ b/cpp/src/Ice/IncomingAsync.cpp @@ -20,14 +20,9 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(IncomingAsync* p) { p->__incRef(); } -void IceInternal::decRef(IncomingAsync* p) { p->__decRef(); } - -void IceInternal::incRef(AMD_Object_ice_invoke* p) { p->__incRef(); } -void IceInternal::decRef(AMD_Object_ice_invoke* p) { p->__decRef(); } - -void IceInternal::incRef(AMD_Array_Object_ice_invoke* p) { p->__incRef(); } -void IceInternal::decRef(AMD_Array_Object_ice_invoke* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IncomingAsync* p) { return p; } +IceUtil::Shared* IceInternal::upCast(AMD_Object_ice_invoke* p) { return p; } +IceUtil::Shared* IceInternal::upCast(AMD_Array_Object_ice_invoke* p) { return p; } IceInternal::IncomingAsync::IncomingAsync(Incoming& in) : IncomingBase(in), diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index e1a80364782..81dfa2fc9bc 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -67,8 +67,7 @@ extern bool ICE_UTIL_API nullHandleAbort; } -void IceInternal::incRef(Instance* p) { p->__incRef(); } -void IceInternal::decRef(Instance* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(Instance* p) { return p; } bool IceInternal::Instance::destroyed() const diff --git a/cpp/src/Ice/LocalObject.cpp b/cpp/src/Ice/LocalObject.cpp index eb76d987560..bbe4ee63899 100644 --- a/cpp/src/Ice/LocalObject.cpp +++ b/cpp/src/Ice/LocalObject.cpp @@ -13,8 +13,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(LocalObject* p) { p->__incRef(); } -void IceInternal::decRef(LocalObject* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(LocalObject* obj) { return obj; } bool Ice::LocalObject::operator==(const LocalObject& r) const diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp index 15e27d67d03..b7a99ba1cb4 100644 --- a/cpp/src/Ice/LocatorInfo.cpp +++ b/cpp/src/Ice/LocatorInfo.cpp @@ -22,14 +22,9 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(LocatorManager* p) { p->__incRef(); } -void IceInternal::decRef(LocatorManager* p) { p->__decRef(); } - -void IceInternal::incRef(LocatorInfo* p) { p->__incRef(); } -void IceInternal::decRef(LocatorInfo* p) { p->__decRef(); } - -void IceInternal::incRef(LocatorTable* p) { p->__incRef(); } -void IceInternal::decRef(LocatorTable* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(LocatorManager* p) { return p; } +IceUtil::Shared* IceInternal::upCast(LocatorInfo* p) { return p; } +IceUtil::Shared* IceInternal::upCast(LocatorTable* p) { return p; } IceInternal::LocatorManager::LocatorManager() : _tableHint(_table.end()) diff --git a/cpp/src/Ice/LocatorInfoF.h b/cpp/src/Ice/LocatorInfoF.h index 577cc8111d0..4b8e1b4b90c 100644 --- a/cpp/src/Ice/LocatorInfoF.h +++ b/cpp/src/Ice/LocatorInfoF.h @@ -10,24 +10,23 @@ #ifndef ICE_LOCATOR_INFO_F_H #define ICE_LOCATOR_INFO_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class LocatorManager; -void incRef(LocatorManager*); -void decRef(LocatorManager*); +IceUtil::Shared* upCast(LocatorManager*); typedef Handle<LocatorManager> LocatorManagerPtr; class LocatorInfo; -void incRef(LocatorInfo*); -void decRef(LocatorInfo*); +IceUtil::Shared* upCast(LocatorInfo*); typedef Handle<LocatorInfo> LocatorInfoPtr; class LocatorTable; -void incRef(LocatorTable*); -void decRef(LocatorTable*); +IceUtil::Shared* upCast(LocatorTable*); typedef Handle<LocatorTable> LocatorTablePtr; } diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 34e00c0cae8..fc789ea83ab 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -17,8 +17,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(Object* p) { p->__incRef(); } -void IceInternal::decRef(Object* p) { p->__decRef(); } +IceInternal::GCShared* IceInternal::upCast(Object* p) { return p; } bool Ice::Object::operator==(const Object& r) const diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp index 334be027f82..73fe10723b6 100644 --- a/cpp/src/Ice/ObjectAdapterFactory.cpp +++ b/cpp/src/Ice/ObjectAdapterFactory.cpp @@ -17,8 +17,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(ObjectAdapterFactory* p) { p->__incRef(); } -void IceInternal::decRef(ObjectAdapterFactory* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(ObjectAdapterFactory* p) { return p; } void IceInternal::ObjectAdapterFactory::shutdown() diff --git a/cpp/src/Ice/ObjectFactoryManager.cpp b/cpp/src/Ice/ObjectFactoryManager.cpp index 5ed3f2a7d38..0021d998c8e 100644 --- a/cpp/src/Ice/ObjectFactoryManager.cpp +++ b/cpp/src/Ice/ObjectFactoryManager.cpp @@ -17,8 +17,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(ObjectFactoryManager* p) { p->__incRef(); } -void IceInternal::decRef(ObjectFactoryManager* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(ObjectFactoryManager* p) { return p; } void IceInternal::ObjectFactoryManager::add(const ObjectFactoryPtr& factory, const string& id) diff --git a/cpp/src/Ice/ObjectFactoryManagerF.h b/cpp/src/Ice/ObjectFactoryManagerF.h index aef4e43a9dd..d0859cd6a93 100644 --- a/cpp/src/Ice/ObjectFactoryManagerF.h +++ b/cpp/src/Ice/ObjectFactoryManagerF.h @@ -10,14 +10,15 @@ #ifndef ICE_SERVANT_FACTORY_MANAGER_F_H #define ICE_SERVANT_FACTORY_MANAGER_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class ObjectFactoryManager; -void incRef(ObjectFactoryManager*); -void decRef(ObjectFactoryManager*); +IceUtil::Shared* upCast(ObjectFactoryManager*); typedef Handle<ObjectFactoryManager> ObjectFactoryManagerPtr; } diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index 33a6fc3931a..0d1e125ec8d 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -98,7 +98,7 @@ IceInternal::Outgoing::Outgoing(ConnectionI* connection, Reference* ref, const s // // Explicit context // - __write(&_os, *context, __U__Context()); + __writeContext(&_os, *context); } else { @@ -112,7 +112,7 @@ IceInternal::Outgoing::Outgoing(ConnectionI* connection, Reference* ref, const s if(implicitContext == 0) { - __write(&_os, prxContext, __U__Context()); + __writeContext(&_os, prxContext); } else { diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp index ad53705d9e9..065ebe7c334 100644 --- a/cpp/src/Ice/OutgoingAsync.cpp +++ b/cpp/src/Ice/OutgoingAsync.cpp @@ -26,14 +26,9 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(OutgoingAsync* p) { p->__incRef(); } -void IceInternal::decRef(OutgoingAsync* p) { p->__decRef(); } - -void IceInternal::incRef(AMI_Object_ice_invoke* p) { p->__incRef(); } -void IceInternal::decRef(AMI_Object_ice_invoke* p) { p->__decRef(); } - -void IceInternal::incRef(AMI_Array_Object_ice_invoke* p) { p->__incRef(); } -void IceInternal::decRef(AMI_Array_Object_ice_invoke* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(OutgoingAsync* p) { return p; } +IceUtil::Shared* IceInternal::upCast(AMI_Object_ice_invoke* p) { return p; } +IceUtil::Shared* IceInternal::upCast(AMI_Array_Object_ice_invoke* p) { return p; } IceInternal::OutgoingAsync::OutgoingAsync() : __is(0), @@ -315,7 +310,7 @@ IceInternal::OutgoingAsync::__prepare(const ObjectPrx& prx, const string& operat // // Explicit context // - __write(__os, *context, __U__Context()); + __writeContext(__os, *context); } else { @@ -329,7 +324,7 @@ IceInternal::OutgoingAsync::__prepare(const ObjectPrx& prx, const string& operat if(implicitContext == 0) { - __write(__os, prxContext, __U__Context()); + __writeContext(__os, prxContext); } else { diff --git a/cpp/src/Ice/ProtocolPluginFacade.cpp b/cpp/src/Ice/ProtocolPluginFacade.cpp index 2d2a0bd9828..f8ff17e63e9 100644 --- a/cpp/src/Ice/ProtocolPluginFacade.cpp +++ b/cpp/src/Ice/ProtocolPluginFacade.cpp @@ -18,8 +18,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(ProtocolPluginFacade* p) { p->__incRef(); } -void IceInternal::decRef(ProtocolPluginFacade* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(ProtocolPluginFacade* p) { return p; } ProtocolPluginFacadePtr IceInternal::getProtocolPluginFacade(const CommunicatorPtr& communicator) diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index 2ad7d17e5da..d171d223ea8 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -30,18 +30,10 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(::IceProxy::Ice::Object* p) { p->__incRef(); } -void IceInternal::decRef(::IceProxy::Ice::Object* p) { p->__decRef(); } - -void IceInternal::incRef(::IceDelegate::Ice::Object* p) { p->__incRef(); } -void IceInternal::decRef(::IceDelegate::Ice::Object* p) { p->__decRef(); } - -void IceInternal::incRef(::IceDelegateM::Ice::Object* p) { p->__incRef(); } -void IceInternal::decRef(::IceDelegateM::Ice::Object* p) { p->__decRef(); } - -void IceInternal::incRef(::IceDelegateD::Ice::Object* p) { p->__incRef(); } -void IceInternal::decRef(::IceDelegateD::Ice::Object* p) { p->__decRef(); } - +IceUtil::Shared* IceInternal::upCast(::IceProxy::Ice::Object* p) { return p; } +IceUtil::Shared* IceInternal::upCast(::IceDelegate::Ice::Object* p) { return p; } +IceUtil::Shared* IceInternal::upCast(::IceDelegateM::Ice::Object* p) { return p; } +IceUtil::Shared* IceInternal::upCast(::IceDelegateD::Ice::Object* p) { return p; } ::Ice::ObjectPrx IceInternal::checkedCastImpl(const ObjectPrx& b, const string& f, const string& typeId, const Context* context) diff --git a/cpp/src/Ice/ProxyFactory.cpp b/cpp/src/Ice/ProxyFactory.cpp index 338cd0a62fb..4244066079d 100644 --- a/cpp/src/Ice/ProxyFactory.cpp +++ b/cpp/src/Ice/ProxyFactory.cpp @@ -24,8 +24,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(ProxyFactory* p) { p->__incRef(); } -void IceInternal::decRef(ProxyFactory* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(ProxyFactory* p) { return p; } ObjectPrx IceInternal::ProxyFactory::stringToProxy(const string& str) const diff --git a/cpp/src/Ice/Reference.cpp b/cpp/src/Ice/Reference.cpp index 2dfe49d0e55..d70dda6d9db 100644 --- a/cpp/src/Ice/Reference.cpp +++ b/cpp/src/Ice/Reference.cpp @@ -32,8 +32,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(IceInternal::Reference* p) { p->__incRef(); } -void IceInternal::decRef(IceInternal::Reference* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IceInternal::Reference* p) { return p; } namespace { @@ -421,8 +420,7 @@ IceInternal::Reference::Reference(const Reference& r) : { } -void IceInternal::incRef(IceInternal::FixedReference* p) { p->__incRef(); } -void IceInternal::decRef(IceInternal::FixedReference* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IceInternal::FixedReference* p) { return p; } IceInternal::FixedReference::FixedReference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident, const SharedContextPtr& ctx, const string& fs, Mode md, @@ -749,8 +747,7 @@ IceInternal::FixedReference::filterConnections(const vector<ConnectionIPtr>& all return connections; } -void IceInternal::incRef(IceInternal::RoutableReference* p) { p->__incRef(); } -void IceInternal::decRef(IceInternal::RoutableReference* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IceInternal::RoutableReference* p) { return p; } vector<EndpointIPtr> IceInternal::RoutableReference::getRoutedEndpoints() const @@ -1303,8 +1300,7 @@ IceInternal::RoutableReference::applyOverrides(vector<EndpointIPtr>& endpoints) } } -void IceInternal::incRef(IceInternal::DirectReference* p) { p->__incRef(); } -void IceInternal::decRef(IceInternal::DirectReference* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IceInternal::DirectReference* p) { return p; } IceInternal::DirectReference::DirectReference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident, const SharedContextPtr& ctx, const string& fs, @@ -1558,8 +1554,7 @@ IceInternal::DirectReference::DirectReference(const DirectReference& r) : { } -void IceInternal::incRef(IceInternal::IndirectReference* p) { p->__incRef(); } -void IceInternal::decRef(IceInternal::IndirectReference* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IceInternal::IndirectReference* p) { return p; } IceInternal::IndirectReference::IndirectReference(const InstancePtr& inst, const CommunicatorPtr& com, const Identity& ident, const SharedContextPtr& ctx, const string& fs, diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp index 646d9bf0196..b1eae949612 100644 --- a/cpp/src/Ice/ReferenceFactory.cpp +++ b/cpp/src/Ice/ReferenceFactory.cpp @@ -29,8 +29,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(::IceInternal::ReferenceFactory* p) { p->__incRef(); } -void IceInternal::decRef(::IceInternal::ReferenceFactory* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(::IceInternal::ReferenceFactory* p) { return p; } ReferencePtr IceInternal::ReferenceFactory::copy(const Reference* r) const diff --git a/cpp/src/Ice/ReferenceFactoryF.h b/cpp/src/Ice/ReferenceFactoryF.h index cc78ffa53f0..f8f60c2c01e 100644 --- a/cpp/src/Ice/ReferenceFactoryF.h +++ b/cpp/src/Ice/ReferenceFactoryF.h @@ -16,8 +16,7 @@ namespace IceInternal { class ReferenceFactory; -void incRef(ReferenceFactory*); -void decRef(ReferenceFactory*); +IceUtil::Shared* upCast(ReferenceFactory*); typedef Handle<ReferenceFactory> ReferenceFactoryPtr; } diff --git a/cpp/src/Ice/RouterInfo.cpp b/cpp/src/Ice/RouterInfo.cpp index 8eb60be1bdd..fd2e9ea5300 100644 --- a/cpp/src/Ice/RouterInfo.cpp +++ b/cpp/src/Ice/RouterInfo.cpp @@ -18,11 +18,8 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(RouterManager* p) { p->__incRef(); } -void IceInternal::decRef(RouterManager* p) { p->__decRef(); } - -void IceInternal::incRef(RouterInfo* p) { p->__incRef(); } -void IceInternal::decRef(RouterInfo* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(RouterManager* p) { return p; } +IceUtil::Shared* IceInternal::upCast(RouterInfo* p) { return p; } IceInternal::RouterManager::RouterManager() : _tableHint(_table.end()) diff --git a/cpp/src/Ice/RouterInfoF.h b/cpp/src/Ice/RouterInfoF.h index 6fa9e8d86df..1404a50e09c 100644 --- a/cpp/src/Ice/RouterInfoF.h +++ b/cpp/src/Ice/RouterInfoF.h @@ -10,19 +10,19 @@ #ifndef ICE_ROUTER_INFO_F_H #define ICE_ROUTER_INFO_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class RouterManager; -void incRef(RouterManager*); -void decRef(RouterManager*); +IceUtil::Shared* upCast(RouterManager*); typedef Handle<RouterManager> RouterManagerPtr; class RouterInfo; -void incRef(RouterInfo*); -void decRef(RouterInfo*); +IceUtil::Shared* upCast(RouterInfo*); typedef Handle<RouterInfo> RouterInfoPtr; } diff --git a/cpp/src/Ice/ServantManager.cpp b/cpp/src/Ice/ServantManager.cpp index 0a9a6d010ce..c135832880a 100644 --- a/cpp/src/Ice/ServantManager.cpp +++ b/cpp/src/Ice/ServantManager.cpp @@ -18,11 +18,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(ServantManager* p) { p->__incRef(); } -#ifdef __BCPLUSPLUS__ -ICE_API -#endif -void IceInternal::decRef(ServantManager* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(ServantManager* p) { return p; } void IceInternal::ServantManager::addServant(const ObjectPtr& object, const Identity& ident, const string& facet) diff --git a/cpp/src/Ice/Stream.cpp b/cpp/src/Ice/Stream.cpp index 70325bb21e0..1b8c4da4e31 100644 --- a/cpp/src/Ice/Stream.cpp +++ b/cpp/src/Ice/Stream.cpp @@ -13,10 +13,8 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(InputStream* p) { p->__incRef(); } -void IceInternal::decRef(InputStream* p) { p->__decRef(); } -void IceInternal::incRef(OutputStream* p) { p->__incRef(); } -void IceInternal::decRef(OutputStream* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(InputStream* p) { return p; } +IceUtil::Shared* IceInternal::upCast(OutputStream* p) { return p; } Ice::ReadObjectCallbackI::ReadObjectCallbackI(PatchFunc func, void* arg) : _func(func), _arg(arg) diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 64460db7284..59d479ce841 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -23,11 +23,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(ThreadPool* p) { p->__incRef(); } -#ifdef __BCPLUSPLUS__ -ICE_API -#endif -void IceInternal::decRef(ThreadPool* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(ThreadPool* p) { return p; } IceInternal::ThreadPool::ThreadPool(const InstancePtr& instance, const string& prefix, int timeout) : _instance(instance), diff --git a/cpp/src/Ice/ThreadPoolF.h b/cpp/src/Ice/ThreadPoolF.h index e2f368042f5..5b468c35c61 100644 --- a/cpp/src/Ice/ThreadPoolF.h +++ b/cpp/src/Ice/ThreadPoolF.h @@ -10,14 +10,15 @@ #ifndef ICE_THREAD_POOL_F_H #define ICE_THREAD_POOL_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class ThreadPool; -void incRef(ThreadPool*); -void decRef(ThreadPool*); +IceUtil::Shared* upCast(ThreadPool*); typedef Handle<ThreadPool> ThreadPoolPtr; } diff --git a/cpp/src/Ice/TraceLevels.cpp b/cpp/src/Ice/TraceLevels.cpp index 7d60689562e..7886f34105a 100644 --- a/cpp/src/Ice/TraceLevels.cpp +++ b/cpp/src/Ice/TraceLevels.cpp @@ -14,11 +14,7 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(TraceLevels* p) { p->__incRef(); } -#ifdef __BCPLUSPLUS__ -ICE_API -#endif -void IceInternal::decRef(TraceLevels* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(TraceLevels* p) { return p; } IceInternal::TraceLevels::TraceLevels(const PropertiesPtr& properties) : network(0), diff --git a/cpp/src/Ice/TraceLevelsF.h b/cpp/src/Ice/TraceLevelsF.h index b1ef7c24dfe..113d8da12e5 100644 --- a/cpp/src/Ice/TraceLevelsF.h +++ b/cpp/src/Ice/TraceLevelsF.h @@ -10,14 +10,15 @@ #ifndef ICE_TRACE_LEVELS_F_H #define ICE_TRACE_LEVELS_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class TraceLevels; -void incRef(TraceLevels*); -void decRef(TraceLevels*); +IceUtil::Shared* upCast(TraceLevels*); typedef Handle<TraceLevels> TraceLevelsPtr; } diff --git a/cpp/src/Ice/Transceiver.cpp b/cpp/src/Ice/Transceiver.cpp index 60a6cc5f4d6..2137a88e1f1 100644 --- a/cpp/src/Ice/Transceiver.cpp +++ b/cpp/src/Ice/Transceiver.cpp @@ -13,5 +13,4 @@ using namespace std; using namespace Ice; using namespace IceInternal; -void IceInternal::incRef(Transceiver* p) { p->__incRef(); } -void IceInternal::decRef(Transceiver* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(Transceiver* p) { return p; } diff --git a/cpp/src/Ice/TransceiverF.h b/cpp/src/Ice/TransceiverF.h index 07a0c4b49c1..bda377b684c 100644 --- a/cpp/src/Ice/TransceiverF.h +++ b/cpp/src/Ice/TransceiverF.h @@ -10,14 +10,15 @@ #ifndef ICE_TRANSCEIVER_F_H #define ICE_TRANSCEIVER_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceInternal { class Transceiver; -ICE_API void incRef(Transceiver*); -ICE_API void decRef(Transceiver*); +ICE_API IceUtil::Shared* upCast(Transceiver*); typedef Handle<Transceiver> TransceiverPtr; } diff --git a/cpp/src/IceSSL/Instance.cpp b/cpp/src/IceSSL/Instance.cpp index 112e013cb2d..a840d019d8e 100644 --- a/cpp/src/IceSSL/Instance.cpp +++ b/cpp/src/IceSSL/Instance.cpp @@ -27,8 +27,7 @@ using namespace std; using namespace Ice; using namespace IceSSL; -void IceInternal::incRef(IceSSL::Instance* p) { p->__incRef(); } -void IceInternal::decRef(IceSSL::Instance* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IceSSL::Instance* p) { return p; } extern "C" { diff --git a/cpp/src/IceSSL/InstanceF.h b/cpp/src/IceSSL/InstanceF.h index 7b20ce51018..2bb7285dbb7 100644 --- a/cpp/src/IceSSL/InstanceF.h +++ b/cpp/src/IceSSL/InstanceF.h @@ -10,6 +10,8 @@ #ifndef ICE_SSL_INSTANCE_F_H #define ICE_SSL_INSTANCE_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceSSL @@ -22,8 +24,7 @@ class Instance; namespace IceInternal { -void incRef(IceSSL::Instance*); -void decRef(IceSSL::Instance*); +IceUtil::Shared* upCast(IceSSL::Instance*); } diff --git a/cpp/src/IceSSL/TrustManager.cpp b/cpp/src/IceSSL/TrustManager.cpp index 5e620615fe9..a8b2ba0d3dc 100644 --- a/cpp/src/IceSSL/TrustManager.cpp +++ b/cpp/src/IceSSL/TrustManager.cpp @@ -20,8 +20,7 @@ using namespace std; using namespace IceSSL; -void IceInternal::incRef(IceSSL::TrustManager* p) { p->__incRef(); } -void IceInternal::decRef(IceSSL::TrustManager* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IceSSL::TrustManager* p) { return p; } TrustManager::TrustManager(const Ice::CommunicatorPtr& communicator) : _communicator(communicator) diff --git a/cpp/src/IceSSL/TrustManagerF.h b/cpp/src/IceSSL/TrustManagerF.h index 2f8159797f4..839c28533dd 100644 --- a/cpp/src/IceSSL/TrustManagerF.h +++ b/cpp/src/IceSSL/TrustManagerF.h @@ -10,6 +10,8 @@ #ifndef ICE_SSL_TRUST_MANAGER_F_H #define ICE_SSL_TRUST_MANAGER_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> namespace IceSSL @@ -22,8 +24,7 @@ class TrustManager; namespace IceInternal { -void incRef(IceSSL::TrustManager*); -void decRef(IceSSL::TrustManager*); +IceUtil::Shared* upCast(IceSSL::TrustManager*); } diff --git a/cpp/src/IceSSL/Util.cpp b/cpp/src/IceSSL/Util.cpp index 9adf539fac3..d6eb161454f 100644 --- a/cpp/src/IceSSL/Util.cpp +++ b/cpp/src/IceSSL/Util.cpp @@ -171,8 +171,7 @@ convertDH(unsigned char* p, int plen, unsigned char* g, int glen) return dh; } -void IceInternal::incRef(IceSSL::DHParams* p) { p->__incRef(); } -void IceInternal::decRef(IceSSL::DHParams* p) { p->__decRef(); } +IceUtil::Shared* IceInternal::upCast(IceSSL::DHParams* p) { return p; } IceSSL::DHParams::DHParams() : _dh512(0), _dh1024(0), _dh2048(0), _dh4096(0) diff --git a/cpp/src/IceSSL/UtilF.h b/cpp/src/IceSSL/UtilF.h index f606b3007ab..c344d21f64b 100644 --- a/cpp/src/IceSSL/UtilF.h +++ b/cpp/src/IceSSL/UtilF.h @@ -10,6 +10,8 @@ #ifndef ICE_SSL_UTIL_F_H #define ICE_SSL_UTIL_F_H +#include <IceUtil/Shared.h> + #include <Ice/Handle.h> #include <openssl/ssl.h> @@ -25,8 +27,7 @@ class DHParams; namespace IceInternal { -void incRef(IceSSL::DHParams*); -void decRef(IceSSL::DHParams*); +IceUtil::Shared* upCast(IceSSL::DHParams*); } diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp index 0bbd0750002..ece0f582523 100644 --- a/cpp/src/Slice/CPlusPlusUtil.cpp +++ b/cpp/src/Slice/CPlusPlusUtil.cpp @@ -635,7 +635,7 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& string scope = fixKwd(cl->scope()); if(marshal) { - out << nl << scope << "__write(" << (pointer ? "" : "&") << stream << ", " << fixedParam << ");"; + out << nl << stream << deref << "write(::Ice::ObjectPtr(::IceInternal::upCast(" << fixedParam << ".get())));"; } else { @@ -645,6 +645,21 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& return; } + + ProxyPtr px = ProxyPtr::dynamicCast(type); + if(px) + { + string scope = fixKwd(px->_class()->scope()); + if(marshal) + { + out << nl << stream << deref << "write(::Ice::ObjectPrx(::IceInternal::upCast(" << fixedParam << ".get())));"; + } + else + { + out << nl << scope << "__read(" << (pointer ? "" : "&") << stream << ", " << fixedParam << ");"; + } + return; + } StructPtr st = StructPtr::dynamicCast(type); if(st) @@ -670,6 +685,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& { string seqType = findMetaData(metaData, inParam); builtin = BuiltinPtr::dynamicCast(seq->type()); + string funcSeq = (marshal ? "write" : "read") + fixKwd(seq->name()) + "("; + if(marshal) { string scope = fixKwd(seq->scope()); @@ -689,9 +706,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& seqType = findMetaData(l, false); if(seqType.empty()) { - out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " - << fixedParam << ".first, " << fixedParam << ".second, " << scope - << "__U__" << fixKwd(seq->name()) << "());"; + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " + << fixedParam << ".first, " << fixedParam << ".second);"; } else { @@ -759,8 +775,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& seqType = findMetaData(l, false); if(!seqType.empty()) { - out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " << fixedParam << ", " - << scope << "__U__" << fixKwd(seq->name()) << "());"; + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " << fixedParam + << ");"; } else if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy) @@ -771,9 +787,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& out << eb; out << nl << "else"; out << sb; - out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", &" - << fixedParam << "[0], &" << fixedParam << "[0] + " << fixedParam << ".size(), " << scope - << "__U__" << fixKwd(seq->name()) << "());"; + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", &" + << fixedParam << "[0], &" << fixedParam << "[0] + " << fixedParam << ".size());"; out << eb; } else if(builtin->kind() == Builtin::KindBool) @@ -809,8 +824,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& if(seqType.empty()) { out << nl << typeToString(type, false) << " ___" << fixedParam << ";"; - out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", ___" - << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", ___" + << fixedParam << ");"; } else { @@ -914,8 +929,8 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& if(!seqType.empty() || !builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy) { - out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " - << fixedParam << ", " << scope << "__U__" << fixKwd(seq->name()) << "());"; + out << nl << scope << "__" << funcSeq << (pointer ? "" : "&") << stream << ", " + << fixedParam << ");"; } else if(builtin->kind() == Builtin::KindByte) { @@ -961,18 +976,13 @@ Slice::writeMarshalUnmarshalCode(Output& out, const TypePtr& type, const string& if(dict) { string scope = fixKwd(dict->scope()); - out << nl << scope << "__" << func << (pointer ? "" : "&") << stream << ", " - << fixedParam << ", " << scope << "__U__" << fixKwd(dict->name()) << "());"; + string funcDict = (marshal ? "write" : "read") + fixKwd(dict->name()) + "("; + out << nl << scope << "__" << funcDict << (pointer ? "" : "&") << stream << ", " << fixedParam << ");"; return; } ConstructedPtr constructed = ConstructedPtr::dynamicCast(type); - if(!constructed) - { - ProxyPtr proxy = ProxyPtr::dynamicCast(type); - assert(proxy); - constructed = proxy->_class(); - } + assert(constructed); out << nl << fixKwd(constructed->scope()) << "__" << func << (pointer ? "" : "&") << stream << ", " << fixedParam << ");"; diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 0f376838af2..3fd6f47e11a 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -216,6 +216,10 @@ Slice::Gen::generate(const UnitPtr& p) C << "\n#include <Ice/LocalException.h>"; C << "\n#include <Ice/ObjectFactory.h>"; } + else if(p->hasNonLocalClassDecls()) + { + H << "\n#include <Ice/Object.h>"; + } if(p->hasNonLocalExceptions()) { @@ -230,7 +234,11 @@ Slice::Gen::generate(const UnitPtr& p) if(p->usesNonLocals()) { C << "\n#include <Ice/BasicStream.h>"; - C << "\n#include <Ice/Object.h>"; + + if(!p->hasNonLocalClassDefs() && !p->hasNonLocalClassDecls()) + { + C << "\n#include <Ice/Object.h>"; + } } if(_stream || p->hasNonLocalClassDefs() || p->hasNonLocalExceptions()) @@ -435,6 +443,11 @@ Slice::Gen::TypesVisitor::TypesVisitor(Output& h, Output& c, const string& dllEx bool Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) { + if(!p->hasOtherConstructedOrExceptions()) + { + return false; + } + _useWstring = setUseWstring(p, _useWstringHist, _useWstring); string name = fixKwd(p->name()); @@ -455,35 +468,6 @@ Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr& p) bool Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { - if(!p->isLocal()) - { - string name = fixKwd(p->name()); - string scope = fixKwd(p->scope()); - - C << sp << nl << "void"; - C << nl << scope.substr(2) << "__addObject(const " << name << "Ptr& p, ::IceInternal::GCCountMap& c)"; - C << sb; - C << nl << "p->__addObject(c);"; - C << eb; - - C << sp << nl << "bool"; - C << nl << scope.substr(2) << "__usesClasses(const " << name << "Ptr& p)"; - C << sb; - C << nl << "return p->__usesClasses();"; - C << eb; - - C << sp << nl << "void"; - C << nl << scope.substr(2) << "__decRefUnsafe(const " << name << "Ptr& p)"; - C << sb; - C << nl << "p->__decRefUnsafe();"; - C << eb; - - C << sp << nl << "void"; - C << nl << scope.substr(2) << "__clearHandleUnsafe(" << name << "Ptr& p)"; - C << sb; - C << nl << "p.__clearHandleUnsafe();"; - C << eb; - } return false; } @@ -699,8 +683,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;"; H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);"; - - H << sp << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;"; + H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;"; H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);"; C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const"; @@ -961,8 +944,11 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) H << sp; H << nl << dllExport << "bool operator==(const " << name << "&) const;"; - H << nl << dllExport << "bool operator!=(const " << name << "&) const;"; H << nl << dllExport << "bool operator<(const " << name << "&) const;"; + H << nl << dllExport << "bool operator!=(const " << name << "& __rhs) const"; + H << sb; + H << nl << "return !operator==(__rhs);"; + H << eb; H << nl << dllExport << "bool operator<=(const " << name << "& __rhs) const"; H << sb; H << nl << "return operator<(__rhs) || operator==(__rhs);"; @@ -978,22 +964,18 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) C << sp << nl << "bool" << nl << scoped.substr(2) << "::operator==(const " << name << "& __rhs) const"; C << sb; - C << nl << "return !operator!=(__rhs);"; - C << eb; - C << sp << nl << "bool" << nl << scoped.substr(2) << "::operator!=(const " << name << "& __rhs) const"; - C << sb; C << nl << "if(this == &__rhs)"; C << sb; - C << nl << "return false;"; + C << nl << "return true;"; C << eb; for(pi = params.begin(); pi != params.end(); ++pi) { C << nl << "if(" << *pi << " != __rhs." << *pi << ')'; C << sb; - C << nl << "return true;"; + C << nl << "return false;"; C << eb; } - C << nl << "return false;"; + C << nl << "return true;"; C << eb; C << sp << nl << "bool" << nl << scoped.substr(2) << "::operator<(const " << name << "& __rhs) const"; C << sb; @@ -1149,13 +1131,10 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) string scoped = fixKwd(p->scoped()); string scope = fixKwd(p->scope()); - H << sp << nl << "class __U__" << name << " { };"; - if(!seqType.empty()) { - H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "&, __U__" - << name << ");"; - H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");"; + H << nl << _dllExport << "void __write" << name << "(::IceInternal::BasicStream*, const " << name << "&);"; + H << nl << _dllExport << "void __read" << name << "(::IceInternal::BasicStream*, " << name << "&);"; if(_stream) { @@ -1165,8 +1144,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) << "&);"; } - C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " - << scoped << "& v, " << scope << "__U__" << name << ")"; + C << sp << nl << "void" << nl << scope.substr(2) << "__write" << name << + "(::IceInternal::BasicStream* __os, const " << scoped << "& v)"; C << sb; C << nl << "::Ice::Int size = static_cast< ::Ice::Int>(v.size());"; C << nl << "__os->writeSize(size);"; @@ -1176,8 +1155,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << eb; C << eb; - C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped - << "& v, " << scope << "__U__" << name << ')'; + C << sp << nl << "void" << nl << scope.substr(2) << "__read" << name + << "(::IceInternal::BasicStream* __is, " << scoped << "& v)"; C << sb; C << nl << "::Ice::Int sz;"; C << nl << "__is->readSize(sz);"; @@ -1251,9 +1230,9 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) } else if(!builtin || builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindObjectProxy) { - H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << s << "*, const " << s - << "*, __U__" << name << ");"; - H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "&, __U__" << name << ");"; + H << nl << _dllExport << "void __write" << name << "(::IceInternal::BasicStream*, const " << s + << "*, const " << s << "*);"; + H << nl << _dllExport << "void __read" << name << "(::IceInternal::BasicStream*, " << name << "&);"; if(_stream) { @@ -1263,8 +1242,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) << "&);"; } - C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " - << s << "* begin, const " << s << "* end, " << scope << "__U__" << name << ")"; + C << sp << nl << "void" << nl << scope.substr(2) << "__write" << name + << "(::IceInternal::BasicStream* __os, const " << s << "* begin, const " << s << "* end)"; C << sb; C << nl << "::Ice::Int size = static_cast< ::Ice::Int>(end - begin);"; C << nl << "__os->writeSize(size);"; @@ -1274,8 +1253,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) C << eb; C << eb; - C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped - << "& v, " << scope << "__U__" << name << ')'; + C << sp << nl << "void" << nl << scope.substr(2) << "__read" << name + << "(::IceInternal::BasicStream* __is, " << scoped << "& v)"; C << sb; C << nl << "::Ice::Int sz;"; C << nl << "__is->readSize(sz);"; @@ -1368,11 +1347,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) string scoped = fixKwd(p->scoped()); string scope = fixKwd(p->scope()); - H << sp << nl << "class __U__" << name << " { };"; - H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name - << "&, __U__" << name << ");"; - H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name - << "&, __U__" << name << ");"; + H << nl << _dllExport << "void __write" << name << "(::IceInternal::BasicStream*, const " << name << "&);"; + H << nl << _dllExport << "void __read" << name << "(::IceInternal::BasicStream*, " << name << "&);"; if(_stream) { @@ -1381,8 +1357,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) H << nl << _dllExport << "void ice_read" << p->name() << "(const ::Ice::InputStreamPtr&, " << name << "&);"; } - C << sp << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " - << scoped << "& v, " << scope << "__U__" << name << ")"; + C << sp << nl << "void" << nl << scope.substr(2) << "__write" << name + << "(::IceInternal::BasicStream* __os, const " << scoped << "& v)"; C << sb; C << nl << "__os->writeSize(::Ice::Int(v.size()));"; C << nl << scoped << "::const_iterator p;"; @@ -1393,8 +1369,8 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) C << eb; C << eb; - C << sp << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scoped - << "& v, " << scope << "__U__" << name << ')'; + C << sp << nl << "void" << nl << scope.substr(2) << "__read" << name + << "(::IceInternal::BasicStream* __is, " << scoped << "& v)"; C << sb; C << nl << "::Ice::Int sz;"; C << nl << "__is->readSize(sz);"; @@ -1698,11 +1674,7 @@ Slice::Gen::ProxyDeclVisitor::visitClassDecl(const ClassDeclPtr& p) H << sp << nl << "class " << name << ';'; H << nl << _dllExport << "bool operator==(const " << name << "&, const " << name << "&);"; - H << nl << _dllExport << "bool operator!=(const " << name << "&, const " << name << "&);"; H << nl << _dllExport << "bool operator<(const " << name << "&, const " << name << "&);"; - H << nl << _dllExport << "bool operator<=(const " << name << "&, const " << name << "&);"; - H << nl << _dllExport << "bool operator>(const " << name << "&, const " << name << "&);"; - H << nl << _dllExport << "bool operator>=(const " << name << "&, const " << name << "&);"; } Slice::Gen::ProxyVisitor::ProxyVisitor(Output& h, Output& c, const string& dllExport) : @@ -1713,7 +1685,7 @@ Slice::Gen::ProxyVisitor::ProxyVisitor(Output& h, Output& c, const string& dllEx bool Slice::Gen::ProxyVisitor::visitUnitStart(const UnitPtr& p) { - if(!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDefs()) { return false; } @@ -1732,7 +1704,7 @@ Slice::Gen::ProxyVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p) { - if(!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDefs()) { return false; } @@ -1836,37 +1808,12 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p) << "static_cast<const ::IceProxy::Ice::Object&>(r);"; C << eb; C << sp; - C << nl << "bool" << nl << "IceProxy" << scope << "operator!=(const ::IceProxy" << scoped - << "& l, const ::IceProxy" << scoped << "& r)"; - C << sb; - C << nl << "return static_cast<const ::IceProxy::Ice::Object&>(l) != " - << "static_cast<const ::IceProxy::Ice::Object&>(r);"; - C << eb; - C << sp; C << nl << "bool" << nl << "IceProxy" << scope << "operator<(const ::IceProxy" << scoped << "& l, const ::IceProxy" << scoped << "& r)"; C << sb; C << nl << "return static_cast<const ::IceProxy::Ice::Object&>(l) < " << "static_cast<const ::IceProxy::Ice::Object&>(r);"; C << eb; - C << sp; - C << nl << "bool" << nl << "IceProxy" << scope << "operator<=(const ::IceProxy" << scoped - << "& l, const ::IceProxy" << scoped << "& r)"; - C << sb; - C << nl << "return l < r || l == r;"; - C << eb; - C << sp; - C << nl << "bool" << nl << "IceProxy" << scope << "operator>(const ::IceProxy" << scoped - << "& l, const ::IceProxy" << scoped << "& r)"; - C << sb; - C << nl << "return !(l < r) && !(l == r);"; - C << eb; - C << sp; - C << nl << "bool" << nl << "IceProxy" << scope << "operator>=(const ::IceProxy" << scoped - << "& l, const ::IceProxy" << scoped << "& r)"; - C << sb; - C << nl << "return !(l < r);"; - C << eb; _useWstring = resetUseWstring(_useWstringHist); } @@ -2043,7 +1990,7 @@ Slice::Gen::DelegateVisitor::DelegateVisitor(Output& h, Output& c, const string& bool Slice::Gen::DelegateVisitor::visitUnitStart(const UnitPtr& p) { - if(!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDefs()) { return false; } @@ -2062,7 +2009,7 @@ Slice::Gen::DelegateVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::DelegateVisitor::visitModuleStart(const ModulePtr& p) { - if(!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDefs()) { return false; } @@ -2180,7 +2127,7 @@ Slice::Gen::DelegateMVisitor::DelegateMVisitor(Output& h, Output& c, const strin bool Slice::Gen::DelegateMVisitor::visitUnitStart(const UnitPtr& p) { - if(!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDefs()) { return false; } @@ -2199,7 +2146,7 @@ Slice::Gen::DelegateMVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::DelegateMVisitor::visitModuleStart(const ModulePtr& p) { - if(!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDefs()) { return false; } @@ -2423,7 +2370,7 @@ Slice::Gen::DelegateDVisitor::DelegateDVisitor(Output& h, Output& c, const strin bool Slice::Gen::DelegateDVisitor::visitUnitStart(const UnitPtr& p) { - if(!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDefs()) { return false; } @@ -2442,7 +2389,7 @@ Slice::Gen::DelegateDVisitor::visitUnitEnd(const UnitPtr& p) bool Slice::Gen::DelegateDVisitor::visitModuleStart(const ModulePtr& p) { - if(!p->hasNonLocalClassDecls()) + if(!p->hasNonLocalClassDefs()) { return false; } @@ -2670,11 +2617,7 @@ Slice::Gen::ObjectDeclVisitor::visitClassDecl(const ClassDeclPtr& p) H << sp << nl << "class " << name << ';'; H << nl << _dllExport << "bool operator==(const " << name << "&, const " << name << "&);"; - H << nl << _dllExport << "bool operator!=(const " << name << "&, const " << name << "&);"; H << nl << _dllExport << "bool operator<(const " << name << "&, const " << name << "&);"; - H << nl << _dllExport << "bool operator<=(const " << name << "&, const " << name << "&);"; - H << nl << _dllExport << "bool operator>(const " << name << "&, const " << name << "&);"; - H << nl << _dllExport << "bool operator>=(const " << name << "&, const " << name << "&);"; } void @@ -3163,97 +3106,99 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) } } - H << sp; - H << nl << "virtual void __write(::IceInternal::BasicStream*) const;"; - H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);"; - H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;"; - H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);"; - - C << sp; - C << nl << "void" << nl << scoped.substr(2) - << "::__write(::IceInternal::BasicStream* __os) const"; - C << sb; - C << nl << "__os->writeTypeId(ice_staticId());"; - C << nl << "__os->startWriteSlice();"; - DataMemberList dataMembers = p->dataMembers(); - DataMemberList::const_iterator q; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) + if(!p->isInterface()) { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); - } - C << nl << "__os->endWriteSlice();"; - emitUpcall(base, "::__write(__os);"); - C << eb; - C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is, bool __rid)"; - C << sb; - C << nl << "if(__rid)"; - C << sb; - C << nl << "::std::string myId;"; - C << nl << "__is->readTypeId(myId);"; - C << eb; - C << nl << "__is->startReadSlice();"; - for(q = dataMembers.begin(); q != dataMembers.end(); ++q) - { - writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); - } - C << nl << "__is->endReadSlice();"; - emitUpcall(base, "::__read(__is, true);"); - C << eb; + H << sp; + H << nl << "virtual void __write(::IceInternal::BasicStream*) const;"; + H << nl << "virtual void __read(::IceInternal::BasicStream*, bool);"; + H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;"; + H << nl << "virtual void __read(const ::Ice::InputStreamPtr&, bool);"; - if(_stream) - { C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __outS) const"; + C << nl << "void" << nl << scoped.substr(2) + << "::__write(::IceInternal::BasicStream* __os) const"; C << sb; - C << nl << "__outS->writeTypeId(ice_staticId());"; - C << nl << "__outS->startSlice();"; + C << nl << "__os->writeTypeId(ice_staticId());"; + C << nl << "__os->startWriteSlice();"; + DataMemberList dataMembers = p->dataMembers(); + DataMemberList::const_iterator q; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring, - (*q)->getMetaData()); + writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), true, "", true, (*q)->getMetaData()); } - C << nl << "__outS->endSlice();"; - emitUpcall(base, "::__write(__outS);"); + C << nl << "__os->endWriteSlice();"; + emitUpcall(base, "::__write(__os);"); C << eb; C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __inS, bool __rid)"; + C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is, bool __rid)"; C << sb; C << nl << "if(__rid)"; C << sb; - C << nl << "__inS->readTypeId();"; + C << nl << "::std::string myId;"; + C << nl << "__is->readTypeId(myId);"; C << eb; - C << nl << "__inS->startSlice();"; + C << nl << "__is->startReadSlice();"; for(q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring, - (*q)->getMetaData()); + writeMarshalUnmarshalCode(C, (*q)->type(), fixKwd((*q)->name()), false, "", true, (*q)->getMetaData()); } - C << nl << "__inS->endSlice();"; - emitUpcall(base, "::__read(__inS, true);"); - C << eb; - } - else - { - // - // Emit placeholder functions to catch errors. - // - C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const"; - C << sb; - C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);"; - C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";"; - C << nl << "throw ex;"; - C << eb; - C << sp; - C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&, bool)"; - C << sb; - C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);"; - C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";"; - C << nl << "throw ex;"; + C << nl << "__is->endReadSlice();"; + emitUpcall(base, "::__read(__is, true);"); C << eb; - } + if(_stream) + { + C << sp; + C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __outS) const"; + C << sb; + C << nl << "__outS->writeTypeId(ice_staticId());"; + C << nl << "__outS->startSlice();"; + for(q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), true, "", _useWstring, + (*q)->getMetaData()); + } + C << nl << "__outS->endSlice();"; + emitUpcall(base, "::__write(__outS);"); + C << eb; + C << sp; + C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __inS, bool __rid)"; + C << sb; + C << nl << "if(__rid)"; + C << sb; + C << nl << "__inS->readTypeId();"; + C << eb; + C << nl << "__inS->startSlice();"; + for(q = dataMembers.begin(); q != dataMembers.end(); ++q) + { + writeStreamMarshalUnmarshalCode(C, (*q)->type(), (*q)->name(), false, "", _useWstring, + (*q)->getMetaData()); + } + C << nl << "__inS->endSlice();"; + emitUpcall(base, "::__read(__inS, true);"); + C << eb; + } + else + { + // + // Emit placeholder functions to catch errors. + // + C << sp; + C << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const"; + C << sb; + C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);"; + C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";"; + C << nl << "throw ex;"; + C << eb; + C << sp; + C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&, bool)"; + C << sb; + C << nl << "Ice::MarshalException ex(__FILE__, __LINE__);"; + C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";"; + C << nl << "throw ex;"; + C << eb; + } + } if(!p->isAbstract()) { H << sp << nl << "static const ::Ice::ObjectFactoryPtr& ice_factory();"; @@ -3357,11 +3302,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "return static_cast<const ::Ice::LocalObject&>(l) == static_cast<const ::Ice::LocalObject&>(r);"; C << eb; C << sp; - C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped - << "& l, const " << scoped << "& r)"; - C << sb; - C << nl << "return static_cast<const ::Ice::LocalObject&>(l) != static_cast<const ::Ice::LocalObject&>(r);"; - C << eb; C << sp; C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped << "& l, const " << scoped << "& r)"; @@ -3373,8 +3313,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) { string name = p->name(); - H << sp << nl << "void " << _dllExport << "__patch__" << name << "Ptr(void*, ::Ice::ObjectPtr&);"; - C << sp << nl << "void " << _dllExport; C << nl << scope.substr(2) << "__patch__" << name << "Ptr(void* __addr, ::Ice::ObjectPtr& v)"; C << sb; @@ -3397,12 +3335,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << nl << "return static_cast<const ::Ice::Object&>(l) == static_cast<const ::Ice::Object&>(r);"; C << eb; C << sp; - C << nl << "bool" << nl << scope.substr(2) << "operator!=(const " << scoped - << "& l, const " << scoped << "& r)"; - C << sb; - C << nl << "return static_cast<const ::Ice::Object&>(l) != static_cast<const ::Ice::Object&>(r);"; - C << eb; - C << sp; C << nl << "bool" << nl << scope.substr(2) << "operator<(const " << scoped << "& l, const " << scoped << "& r)"; C << sb; @@ -3410,22 +3342,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p) C << eb; } - C << sp; - C << nl << "bool" << nl << scope.substr(2) << "operator<=(const " << scoped << "& l, const " << scoped << "& r)"; - C << sb; - C << nl << "return l < r || l == r;"; - C << eb; - C << sp; - C << nl << "bool" << nl << scope.substr(2) << "operator>(const " << scoped << "& l, const " << scoped << "& r)"; - C << sb; - C << nl << "return !(l < r) && !(l == r);"; - C << eb; - C << sp; - C << nl << "bool" << nl << scope.substr(2) << "operator>=(const " << scoped << "& l, const " << scoped << "& r)"; - C << sb; - C << nl << "return !(l < r);"; - C << eb; - _useWstring = resetUseWstring(_useWstringHist); } @@ -3791,7 +3707,7 @@ Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& pref ClassDeclPtr decl = ClassDeclPtr::dynamicCast(p); if(decl) { - C << nl << decl->scope() << "__addObject(" << prefix << name << ", _c);"; + C << nl << "::IceInternal::upCast(" << prefix << name << ".get())->__addObject(_c);"; } else { @@ -3854,10 +3770,11 @@ Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& prefi ClassDeclPtr decl = ClassDeclPtr::dynamicCast(p); if(decl) { - C << nl << "if(" << decl->scope() << "__usesClasses(" << prefix << name << "))"; + C << nl << "if(" << "::IceInternal::upCast(" << prefix << name << ".get())->__usesClasses())"; C << sb; - C << nl << decl->scope() << "__decRefUnsafe(" << prefix << name << ");"; - C << nl << decl->scope() << "__clearHandleUnsafe(" << prefix << name << ");"; + C << nl << "::IceInternal::upCast(" << prefix << name << ".get())->__decRefUnsafe();"; + C << nl << prefix << name << ".__clearHandleUnsafe();"; + } else { @@ -4063,15 +3980,17 @@ void Slice::Gen::IceInternalVisitor::visitClassDecl(const ClassDeclPtr& p) { string scoped = fixKwd(p->scoped()); - + H << sp; - H << nl << _dllExport << "void incRef(" << scoped << "*);"; - H << nl << _dllExport << "void decRef(" << scoped << "*);"; + if(!p->isLocal()) { - H << sp; - H << nl << _dllExport << "void incRef(::IceProxy" << scoped << "*);"; - H << nl << _dllExport << "void decRef(::IceProxy" << scoped << "*);"; + H << nl << _dllExport << "::Ice::Object* upCast(" << scoped << "*);"; + H << nl << _dllExport << "::IceProxy::Ice::Object* upCast(::IceProxy" << scoped << "*);"; + } + else + { + H << nl << _dllExport << "::Ice::LocalObject* upCast(" << scoped << "*);"; } } @@ -4079,32 +3998,17 @@ bool Slice::Gen::IceInternalVisitor::visitClassDefStart(const ClassDefPtr& p) { string scoped = fixKwd(p->scoped()); - - C << sp; - C << nl << "void" << nl << "IceInternal::incRef(" << scoped << "* p)"; - C << sb; - C << nl << "p->__incRef();"; - C << eb; C << sp; - C << nl << "void" << nl << "IceInternal::decRef(" << scoped << "* p)"; - C << sb; - C << nl << "p->__decRef();"; - C << eb; - if(!p->isLocal()) { - C << sp; - C << nl << "void" << nl << "IceInternal::incRef(::IceProxy" << scoped << "* p)"; - C << sb; - C << nl << "p->__incRef();"; - C << eb; - - C << sp; - C << nl << "void" << nl << "IceInternal::decRef(::IceProxy" << scoped << "* p)"; - C << sb; - C << nl << "p->__decRef();"; - C << eb; + C << nl << _dllExport << "::Ice::Object* IceInternal::upCast(" << scoped << "* p) { return p; }"; + C << nl << _dllExport << "::IceProxy::Ice::Object* IceInternal::upCast(::IceProxy" << scoped + << "* p) { return p; }"; + } + else + { + C << nl << _dllExport << "::Ice::LocalObject* IceInternal::upCast(" << scoped << "* p) { return p; }"; } return true; @@ -4152,9 +4056,7 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p) H << nl << "typedef ::IceInternal::ProxyHandle< ::IceProxy" << scoped << "> " << name << "Prx;"; H << sp; - H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Prx&);"; H << nl << _dllExport << "void __read(::IceInternal::BasicStream*, " << name << "Prx&);"; - H << nl << _dllExport << "void __write(::IceInternal::BasicStream*, const " << name << "Ptr&);"; H << nl << _dllExport << "void __patch__" << name << "Ptr(void*, ::Ice::ObjectPtr&);"; if(_stream) { @@ -4168,11 +4070,6 @@ Slice::Gen::HandleVisitor::visitClassDecl(const ClassDeclPtr& p) << name << "Ptr&);"; H << nl << _dllExport << "void ice_read" << name << "(const ::Ice::InputStreamPtr&, " << name << "Ptr&);"; } - - H << sp << nl << _dllExport << "void __addObject(const " << name << "Ptr&, ::IceInternal::GCCountMap&);"; - H << nl << _dllExport << "bool __usesClasses(const " << name << "Ptr&);"; - H << nl << _dllExport << "void __decRefUnsafe(const " << name << "Ptr&);"; - H << nl << _dllExport << "void __clearHandleUnsafe(" << name << "Ptr&);"; } } @@ -4199,13 +4096,6 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) } C << sp; - C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " - << scope << name << "Prx& v)"; - C << sb; - C << nl << "__os->write(::Ice::ObjectPrx(v));"; - C << eb; - - C << sp; C << nl << "void" << nl << scope.substr(2) << "__read(::IceInternal::BasicStream* __is, " << scope << name << "Prx& v)"; C << sb; @@ -4222,13 +4112,6 @@ Slice::Gen::HandleVisitor::visitClassDefStart(const ClassDefPtr& p) C << eb; C << eb; - C << sp; - C << nl << "void" << nl << scope.substr(2) << "__write(::IceInternal::BasicStream* __os, const " - << scope << name << "Ptr& v)"; - C << sb; - C << nl << "__os->write(::Ice::ObjectPtr(v));"; - C << eb; - if(_stream) { C << sp; |