Re: Saving / Restoring Objects [message #35040 is a reply to message #35031] |
Fri, 09 May 2003 06:33   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
mfeldt (mfeldt@mpia.de) writes:
> trying myself and surfing the web I find a lot of remarks how useful
> it is to save and restore idl objects. However, for me it doesn't
> seem to work - am I doing something wrong here? Basically what I do is
> this:
>
> IDL> a=obj_new('fancy_object')
> % Compiled module: FANCY_OBJECT__DEFINE.
> ;;
> ;; this compiled my object with lots of functions etc..
> ;;
> IDL> a-> set,'Debug',1 ; internal variable access...
> ;;
> ;; many more of those may go here
> ;;
> ;; then:
> IDL> save,a,file='test.sav'
>
> IDL> exit
>
> ;; now a new session
>
> IDL> restore, file='test.sav'
> IDL> help,a,/obj
> ** Object class FANCY_OBJECT, 0 direct superclasses, 0 known methods
>
> ;; i.e. the object seems to be there, but all information on it and
> all methods are lost... I also tried compiling the related code first,
> but no use...
>
> Is there any way to make this work??
I don't think the methods are "lost", they just haven't
yet made themselves known to IDL. (Although I would have
thought compiling the routines should have worked and would
be essential--you use Resolve_Routine, right?--to restore
the object properly) In any case, I would feel free to use
your restored object as normal and see what happens.
I guess whether the methods can be "found" will depend to
some extent on how you are naming the methods and the files
that contain them. But this SAVE/RESTORE method certainly
works for objects.
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|