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

Home » Public Forums » archive » Re: defining a data structure
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: defining a data structure [message #54473 is a reply to message #54472] Wed, 13 June 2007 11:33 Go to previous message
jkj is currently offline  jkj
Messages: 48
Registered: April 2007
Member
On Jun 13, 11:58 am, Ingo von Borstel <newsgro...@planetmaker.de>
wrote:
> Hello there,
>
> I'm just starting to dive into IDL objects. As objects are based upon a
> certain struct, I need to define them beforehand. Unfortunately I fail
> to figure out how to put a structure definition into a file such that it
> is automatically found when calling the corresponding object creation
> routine.
>
> Could anyone please point me out how the myobjectstruct__define.pro has
> to look like in order for it being recognized? Just putting in the
> structure's definition doesn't work as well as writing the whole thing
> as a procedure or function.
>
> Best regards,
> Ingo
> --
> Ingo von Borstel <newsgro...@planetmaker.de>
> Public Key:http://www.planetmaker.de/ingo.asc
>
> If you need an urgent reply, replace newsgroups by vgap.


my_struct__define.pro

...and inside that file at least these:

function my_struct::init

self.number = 14
self.array = indgen(3) * 2

return, 1
end

pro my_struct__define
struct_define = { $
my_struct, $
number:0, $
array:intarr(3) $
}
end


...and now I can create an instance of my object:

test = obj_new('my_struct')

Does that help? From there you can make the structure more complicated
and add methods to call, such as "add":

function my_struct::add
return, self.number + self.array
end

...so the call
sum = test->add()
is now valid.

-Kevin
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Dealing with Large data arrays, reducing memory and ASSOC
Next Topic: Re: large widget_trees

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

Current Time: Sun Nov 30 00:25:59 PST 2025

Total time taken to generate the page: 0.16217 seconds