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

Home » Public Forums » archive » how to get info on object fields
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
how to get info on object fields [message #9782] Mon, 25 August 1997 00:00 Go to previous message
Mirko Vukovic is currently offline  Mirko Vukovic
Messages: 124
Registered: January 1996
Senior Member
Hi,

I was trying to write a general extraction routine for objects. The
idea was to pass the name of a field, it would check if the field
exists, get its tag number and extract it. It would work on the object
as if it were a structure. But TAG_NAMES does not work on objects
(which does make sense as SELF is still an object (type =11), not a
structure). (see code below for my implementation).

I like using objects, but sometimes they are too cumbersome for
debugging purposes. I would also like to have a set of general routines
applicable to all objects (via inheritance). That is why a general
routine for extracting a field would be nice. Any clues how I might go
about it?

FUNCTION structured::extract,arg,depointer = depointer

; check if arg is a valid field name
ii = where(tag_names(self) EQ strupcase(arg),count)
IF count NE 0 THEN begin
type = size(self.(ii))
type = type[type[0]+1]
IF keyword_set(depointer) THEN if type EQ 10 THEN
return,*self.(ii)
return,self.(ii)
ENDIF ELSE BEGIN
message,/info,'Invalid field name provided'
print,'You specified'+arg
print,'Available fields are:'
print,tag_names(self)
return,0
ENDELSE


--
Mirko Vukovic, Ph.D 3075 Hansen Way M/S K-109
Novellus Systems Palo Alto, CA, 94304
415/424-4969 mirko.vukovic@varian.grc.com
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: is it possible to pass named variables through _extra
Next Topic: Re: IDL5 and NT and Alpha

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

Current Time: Sun Nov 30 18:40:29 PST 2025

Total time taken to generate the page: 0.56367 seconds