Re: Passing info and destroying widgets... [message #16011 is a reply to message #15898] |
Tue, 22 June 1999 00:00   |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Stein Vidar Hagfors Haugan wrote:
>
> [A very interesting article in a very interesting thread ...]
>
> The memory inefficiency is of course related to the fact that if
> you're not using pointers, you need to provide a copy of the data
> to the outside whenever the outside (user) needs to look at it,
> like this:
>
> IDL> data = obj->getdata()
> IDL> print,sigma(data)
>
Hmmm. To avoid that whole /NOCOPY thing, I would probably
store the data as a pointer within the object, so
obj->getdata()
would return the pointer anyway. No need to call
obj->setdata(pointer)
afterwards if you are not manipulating the data itself. Here, of course
one probably has to differentiate between Stein's three user types
again: don't trust a scientist! He/she is most likely to manipulate the
data and not tell the object about it. Hence, there should probably be a
obj->CheckIntegrity
method which retrieves type and dimensions of the data
before the objects accesses it (for plotting or whatever else).
Pun: you shouldn't call this method obj->IsInteger ;-)
Martin.
--
|||||||||||||||\\\\\\\\\\\\\-------------------///////////// //|||||||||||||||
Martin Schultz, DEAS, Harvard University, 29 Oxford St., Pierce 109,
Cambridge, MA 02138 phone (617) 496 8318 fax (617) 495 4551
e-mail mgs@io.harvard.edu web http://www-as/people/staff/mgs/
|
|
|