[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Object Data and pointer assignments
- Subject: Object Data and pointer assignments
- From: Ben Tupper <tupper(at)seadas.bigelow.org>
- Date: Thu, 09 Mar 2000 14:25:08 -0500
- Newsgroups: comp.lang.idl-pvwave
- Organization: Bigelow Laboratory for Ocean Sciences
- Xref: news.doit.wisc.edu comp.lang.idl-pvwave:18863
I am in the middle of wrtting my first object from scratch. Scratch is
a good word since I'm doing a lot of that on my head. I'm hoping to get
some advice on organization of data. I need 4 pieces of data (one 2d
arrays and two structures that vary in size according to the size of the
arrays) plus six keywords that I need to get/set. Currently, I have
defined each of the 3 bits of data as null pointers in the BLAH__DEFINE
In the BLAH::INIT function, the user passes one of the two arrays as an
argument. At that point I reassign one of the pointers to...
Self.InArray = Ptr_New(InArray).
I think I understand why I can reassign the structure field when going
from a null pointer to a filled pointer. On second thought, I don't
understand it but I can accept that it works. It's the next step I need
I would like to change the contents of this field later to some other
value (a differently sized array.) Here's where the ice under me gets
very very thin and my eyes get misty. In the BLAH::SETPROPERTY method,
I don't know if I should free this pointer before reassigning (and does
that leave the structure field undefined?), or if I should simply
overwrite it as I did in the INIT function. If I reassign the filed
to a new pointer, what happens to the previously occupied heap space?
Have I sprung a leak?
Bigelow Laboratory for Ocean Science