Re: Bonobo objects in property bags?



Hi Owen,

On 1 May 2001, Owen Fraser-Green wrote:
> I have an object X which has a property Y which is also a 
> BonoboXObject. Can I shove Y into X's PropertyBag? If so, the only
> question is which BonoboArgType should it get?
 
        Ok, the BonoboArgType stuff is just a helper for the noddy cases  
to make things slightly easier for people [ who it is claimed don't like  
CORBA style types ]. a BonoboArgType is actualy just a CORBA_TypeCode, so
you want to use TC_Object.

[bonobo-arg.h]:

typedef CORBA_any      BonoboArg;
typedef CORBA_TypeCode BonoboArgType;
...     
#define BONOBO_ARG_LONG    TC_long
#define BONOBO_ARG_FLOAT   TC_float
#define BONOBO_ARG_DOUBLE  TC_double
#define BONOBO_ARG_STRING  TC_string
etc.    
        
        These TC_ values are defined in   
        
[ORBit/src/orb/corba_typecode.h]: 

#define TC_long ((CORBA_TypeCode)&TC_long_struct)
...
#define TC_Object ((CORBA_TypeCode)&TC_Object_struct)

        Be warned you need to think about referencing carefuly. Probably
very carefuly. When you return the property from a 'get' method, it is  
likely that you want to return a bonobo_object_dup_ref'd reference to the
object - and similarly in the user code to release the reference after   
you've finished with it.

> If not a propertybag should I just write seperate get/set methods for
> it? I don't think it makes sense to just agregate Y's interface into 
> X.

        It would suck having to add a new interface :-)

        Regards,
  
                Michael.

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot





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