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

Home » Public Forums » archive » Re: Object Method validity
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: Object Method validity [message #36206 is a reply to message #36200] Mon, 11 August 2003 15:08 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
Robert Moss wrote:
> Is there a way to verify the existance of a particular object method?
> Something like
>
> valid = Method_Valid( theObject, "HopedForMethod" )
>
> I guess. I've spent a little while rtfm-ing and googling to no avail.

I believe that the only generally valid approach is to call the method
and trap any errors with a CATCH statement. This has the advantage(??)
of actually calling the method and checking that your parameters are
valid. Something like this (Warning: I haven't checked it and haven't
generalised it to handled function-type methods)...

catch, err
if err ne 0 then begin
valid = 0B
goto, finished
endif
call_method, theObject, 'HopedForMethod', param0
valid = 1B
catch, /CANCEL
finished:

But be aware that if HopedForMethod is not bound to the class that
theObject belongs to, then IDL will spend a significant amount of time
searching the path for a file with the name

obj_class(theObject)+'__hopedformethod.pro'


--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Embedding colour IDL syntax in Word
Next Topic: Welcome to ITOOLS....

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

Current Time: Wed Oct 08 15:48:26 PDT 2025

Total time taken to generate the page: 0.00188 seconds