Re: CORBA_object and its data structure

Hi Samuele,

On Fri, 23 Nov 2001, Samuele Gallazzi wrote:
> I implemented a little CORBA_Object (Msg) with its methods and its
> attributes; I also implemented another CORBA_Object with methods and
> attributes; this one has a struct attribute in which I inserted a
> field of type Msg (the first object).


> I'd want to understand if this kind of data structure can cause any 

        No; shouldn't. Remember you need to CORBA_Object_duplicate any
object references you push into a structure.

> In particular, when I insert my data in the big structure of the
> second object, I use the "Msg" inserting data with methods created by
> the orbit, such as Msg__set_attribute1, Msg__get_attribute2,... but
> I've never executed the impl_Msg__create()!

        It sounds like you're confused; if you have a CORBA structure:
        struct Foo {
                string my_str;
                long   a_long;
                Object objref;
        you can do:
        MyModule_Foo foo;
        foo.my_str = CORBA_string_dup ("My string");
        foo.a_long = 2;
        foo.objref = CORBA_Object_duplicate (a_ref, ev);
        You don't need any accessors.
> So, I think I'm not using such in a correct way this structure: maybe
> I use it only like a "data structure" not like an object... but, on
> the other hand, with Orbit I'm not able to execute a create inside a
> data structure of another object. Where is the solution to my problem?
> Please help me! Tell me where I'm wrong!
        You cannot use a remote object reference like a structure; ie. you
cannot access attributes with a pointer dereference either localy or
remotely. ie.
        /* BROKEN */
        object->myAttribute = 3;
        /* BROKEN */
        You have to use the accessor:

        My_Object__set_myAttribute (object, 3, ev);

        And similarly for the __get_attribute.



--  <><, Pseudo Engineer, itinerant idiot

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