octave-maintainers
[Top][All Lists]
Advanced

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

Re: Graphics properties as objects


From: Michael Goffioul
Subject: Re: Graphics properties as objects
Date: Tue, 8 Jan 2008 17:02:16 +0100

On 1/8/08, John W. Eaton <address@hidden> wrote:
> | Yes, but in the meantime, you'll have another reference stored in the
> | map. So the internal object will not be deleted.
>
> OK, then why not pass by reference to avoid the unnecessary calls to
> the copy constructor and destructor?

Fine for me. It's just that constructing a property object is rather cheap
as it only involves incrementing the reference count. Note that it must
be a non-const reference because of the set_name/set_parent calls.

> Other than that, my initial impression is that the proposal is good
> and keeps most of the details hidden from the user.

Still to be determined: what type should the get_xxx return?

> It seems the only
> thing to really know is that there are some requirements for to the
> pointer to the base_property object that is passed to the property
> constructor:
>
>  * if persist is true, then the pointer must be valid for as long as
>    the map exists and it is the caller's responsibility to delete the
>    object that the pointer refers to

That's why I made "insert_static_property" protected (as it's the only
place where this could be used).

>  * if persiste is false, then the pointer should point to an object
>    that has been allocated with new and the object will be deleted
>    when the map is deleted
>
> Is that correct?  If so, I think these rules should be stated in a
> comment in the code.

OK, I'll add them.

Michael.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]