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

Home » Public Forums » archive » Indexing structures of different type
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: Indexing structures of different type [message #15999 is a reply to message #15921] Tue, 22 June 1999 00:00 Go to previous messageGo to previous message
David Foster is currently offline  David Foster
Messages: 341
Registered: January 1996
Senior Member
Donglai Gong Rm3110 x1569 wrote:
>
> Hi, does anyone know how to index structures of different types in IDL?
>
> REPLICATE won't work since it creates an array of the same structure, so
> I'm thinking of doing a structure of structures. However I don't know
> how to index them for use in a loop. Thanks in advance.
>
> Donglai Gong

Use an array of pointers and index that array:

struct_ptrs = ptrarr(10, /allocate_heap)

*struct_ptrs[0] = struct1
*struct_ptrs[1] = struct2
...

(*struct_ptrs[0]).tag1 = ...

Check out the docs for PTRARR, PTR_NEW, PTR_FREE, and PTR_VALID.

Also look at TAG_NAMES and the use of tag *numbers* instead of
names when accessing structure elements.


Dave Foster
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
foster@bial1.ucsd.edu Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Passing info and destroying widgets...
Next Topic: Crazy use of MAX function.

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

Current Time: Sun Oct 12 08:34:38 PDT 2025

Total time taken to generate the page: 2.95865 seconds