[omniORB] dispose or not dispose, that's the quest
Swayamjit Das
swayam@krdl.org.sg
Tue, 29 Sep 1998 10:19:20 +0800
hi,
Ralf Walther wrote:
> PROBLEM1: Every time a new Object of class A is created, it should be
> registered to the BOA
> (no problem, can be done in the constructor of A_Interface_i)
> BUT on every object the _dispose() method should be called
> instead of delete.
> Obviously, it's not allowed to call _dispose in the
> ~A_Interface_i().
>
> The consequence is: Every CORBA object have to be constructed
> with new AND
> the low level layer should handle CORBA
> objects via _dispose()
> (not so pretty, isn't it?)
>
Yes, I think there is no choice but to create the "server" using new
operator as the ORBuses delete operator to reclaim the storage.
As for destruction, a possible way is to define a simple holder/wrapper
class that holds a
pointer to the CORBA::Object. The wrapper class should call the _dipose() on
the corba Object
when it is deleted or goes out of scope.
The other advantage of this approach is that the wrapper makes it possible
to store the "server"
in a standard container.
> PROBLEM2: Temporary objects have to be created with new, too. So, the
> nice functionality
> of object destruction via 'out of scope' is not available any
> more.
>
> I think other ORB's handle this internaly. But it should exist an
> acceptable solution for omniORB, too?
I dont quite understand this question. If "destruction via out of scope" is
what you are looking forthen the wrapper way provides a solution.
That is my $0.02
Regards
SDas.