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

Home » Public Forums » archive » Re: Objects, File Names, and the Save command.
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: Objects, File Names, and the Save command. [message #12263 is a reply to message #12257] Thu, 23 July 1998 00:00 Go to previous messageGo to previous message
J.D. Smith is currently offline  J.D. Smith
Messages: 214
Registered: August 1996
Senior Member
David Fanning wrote:
>
> J.D. Smith (jdsmith@astrosun.tn.cornell.edu) writes:
>
>> I am exploring a very promising use of the save/restore commands in
>> conjuction with objects. Given some complex object which contains a
>> host of different types of data (with pointers, etc.), as part of a
>> class method, one adds:
>>
>> save, self, FILENAME=fname
>>
>> to register on disk an accurate snapshot of the object. To restore,
>> later, use:
>>
>> restore,pname,RESTORED_OBJECTS=obj,/RELAXED_STRUCTURE_ASSIGN MENT
>>
>> and the object is in obj, but also brought back as the local variable
>> *self*.
>
>> [cut...]
>
>> This is all very convenient but leads to the strange situation of a
>> loaded object in memory which exists there *before* any of the class
>> methods, and/or the __define procedure for that object class are
>> compiled. Therefore, the usual paradigm of putting all class methods in
>> the __define procedure file before this procedure (suggested by RSI
>> itself in the manual) fails. How can the method be found if the
>> __define doesn't have to be compiled and isn't in it's own file? I
>> would like to come up with a solution which doesn't involve a separate
>> class__method.pro file for each method. Any ideas?
>
> How about something like this:
>
> thisClass = Obj_Class(self)
> Resolve_Routine, thisClass + '_define'
>
> I haven't tested this, but don't see any reason it wouldn't work.
> Resolve_Routine is the way IDL procedures and functions can
> be compiled from *within* other procedures and functions.
>

David,

This will certainly work, but has the unfortunate side-effect of
re-compiling every method each time an object is read from disk... I
thought of modifying it slightly to the tune of:

thisdef=Obj_Class(self)+'__DEFINE'
if (where(routine_info() eq thisdef))[0] eq -1 then
resolve_routine,thisdef

So that it would only compile if presently undefined.

Thanks for the tip.

JD

--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: problems with plot_2d
Next Topic: Re: IDL in 32 bpp ?

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

Current Time: Thu Oct 09 21:03:04 PDT 2025

Total time taken to generate the page: 0.64285 seconds