Re: Moving to objects loses array functionality? [message #63358 is a reply to message #63305] |
Tue, 04 November 2008 13:50  |
|
Originally posted by: Demitri
Hi Paul,
On 2008-11-03 18:18:18 -0500, Paul van Delst <Paul.vanDelst@noaa.gov> said:
>
The IDL documentation specifically states the dereference operator
requires a scalar operand:
>
> <quote>
> Dereferencing Pointer Arrays
>
> Note that the dereference operator requires a scalar pointer operand.
> This means that if you are dealing with a pointer array, you must
> specify which element to dereference. For example, create a
> three-element pointer array, allocating a new heap variable for each
> element:
>
> ptarr = PTRARR(3, /ALLOCATE_HEAP)
>
> To initialize this array such that the heap variable pointed at by the
> first pointer contains the integer zero, the second the integer one,
> and the third the integer two, you would use the following statement:
>
> FOR I = 0,2 DO *ptarr[I] = I
> </quote>
>
>
> So it would appear the facile answer to your question is: no. The
> documentation itself suggests the use of for-loops.
>
> But, maybe some gun IDL guru out there may be able to conflate the
> histogram procedure and pointer dereferencing to do what you want?
> (I'd like to see that :o)
>
> cheers,
>
> paulv
Thanks for pointing that out - I missed that in the documentation. I
can completely understand how assigning the values would require a FOR
loop, but I was hoping that IDL could dynamically send the "message" to
the (dereferenced) structure to read the value. I'll assume that this
cannot be done until someone can prove me wrong!
Cheers,
Demitri
|
|
|