From a5074c07a75bc7b6debd20fbc886103831d489dd Mon Sep 17 00:00:00 2001 From: Marc Laukien Date: Mon, 22 Oct 2001 21:23:48 +0000 Subject: more objects demo stuff --- cpp/test/Ice/objects/Client.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'cpp/test/Ice/objects/Client.cpp') diff --git a/cpp/test/Ice/objects/Client.cpp b/cpp/test/Ice/objects/Client.cpp index c61fa56625c..d9a019848cd 100644 --- a/cpp/test/Ice/objects/Client.cpp +++ b/cpp/test/Ice/objects/Client.cpp @@ -14,9 +14,41 @@ using namespace std; +class MyObjectFactory : public Ice::ObjectFactory +{ +public: + + virtual Ice::ObjectPtr create(const string& type) + { + if (type == "::B") + { + return new B; + } + else if (type == "::C") + { + return new C; + } + else if (type == "::D") + { + return new D; + } + assert(false); // Should never be reached + } + + virtual void destroy() + { + // Nothing to do + } +}; + int run(int argc, char* argv[], const Ice::CommunicatorPtr& communicator) { + Ice::ObjectFactoryPtr factory = new MyObjectFactory; + communicator->addObjectFactory(factory, "::B"); + communicator->addObjectFactory(factory, "::C"); + communicator->addObjectFactory(factory, "::D"); + InitialPrx allTests(const Ice::CommunicatorPtr&); InitialPrx initial = allTests(communicator); initial->shutdown(); -- cgit v1.2.3