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

Home » Public Forums » archive » Problems with Restore
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: Problems with Restore [message #47990 is a reply to message #47868] Thu, 09 March 2006 01:02 Go to previous message
Antonio Santiago is currently offline  Antonio Santiago
Messages: 201
Registered: February 2004
Senior Member
Here is a partial response of your (our) problem, when you restoring the
file, both 'self' and 'temp' references are the same, that is the 'self'
reference changes.


------ Object code test --------
FUNCTION OperatorLanguageMapping::Init
RETURN, 1
END


PRO OperatorLanguageMapping::Restore, fileName
print, 'Restoring'
print, 'Before:'
help, self ;; <----- Here is a reference

restore, fileName, RESTORED_OBJECTS = temp
print, 'After:'
help, self, temp[0] ;; <----- Here 'self' reference has changed
self.password = temp[0]->GetPassword()
END

PRO OperatorLanguageMapping::Save, fileName
save, self, FILENAME=fileName
END


PRO OperatorLanguageMapping::SetPassword, pass
self.password = pass
END


FUNCTION OperatorLanguageMapping::GetPassword
RETURN, self.password
END


PRO OperatorLanguageMapping__define;
objectClass = { OperatorLanguageMapping, $
password : '' $ ; holds the password
}
END
------ Object code test --------

------ Test program --------
PRO optest
o1 = obj_new("OperatorLanguageMapping")
o1->SetPassword, '123456'
o1->Save, '~/o1.sav'


o1->SetPassword, 'test'

o1->Restore, '~/o1.sav'

print, o1->GetPassword()
END
------ Test program --------


A possible solution maybe store the 'self' reference into a variable and
after restoring the file reassign it:

PRO OperatorLanguageMapping::Restore, fileName
print, 'Restoring'
print, 'Before:'
help, self

a=self ;; <--- Store 'self' reference'
self=0 ;; <--- Changue it to a scaler, if not, a=self=temp.
restore, fileName, RESTORED_OBJECTS = temp
print, 'After:'
help, self, temp[0]

self=a ;; <---- Re-assing the initial reference.
self.password = temp[0]->GetPassword()
END


Bye.

--
-----------------------------------------------------
Antonio Santiago P�rez
( email: santiago<<at>>grahi.upc.edu )
( www: http://www.grahi.upc.edu/santiago )
( www: http://asantiago.blogsite.org )
-----------------------------------------------------
GRAHI - Grup de Recerca Aplicada en Hidrometeorologia
Universitat Polit�cnica de Catalunya
-----------------------------------------------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: matching 2 grids
Next Topic: Re: Name Space Conflicts

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

Current Time: Sun Oct 12 05:03:53 PDT 2025

Total time taken to generate the page: 1.60060 seconds