Re: How far is OO implemented in IDL? [message #26503 is a reply to message #26501] |
Wed, 05 September 2001 05:54   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Olaf Stetzer (olaf.stetzer@imk.fzk.de) writes:
> I know that Object Oriented Programming is supported
> in IDL but I wonder how far this concept is supported?
Almost never as far as you would have hoped if
you know much about real object-oriented programming.
Remember, objects were graphed onto a language
that was nearly 20 years old at the time.
> I am thinking of operator overloading in special. My
> Idea is the following:
>
> There exists a struct called something like SQL-Timestamp.
> This struct holds int's/longint's for year, month, day,
> hour, minute, second, fraction, to hold a comlete date/time.
>
> If I make an object out of this struct and define the
> operators + and - it should be possible to add or substract
> seconds or days to/from a date stored in this struct. The
> functions are then hidden inside the object, I simply use
> the operators + and - for the operations. In C++ this would
> be possible, even for different kinds of variables but I don't
> know if this is possible in IDL too!
It is a good idea, but operator overloading in IDL
is not going to work like operator overloading in
C, that's for sure. You could add ADD and SUBTRACT
methods to your IDL object to do what you like, but
you will have to leave the actual meaning of operators
in IDL alone.
>
> My second thought would be the following: If I access a database
> with dataminer, fields of type DATETIME or TIMESTAMP are returned
> as the mentioned struct SQL-Timestamp which is defined by the system.
> Would it be possible to replace this struct by the aforementioned
> object?
I doubt it, but I don't know much about DataMiner. It would
be easy enough to write a method for the object that would
copy the structure into it, but whether it is worth it to you
depends on what plans you have for the object.
> So, this would be the most elegant way to provide more funcionality
> to date/time-handling for database access. In practise however I
> think that using the existing functions for date/time-conversion
> (I mean the functions in the JHU/APL/S1R IDL libraries)
> added by some functions for converting sqltimestamp to/from Julian
> Seconds (which I am currently writing) is the easier and faster
> approach...
>
> What do you think?
I think the latter method will work admirably for you. :-)
Cheers,
David
--
David W. Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|