Re: Trouble writing a Factory



Nick Glencross wrote:

Hi Folks,

I've been trying to implement a factory Object in orbitcpp (like the
factory one in http://jmvanel.free.fr/corba/orbit-docs/examples/factory/
for C ORBit). This is obviously basic stuff, but I can't find the exact
code that I put in the Factory method implementation to return the
object that it creates.

There was a discussion about writing this example mentioned here:
http://sourceforge.net/mailarchive/message.php?msg_id=522349

The factory itself was created like this:

         Block_ns::BlockFactory_impl servant;
         CORBA::Object_var object = servant._this();

Doing something similar to this doesn't however match the prototype of
the method that the IDL compiler has created for me though. Also the
constructor for the exact type to be returned is protected, so that
isn't right either.

Any code snippets would be greatly appreciated,
I've just added a test client and server that implements a really basic factory. It can be found under test/cpp/factory. It should be enough to get you started. You will have to check out the CVS version of orbitcpp to get at the example. Instructions on how to get the CVS version on the orbitcpp webpage.

http://orbitcpp.sourceforge.net/

The anonymous servers sometimes take time to sync. You'll need the version with a ChangeLog entry that reads as follows.

2004-12-08 Bowie Owens <bowie owens csiro au>
       * configure.in
       * test/cpp/Makfile.am
       * test/cpp/factory/Makefile.am
       * test/cpp/factory/client.cc
       * test/cpp/factory/factory-impl.cc
       * test/cpp/factory/factory-impl.h
       * test/cpp/factory/server.cc
       * test/cpp/factory/generated/Makefile.am:
       Quickly hacked together example of factory.

Please let me know if anything fails to work.

--
Bowie Owens

CSIRO Mathematical & Information Sciences
phone  : +61 3 9545 8055
fax    : +61 3 9545 8080
mobile : 0425 729 875
email  : Bowie Owens csiro au




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]