[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Object Oriented programming question

In article <372074A1.3FD713D7@astro.estec.esa.nl>,
> Oh that's pretty simple (sorry I shouldn't say this ;-) - a good
> way to see how is the file lib/trackball__define.pro
> at definition of an object like trackball, the ::init method
> is called which may be defined in such a way that you can specify
> required and optional parameters - remember that you set the
> object using self.(whatever...)
> it is a very good (and probably the only) way to have all object
> related methods in one file like the above examples trackball_define.pro
> follow stricktly the order:
> a) first arbitrary methods specialized for this object only
> b) typical, more general methods (SetProperty, GetPro....
> c) the init method
> d) finally, the define method
> IDL does then the rest - if you need another example like
> creating a complete atom by a set of objects starting from
> simple spheres, mail me (only an example, not fully done)

There is no problem defining object methods each in their 
own files.  For larger objects with many methods, I prefer 
to put each method in its own file, and let IDL's automatic 
compilation do the rest.  Objects can be defined in the file 
"obj__define.pro", and methods in "obj__method1.pro", 
"obj__method2.pro", etc. 

The only thing to watch our for is under case-sensitive 
operating systems, you must name your files in all lower case, 
although within IDL you can use case.  For example, I might 
have the object method called "plotData", which would be placed 
in the file  "obj__plotdata.pro".  But for the implementation, 
I would typically write

    PRO obj::plotData

Robert S. Mallozzi                                       256-544-0887
                                                      Mail Code ES 84
Work: http://www.batse.msfc.nasa.gov/    Marshall Space Flight Center 
Play: http://cspar.uah.edu/~mallozzir/           Huntsville, AL 35812