[omniORB] Obtaining references out of factory

Nikolas Mangold nikolas.mangold@esk.fhg.de
Thu, 17 Jan 2002 11:47:44 +0100


Hi xanth,

> Nevertheless I am quite sure I am doing the whole mistake.
CORBA programming is not that simple thing, so ask whatever your problem is, 
allthough this is not a pure CORBA problem...

> vector <Foo_i> foolist;
Here you are saving the real objects and not their references in the vector
try it with: vector <Foo_i*> foolist;

> Then the mismatch in the catch() method:
> Foo_ptr FooFactory_i::catch(int id) {
> 	//the following is working, but does create some new object
> 	tmpFoo = new Foo_i(foolist.begin().[id]

Replace the above line with something more simple:
	tmpFoo = foolist.begin().[id];

> 	return tmpFoo->_this();
> }

After these two little changes, the rest of the code should work, hope it 
helps and even works.

Regards,
Nikolas.