Re: Linked List [message #8610 is a reply to message #8505] |
Wed, 26 March 1997 00:00   |
hto
Messages: 15 Registered: April 1996
|
Junior Member |
|
|
On 22 Mar 1997 03:56:28 GMT, martin@uthscsa.edu (Charles Martin)
wrote:
> In article <333118AC.41C67EA6@pml.ac.uk>, Nigel Helliwell <nih@pml.ac.uk> wrote:
>
>> Hi all,
>> I'm trying to create a linked list structure in IDL, it is a list of
>> records(structures) which I need to create dynamically.
>>
>> POINTER TO record
>> record = {NAME,VAR1,VAR2,..,(POINTER TO NEXT RECORD)}
>> etc.
>> If anymone has any idea how to go about this please could you give me a
>> few ideas.
>> Thankyou,
>> Nigel.
>> <nih@pml.ac.uk>
>
> I think you can do it with handles. IDL version 5 is supposed to have
> pointers. If this is the case then you may want to wait until you get V5.
>
> Charles Martin
> University of Texas
IDL has builtins to create and manage linked lists. Use
handle_create, handle_info, etc. It's very straightforward and
elegant. You do not have (or need) direct access to the link
pointers. All links are accessed via link id's. You can explicitly
access the first record and then succeeding records until the list is
exhausted (id of -1 returned). Therefore you can create while loops
to operate on the entire list without needing to know the number of
elements in the list (although that is readily available). You can
also deallocate individual elements or the entire list (with one line
of code) and I believe that the memory is returned to the IDL pool for
reuse.
Howard Onishi
|
|
|