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

Home » Public Forums » archive » Re: Initializing object array
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: Initializing object array [message #38427 is a reply to message #38426] Mon, 08 March 2004 21:45 Go to previous messageGo to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Hi David,

"David Fanning" <david@dfanning.com> wrote in message
news:MPG.1ab6e521618e56ee9896f1@news.frii.com...
>
> I have an object. One of the fields of this objects
> is a object array. The field is called "contours":
>
> PRO myclass__define
> class = { MYCLASS, contours:Obj_New()}
> END
>
> Now, when I create the object, I want to pass an object
> array of ROI objects that I created somewhere else.
>
> FUNCTION myclass::INIT, Contours=contours
> self.contours = contours
> RETURN, 1
> END
>
> This doesn't work. Says contours must be a scalar
> in this context. Well!!! Shucks.
>
> Surely I have done this before. But I can't for the
> life of me remember how. How do I initialize a field
> as an object array?

class = { MYCLASS, contours:ObjArr(nElements)}

would do it, but it will be a fixed number of elements, and the passed
'contours' would have to match that. If that's what you need, then fine,
but I bet you need flexibility. All I can see for a solution right now
is using a pointer:

class = { MYCLASS, contours:Ptr_New(/Allocate_Heap)}

then, to assign it:
*self.contours = contours

and to refer to one contour:
(*self.contours)[i]

Sorry if I'm stating the obvious... or am *I* missing something?

Cheers,
--
-Dick

Dick Jackson / dick@d-jackson.com
D-Jackson Software Consulting / http://www.d-jackson.com
Calgary, Alberta, Canada / +1-403-242-7398 / Fax: 241-7392
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Assigning names to views and plots in iplot
Next Topic: Square Assignment Problem

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

Current Time: Sat Oct 11 12:54:18 PDT 2025

Total time taken to generate the page: 1.76228 seconds