diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-08-08 19:35:01 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-08-08 19:35:01 +0000 |
commit | aa904c308f18f38ea49fb94765e3f20cf01a289c (patch) | |
tree | 33a6c87e18ca7410c533fe1454f5a521567f75dc /cpp/src | |
parent | Added Properties::parseIceCommandLineOptions(). (diff) | |
download | ice-aa904c308f18f38ea49fb94765e3f20cf01a289c.tar.bz2 ice-aa904c308f18f38ea49fb94765e3f20cf01a289c.tar.xz ice-aa904c308f18f38ea49fb94765e3f20cf01a289c.zip |
adding support for a default object factory
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/BasicStream.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index c672e456c08..ed0e50a54ff 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -1233,17 +1233,41 @@ IceInternal::BasicStream::read(PatchFunc patchFunc, void* patchAddr) string id; readTypeId(id); + // + // Try to find a factory registered for the specific type. + // ObjectFactoryPtr userFactory = _instance->servantFactoryManager()->find(id); if(userFactory) { v = userFactory->create(id); } + // + // If that fails, invoke the default factory if one has been registered. + // + if(!v) + { + userFactory = _instance->servantFactoryManager()->find(""); + if(userFactory) + { + v = userFactory->create(id); + } + } + + // + // There isn't a static factory for Ice::Object, so check for that case now. + // We do this *after* the factory inquiries above so that a factory could be + // registered for "::Ice::Object". + // if(!v && id == Ice::Object::ice_staticId()) { v = new ::Ice::Object; } + // + // Last chance: check the table of static factories (i.e., automatically generated + // factories for concrete classes). + // if(!v) { ObjectFactoryPtr of = Ice::factoryTable->getObjectFactory(id); |