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

Home » Public Forums » archive » Re: making an object from class structure?
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: making an object from class structure? [message #23295] Wed, 17 January 2001 14:54
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
David Fanning wrote:
>
> For the simple reason that the SETPROPERTY method doesn't
> (in my experience, *ever*) allow you to set all the fields
> of the object.

If we already are so far as filling in the fields manually, we might as
well write code for it (call it HackProperty instead of SetProperty),
since even manual assignment requires typing. At least on my computer -
I can't yet talk to it (well, I do talk to it but it does not know all
the words that I use, and I hope it does not literally respond to some
of them).

Cheers,
Pavel
Re: making an object from class structure? [message #23297 is a reply to message #23295] Wed, 17 January 2001 14:47 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Pavel A. Romashkin (pavel.romashkin@noaa.gov) writes:

> I guess I am still a little confused.

Pavel, he is making his *own* save files. :-)

> If you are going to manually fill in values into future object's fields,
> why not get its definition from SAV and then use OBJ_NEW and SETPROPERTY
> to make a reference and fill it with data?

For the simple reason that the SETPROPERTY method doesn't
(in my experience, *ever*) allow you to set all the fields
of the object.

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
Re: making an object from class structure? [message #23298 is a reply to message #23297] Wed, 17 January 2001 14:23 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
I guess I am still a little confused.
If you are going to manually fill in values into future object's fields,
why not get its definition from SAV and then use OBJ_NEW and SETPROPERTY
to make a reference and fill it with data?

Cheers,
Pavel
Re: making an object from class structure? [message #23300 is a reply to message #23298] Wed, 17 January 2001 13:41 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
"Pavel A. Romashkin" <pavel.romashkin@noaa.gov> writes:
>
> ... Or are you looking for a way to get a
> *definition* from SAV, then re-fill it manually and assign it to an
> object reference?

Bingo.

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
Re: making an object from class structure? [message #23302 is a reply to message #23300] Wed, 17 January 2001 12:05 Go to previous message
Pavel A. Romashkin is currently offline  Pavel A. Romashkin
Messages: 531
Registered: November 2000
Senior Member
Craig Markwardt wrote:
>
> Hi object experts!
>
> I am a little stymied on an "internal" object question. In the course
> of restoring objects from a SAVE file, I can definitely restore the
> class *structure*. That is, I can read the structure definition, the
> super classes, etc and reconstruct a class structure filled with the
> correct data.
>
> My question is, how do I get an object "pointer" to it.

Hi Craig,

Isn't it the object *reference* that you get when you restore a saved
object? I could never get to object *structure* definition (which I use
for my lazy-sitting-place loop cleanup method) by using anything other
means than o_str = {My_obj}. Or are you looking for a way to get a
*definition* from SAV, then re-fill it manually and assign it to an
object reference?

Cheers,
Pavel
Re: making an object from class structure? [message #23315 is a reply to message #23302] Wed, 17 January 2001 07:32 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Craig Markwardt (craigmnet@cow.physics.wisc.edu) writes:

> Hi object experts!
>
> I am a little stymied on an "internal" object question. In the course
> of restoring objects from a SAVE file, I can definitely restore the
> class *structure*. That is, I can read the structure definition, the
> super classes, etc and reconstruct a class structure filled with the
> correct data.
>
> My question is, how do I get an object "pointer" to it. To be clear,
> the is the difference between S and O in the following code:
>
> s = {objtype, name:'a', value: 27}
> o = obj_new('objtype')
>
> IDL> help, s, o
> S STRUCT = -> OBJTYPE Array[1]
> O OBJREF = <ObjHeapVar3(OBJTYPE)>
>
> I have a structure like S, and want to make it into an object pointer
> like O, preserving the data inside S.
>
> Any ideas, or is this impossible?

Definitely impossible. :-)

I mean, maybe it's theoretically possible, given either INIT
or SETPROPERTY methods that configure *every* internal
field in the object structure. But I've never, ever written
an object that allows that, and I can't imagine the RSI-supplied
objects do it either.

Cheers,

David

P.S. Let's just say I'm not exactly renowned for my
programming imagination, so maybe there is still hope
from another source. :-)

--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: axis and titles
Next Topic: Re: 24 vs 8 bit color systems

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

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

Total time taken to generate the page: 0.40233 seconds