[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: making an object from class structure?



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