Re: string attributes



A Qua, 2003-12-03 ās 18:39, Craig McDaniel escreveu:
> What should the typical get/set methods look like for a string type
> attribute? 
> 
> Take this as an example:
> 
> -----------------------------
> idl:
> interface Foo {
> 	attribute string bar;
> }
> -----------------------------
> C:

	I think you're wrong.  Try this instead:

static CORBA_string
impl_Foo__get_bar(impl_POA_DataMine * servant,
                             CORBA_Environment * ev)
{
   return CORBA_string_dup (servant->attr_bar);
}
                                                                                
static void
impl_Foo__set_bar(impl_POA_DataMine * servant,
                             const CORBA_char * value, CORBA_Environment
* ev)
{
    if (servant->attr_bar) CORBA_free (servant->attr_bar);
    servant->attr_bar = CORBA_string_dup (value);
}

	And I think your problem in the other mail you sent later is related to
this.  You should really read more carefully the IDL->C mapping
specification.  Don't worry, it is not a very large or complicated
document.

	Regards.
-- 
Gustavo J. A. M. Carneiro
<gjc@inescporto.pt> <gustavo@users.sourceforge.net>




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