Wrapping a C++ object with an ORBit CORBA interface.



Hello,

I've been running into some problems trying to wrap a particular server 
object with a CORBA object.

My problem is:

I have a C++ class called Result. Occasionally I have to pass results to 
a client application via CORBA, but this is about the 0.5 percentile use 
of Results and they are used all over the place. So, what I want to 
beable to do is wrap a Result in an object called ORB_Result.

So I declare this idl:

interface ORB_Result
{
    boolean isSuccess();
};


The code that is generated for me seems to work, but I don't know how to 
associate a real instance of Result with an ORB_Result. I think 
ORB_Result needs some sort of field to put a pointer to a Result in. 
Does such a thing already exist? I know ORB_Result ends up being 
typedefed to a CORBA_Object, but due to lack of commenting ;) I can't 
really tell what the fields in the CORBA_Object are. I am by no means a 
CORBA expert either.


What I tried to do was put a void* in the POA_ORB_Result struct that is 
generated for me and lives in ORB_Result.h then I populate it with a 
Result.

That's ok except another CORBA object has to create ORB_Result as return 
values occasionally. Therefore a default creation is not what I want. So 
when I call impl_ORB_Result__create and get back an ORB_Result I don't 
know how to actually set the underlying Result object in it.

So I tried something else. I created another function 
impl_ORB_Result__create_2 which takes a void* (actually a Result*), as 
its third argument and uses this to fill in my field in the 
POA_ORB_Result struct.

The problem is, is that all of this seems like a terrible hack, and 
although it appears to work I feel like I could be doing this in a 
better way.

Does anyone have a better solution?

Thanks in advance,

-Craig





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