[Object IDL] routines that require user-supplied functions ... [message #12640] |
Tue, 11 August 1998 00:00 |
dEdmundson
Messages: 23 Registered: February 1998
|
Junior Member |
|
|
Here is a *demo* object-IDL code I wrote to illustrate a problem.
This object integrates x^n over the interval (a,b) using the
QROMB function. QROMB requires a user-defined function but I
cannot manage to pass the 'poly' method.
While this is a contrived example, one often wants to pass
object method functions/procedures to other IDL routines. Is
there a generic way of passing object methods to such intrinsic
routines?
Cheers,
Darran.
;;---------------------------------------------------------- ----------
;; save the following as test4__define.pro somewhere in your IDL path
;; uncomment one of the return statements in test4::integral
;; invoke the object with t = obj_new('test4',3.0,0.0,1.0)
function test4::init, degree, a, b
self.degree = degree
self.a = a
self.b = b
print, 'Integral = ', self->integral()
return, 0
end
function test4::integral
; try both of these ...
; return, qromb('test4::poly', self.a, self.b)
; return, qromb('self->poly', self.a, self.b)
end
function test4::poly,x
return, x^(self.degree)
end
pro test4__define
struct = {test4, degree:0.0, a:0.0, b:0.0}
end
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
|
|
|