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

Home » Public Forums » archive » Re: Data Structure in IDL
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: Data Structure in IDL [message #43813 is a reply to message #43812] Mon, 02 May 2005 00:32 Go to previous messageGo to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
chintanraval@yahoo.com wrote:
> First of all Thank You for quick reply
>
> But my question is that suppose i have defined a structure and can i
> take a pointer of that structure in structure's data? if yes then how
> i can alloc the memory to that pointer....
>
See PTR_NEW(), PTRARR.

a = your_struct

p = PTR_NEW(a) ;; Creates a copy of your_struct into heap memory and
mantains a reference to it in 'p'.

p = PTR_NEW(a, /NO_COPY) ;;Creates a copy of a into heap memory and
undefines 'a'.

p = PTR_NEW(CREATE_STRUCT(NAME=your_named_struct)) ;;Directly reserve
heap memory space for your struct and 'p' is a reference to it.

If one field of your structure is a pointer references:

s = {name,
f1: 'hello', $
f2: PTR_NEW() $
}

you can chain elements.

p1 = PTR_NEW( CREATE_STRUCT(NAME=name) )
p2 = PTR_NEW( CREATE_STRUCT(NAME=name) )

(*p1).f2 = p2


> and here one more thing is that i m not using the object oriented
> fundamentals over here...
>
OO is very powerfull and (I think) easy to use existing objects like
lists or hashes than create complex structures. Instead create an
structure by yourself to mantain a lot of pointer references you can use
(for example) a simple linkeslist to maintain a list of nodes on wich
every node has a reference to an structure/object/anything.

> Regards
> Chintan Raval
> (There are 10 kinds of people in this world .... :) those who
> understand binary and those who don't)
>


Bye,
Antonio.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Data Structure in IDL
Next Topic: Re: Positions in 3-d

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

Current Time: Fri Oct 10 11:03:39 PDT 2025

Total time taken to generate the page: 1.28155 seconds