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 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Data Structure in IDL [message #43812] Mon, 02 May 2005 00:54
chintanraval is currently offline  chintanraval
Messages: 3
Registered: May 2005
Junior Member
Thank You,,,,

Antonio,,,,
Re: Data Structure in IDL [message #43813 is a reply to message #43812] Mon, 02 May 2005 00:32 Go 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.
Re: Data Structure in IDL [message #43814 is a reply to message #43813] Sun, 01 May 2005 23:56 Go to previous message
chintanraval is currently offline  chintanraval
Messages: 3
Registered: May 2005
Junior Member
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....

and here one more thing is that i m not using the object oriented
fundamentals over here...

Regards
Chintan Raval
(There are 10 kinds of people in this world .... :) those who
understand binary and those who don't)
Re: Data Structure in IDL [message #43815 is a reply to message #43814] Sun, 01 May 2005 23:15 Go to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
chintanraval@yahoo.com wrote:
> Hello Every body,
>
> I am new to this group and also new to IDL.Can any body help me in
> creating the data structure in idl. (Data structure like
> Stack,Tree,LinkList.)
>
> ???
>
> Regards.
> Chintan Raval
> (There are 10 kinds of people in this world .... :) those who
> understand binary and those who don't)
>

Here
http://www.rsinc.com/codebank/search.asp?search=category& ;product=IDL&catid=16

you can find hastable and vector structures (implemented as objects).
Also at D.Fanning home page you can find a simple linked list and at
Craig Markwardt page
(http://cow.physics.wisc.edu/~craigm/idl/arrays.html) you can find
anohter implementation of hastable.
Remember the IDL_Container object (from IDL libraries) it is a kind of
list or container :) (only for object references).

I can't find any implementation of tree but with linkedlist/hashtables
it is easy to implement an N-ary tree.

Bye.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Data Structure in IDL
Next Topic: Re: Positions in 3-d

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

Current Time: Wed Oct 08 14:53:42 PDT 2025

Total time taken to generate the page: 0.00426 seconds