[Kstars-devel] Proposal for removal

Khudyakov Alexey alexey.skladnoy at gmail.com
Thu Jun 11 14:57:01 CEST 2009


On Четверг 11 июня 2009 16:34:32 Akarsh Simha wrote:
> Hi Alexey
>
> > One constructor in KSAsteriod class is broken. However it's not used.
> > Namely it's
> >
> >     /**Constructor.
> > 	*@note For use by KSPluto, which inherits from this class. Sets the
> > slope parameter to -1.
> >     	*@p s the name of the asteroid
> >     	*@p image_file the filename for an image of the asteroid
> >     	*@p JD the Julian Day for the orbital elements
> >     	*@p a the semi-major axis of the asteroid's orbit (AU)
> >     	*@p e the eccentricity of the asteroid's orbit
> >     	*@p i the inclination angle of the asteroid's orbit
> >     	*@p w the argument of the orbit's perihelion
> >     	*@p N the longitude of the orbit's ascending node
> >     	*@p M the mean anomaly for the Julian Day
> >     	*@p H absolute magnitude
> >     	*/
> >     KSAsteroid( const QString &s, const QString &image_file,
> >                 long double JD, double a, double e, dms i, dms w, dms N,
> > dms M, double H);
> >
> > I propose to remove it and force class user to make dubious assumptions
> > by themselves.
>
> I don't understand you here.
>
KSasteriod class has two constructors. 

First: 
>KSAsteroid( const QString &s, const QString &image_file,
>   long double JD, double a, double e, dms i, dms w, dms N, dms M, double H,
>   double G );

Second is same but set slope parameter to unsensible value (-1).
>KSAsteroid( const QString &s, const QString &image_file,
>   long double JD, double a, double e, dms i, dms w, dms N, dms M, double H)

It's implementation is broken. 
>KSAsteroid::KSAsteroid( ... )
>	: KSPlanetBase(s, imfile),
>      JD(_JD), a(_a), e(_e), i(_i), w(_w), M(_M), N(_Node), H(_H)
>{
>    KSAsteroid(s, imfile, _JD, _a, _e, _i, _w, _Node, _M, _H, -1);
Here it doesn't call another constructor. It's impossible. Instead it create 
temporary object and throw it away immediatly. Thus some fields in object 
aren't initialized.

It's marked for use in KSPluto but it's not used there. It isn't used 
anywhere. I think if someone do not know slope parameter it's better to force 
him to make some assuptions than to make them silently. 

Or default parameter [..., G = -1.0); ] could be added to working constructor. 
But I think that's not required. 


> > Another candidates for removal are getOrbinalElement methods in KSComet
> > and KSAsteriod classes.
> >     bool getOrbitalElements( long double *_JD, double *_a, double *_e,
> >                              dms *_i, dms *_w, dms *_N, dms *_M );
>
> Yes. I remember I wrote this thing as a workaround to be used in the
> copy constructor. Feel free to get rid of it.
>
And quite unneeded workaround since object of class Foo has full access to 
innards of other object of the same class. 


More information about the Kstars-devel mailing list