comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Destroying objects
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Destroying objects [message #82755 is a reply to message #37981] Fri, 18 January 2013 10:07 Go to previous messageGo to previous message
Helder Marchetto is currently offline  Helder Marchetto
Messages: 520
Registered: November 2011
Senior Member
On Friday, January 18, 2013 6:50:05 PM UTC+1, David Fanning wrote:
> Helder writes:
>
>
>
>> as usual I'm do things wrong believing I'm not until I wake-up.
>
>> So here's the thing. I'm using a structure to describe some objects. In my case these are regions of interest. Within this structure I have real objects. So that my structure looks something like this:
>
>>
>
>> MyStruct = {ROI_Structure, a:ID_Nr, b:SomeOtherParameter, c:Obj_new()}
>
>> I then fill in MyStruct.c by doing something like this:
>
>> XROI, MyImage, REGIONS_OUT = XROI_ObjRef
>
>> MyStruct.c = XROI_ObjRef
>
>>
>
>> The thing is that I then replicate this structure when I add new ROIs.
>
>> So I end up with say 10 {ROI_Structure} where for each element I did something like this:
>
>> for i=0,9 do MyStruct[i].c = XROI_ObjRef[i]
>
>>
>
>> If and when somewhere later in the program I want to delete object number 5... do I have to take care of using
>
>> Obj_destroy, MyStruct[5].c
>
>>
>
>> Is there no alternative?
>
>> Thing is, in this structure I have many pointers and objects...
>
>>
>
>> I'm I wrong in saying that I have to do the good-boy bookkeeping and free/destroy for each deleted structure element all pointers and objects?
>
>
>
> I'm not sure what the problem is, Helder. Doesn't this, do the job:
>
>
>
> Obj_Destroy, myStruct.c[*]
>
>
>
> Cheers,
>
>
>
> David
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thue. ("Perhaps thou speakest truth.")

Thank to both.
I think this is a general problem I'm realizing about programming. If you use structures that contain pointers or objects, that might contain other pointer and objects and so on, you have to take care of cleaning up the mess you've made.

Will have to do some housekeeping or trust 8.2.1 do to it for me.

Cheers,
Helder
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Destroying objects
Next Topic: Re: shading/outlining on surface plot

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 07:53:08 PDT 2025

Total time taken to generate the page: 0.15827 seconds