[omniORB] Using `the_servant` in postinvoke() ?

Duncan Grisby dgrisby@uk.research.att.com
Thu, 15 Feb 2001 11:55:27 +0000


On Wednesday 14 February, randy.shoup@tumbleweed.com wrote:

[...]
> 	void postinvoke( ... , PortableServer::Servant the_servant) {
> 		// cast to MyImpl*
> 		MyImpl* servant = (MyImpl *)the_servant;
> 
> 		// clean up
> 		servant->cleanup(...);
> 	}
> 	
> The cast to MyImpl* does not compile because MyImpl derives from
> RefCountServantBase, which inherits *virtually* from ServantBase.  Hmmm

As long as your compiler supports it, you can use dynamic_cast<>. If
your compiler doesn't have that, you're out of luck I'm afraid.

If you used Python you wouldn't have this problem :-).

Cheers,

Duncan.

-- 
 -- Duncan Grisby  \  Research Engineer  --
  -- AT&T Laboratories Cambridge          --
   -- http://www.uk.research.att.com/~dpg1 --