The object classes that are included with IDL are normally very well documented which helps greatly when using IDL object classes in your code. I often get IDL object-based code from colleagues, and documentation is not always included. When this happens I use this example code to quickly investigate the methods and superclasses associated with the object classes.
This code example outputs an HTML table with the information for the given object class.
; Prints out information about an object class
pro ab_obj_info, obj, noresolve=noresolve, short=short, super=ksuper, $
out_super=super, quiet=quiet
compile_opt idl2
; find all superclasses
if (size(obj, /type) eq 7) then class=obj else class=obj_class(obj)
super=strupcase(class)
if ~keyword_set(noresolve) then resolve_all, class=super[0], /quiet, /cont
x=0
y=1
repeat begin
for i=x,y-1 do begin
sup=obj_class(super[i],/superclass)
if (sup[0] ne '') then super=[super,sup]
endfor
x=y
y=n_elements(super)
endrep until (x eq y)
if ~keyword_set(quiet) then print, 'Class: '+super[0]
if (y gt 1) && ~keyword_set(quiet) then begin
print, 'Superclass: '+super[1:*], format='(a)'
endif
if keyword_set(ksuper) then return
;
print, '<table>'
print, '<thead><td>Class::Method</td><td>Arguments</td><td>Keyword</td></thead>'
out = list()
func = routine_info(/function)
sysfunc = routine_info(/function, /system)
proc = routine_info()
sysproc = routine_info(/system)
for i=0,y-1 do begin
ind = where(func.StartsWith(super[i]+'::'),fcount)
for j=0,fcount-1 do begin
f = func[ind[j]]
param = routine_info(f, /param, /func)
print, '<tr>'
print, '<td>'+f+'()</td>'
if param.num_args gt 1 then begin
str = strjoin(param.args[1:*],',')
endif else str = ''
print, '<td>'+str+'</td>'
if param.num_kw_args gt 0 then begin
str = strjoin(param.kw_args,',')
endif else str = ''
print, '<td>'+str+'</td></tr>'
endfor
ind = where(sysfunc.StartsWith(super[i]+'::'), fcount)
for j=0,fcount-1 do begin
f = sysfunc[ind[j]]
print, '<tr><td>'+f+'</td><td></td><td></td></tr>'
endfor
ind = where(proc.StartsWith(super[i]+'::'),fcount)
for j=0,fcount-1 do begin
p = proc[ind[j]]
param = routine_info(p, /param)
print, '<tr>'
print, '<td>'+p+'()</td>'
if param.num_args gt 1 then begin
str = strjoin(param.args[1:*],',')
endif else str = ''
print, '<td>'+str+'</td>'
if param.num_kw_args gt 0 then begin
str = strjoin(param.kw_args,',')
endif else str = ''
print, '<td>'+str+'</td></tr>'
endfor
ind = where(sysproc.StartsWith(super[i]+'::'), fcount)
for j=0,fcount-1 do begin
p = sysproc[ind[j]]
print, '<tr><td>'+p+'</td><td></td><td></td></tr>'
endfor
endfor
print, '</table>'
end
Here I run the code on the IDLgrColorbar class, which is already well documented, but is a convenient example:
Here is the output HTML table showing all the methods associated with the IDLgrColorbar class.