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

Home » Public Forums » archive » Re: Calling data from a structure of pointers?
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: Calling data from a structure of pointers? [message #43028 is a reply to message #43020] Thu, 10 March 2005 22:57 Go to previous messageGo to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Jonathan Greenberg wrote:

> How do I retrieve the data the pointers are referring to?

pStr is pointer to a structure variable. This strucutre has 2 pointer
fields.

pStr = PTR_NEW(
{
a: PTR_NEW(10),
b: PTR_NEW(INDGEN(3))
})


pStr - Pointer variable to structure stored in HEAP memory.
IDL> help, pStr
PSTR POINTER = <PtrHeapVar6>

*pStr - The content that pStr points to, that is, the structure
stored in HEAP memory.l
IDL> help, *pStr, /STRUCT
** Structure <1f06f8>, 2 tags, length=8, data length=8, refs=1:
A POINTER <PtrHeapVar4>
B POINTER <PtrHeapVar5>

(*pStr).a - First "get" the strucutre and then access to the firts
pointer field 'a'.
IDL> help, (*pStr).a
<Expression> POINTER = <PtrHeapVar4>

(*(*pStr).a) - The same as above but obtain the content that 'a'
points (10).
IDL> help, (*(*pStr).a)
<PtrHeapVar4> INT = 10

And the same for 'b' field:
IDL> help, (*pStr).b
<Expression> POINTER = <PtrHeapVar5>
IDL> help, (*(*pStr).b)
<PtrHeapVar5> INT = Array[3]


IDL> arr = *(*pStr).b
IDL> print, arr
0 1 2
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: least square matrix
Next Topic: Editting IDL files under MacOS X

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

Current Time: Sat Oct 11 17:31:26 PDT 2025

Total time taken to generate the page: 0.15756 seconds