From aa904c308f18f38ea49fb94765e3f20cf01a289c Mon Sep 17 00:00:00 2001 From: Mark Spruiell Date: Fri, 8 Aug 2003 19:35:01 +0000 Subject: adding support for a default object factory --- cpp/src/Ice/BasicStream.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'cpp/src/Ice/BasicStream.cpp') 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); -- cgit v1.2.3