Re: C mapping equivalent of Java narrow() method
- From: Michael Meeks <michael ximian com>
- To: Chris Wareham <chris wareham iosystems co uk>
- Cc: orbit <orbit-list gnome org>
- Subject: Re: C mapping equivalent of Java narrow() method
- Date: 16 Dec 2002 13:28:49 +0000
Hi Chris,
On Fri, 2002-12-13 at 13:35, Chris Wareham wrote:
> I'm porting a Java based CORBA client to C, but having trouble finding
> the C equivalent of certain things. I've attached a minimal Java example
> which connects to the naming service, and then tries to get a reference
> to an specific object. (Apologies if attachments are frowned upon on
> this list).
Sounds good. (small) attachments are fine.
> The problem I'm having is finding the C mapping equivalent of lines 32
> to 36 where I "narrow" my reference to the desired object. Any examples
> or advice would be greatly appreciatted. In the meantime I'll carry on
> reading the OMG C mapping spec.
In C there is no need for 'narrow' since there is no need for complex
object type mappings of any sort. So simply:
FooCorbaType a = (CORBA_Object) b;
:-) indeed, since everything is a gpointer it's all extraordinarily
type unsafe. If you're paranoid you can check that the object is of a
certain type with CORBA_Object_is_a (), otherwise you'll tend to
discover a mis-cast by getting an operation not found exception when you
invoke on the wrong object ...
HTH,
Michael.
--
mmeeks@gnu.org <><, Pseudo Engineer, itinerant idiot
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]