function data::init ;-- allocate memory to pointer when initializing object self.ptr=ptr_new(/all) message,'here...',/cont return,1 end pro data::cleanup message,'here...',/cont return & end ;---------------------------------------------------------------- pro data::set,data ;-- if data exists, then insert into pointer location if n_elements(data) ne 0 then *(self.ptr)=data return end ;---------------------------------------------------------------- function data::get,data ;-- if data is stored in object pointer, then copy it out if n_elements(*(self.ptr)) ne 0 then data=*(self.ptr) return,data end ;------------------------------------------------------------------ pro data::read,file check=findfile(file,count=count) ;-- check if file exists if count ne 1 then return ;-- bail if not there data=fltarr(512,512) ;-- assume a 512x512 data file openr,lun,file,/get_lun ;-- open file readf,lun,data ;-- read data free_lun,lun ;-- close file self->set,data ;-- insert data into object return end ;--------------------------------------------------------------------- pro data::plot data=self->get() ;-- extract data from object dsize=size(data) if dsize[0] eq 2 then tvscl,congrid(data,512,512) ;-- if data is 2-dimensional, TVSCL it return end ;--------------------------------------------------------------------- pro data__define void={data,ptr:ptr_new()} return end