[Kstars-devel] Binary star data loading accomplished in Branch!
James Bowlin
bowlin at mindspring.com
Mon Jun 2 23:10:36 CEST 2008
On Mon June 2 2008, Akarsh Simha wrote:
> James, my major problem with doing the memcpy() is that QString s are
> created in the constructor. Now, a QString must definitely do an
> malloc() somewhere, to allocate memory for the string, which means
> that there's a pointer involved. A memcpy() could simply duplicate
> that pointer! Any solutions to that?
For the unnamed stars we *want* the pointer to be copied. When we
construct the template unnamed StarObject, it has pointers to the
translation of "star". All the unnamed stars should have these same
pointers.
For the named stars, the init() routines I suggested previously should
take care of the name pointers. In the email I sent called "The Key
Issue", I had given this pseudo-code:
StarObject::loadData(StarData *d) {
double RA = scale[0] * double(d->RA);
double Dec = scale[1] * double(d->Dec);
...
SkyPoint::init(RA, Dec);
SkyObject::init( x, y, z, whatever);
update();
}
I believe the SkyObject::init(..) routine could deal with setting the
names. There should probably be a named and an unnamed version of
SkyObject::init() since the name pointers for the unnamed stars should
have been taken care of by the memcpy().
--
Peace, James
More information about the Kstars-devel
mailing list