Star.cpp   Star.cpp 
skipping to change at line 22 skipping to change at line 22
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include <QDebug>
#include <QString>
#include "Star.hpp" #include "Star.hpp"
#include "StarMgr.hpp" #include "StarMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
namespace BigStarCatalogExtension { #include <QDebug>
#include <QString>
QString Star1::getNameI18n(void) const { QString Star1::getNameI18n(void) const
if (hip) { {
const QString commonNameI18 = StarMgr::getCommonName(hip); if (hip)
if (!commonNameI18.isEmpty()) return commonNameI18; {
if (StarMgr::getFlagSciNames()) { const QString commonNameI18 = StarMgr::getCommonName(hip);
const QString sciName = StarMgr::getSciName(hip); if (!commonNameI18.isEmpty()) return commonNameI18;
if (!sciName.isEmpty()) return sciName; if (StarMgr::getFlagSciNames())
const QString varSciName = StarMgr::getGcvsName(hip); {
if (!varSciName.isEmpty() && varSciName!=sciName) return varSciName; const QString sciName = StarMgr::getSciName(hip);
return QString("HIP %1").arg(hip); if (!sciName.isEmpty()) return sciName;
} const QString varSciName = StarMgr::getGcvsName(hip)
} ;
return QString(); if (!varSciName.isEmpty() && varSciName!=sciName) re
} turn varSciName;
return QString("HIP %1").arg(hip);
int Star1::hasComponentID(void) const { }
if (componentIds) { }
return componentIds; return QString();
} }
return 0;
} int Star1::hasComponentID(void) const
{
static if (componentIds)
int UnpackBits(bool fromBe,const char *addr,int bits_begin, {
const int bits_size) { return componentIds;
Q_ASSERT(bits_size <= 32); }
while (bits_begin >= 8) { return 0;
bits_begin -= 8; }
addr++;
} static int UnpackBits(bool fromBe, const char *addr,int bits_begin, const i
const int bits_end = bits_begin + bits_size; nt bits_size)
int rval; {
if (fromBe) { Q_ASSERT(bits_size <= 32);
rval = (int)((( (( (((unsigned int)(unsigned char)(addr[0])) << 8) | while (bits_begin >= 8)
((unsigned int)(unsigned char)(addr[1]))) << 8) | {
((unsigned int)(unsigned char)(addr[2]))) << 8) | bits_begin -= 8;
((unsigned int)(unsigned char)(addr[3]))); addr++;
if (bits_end <= 32) { }
if (bits_begin > 0) rval <<= bits_begin; const int bits_end = bits_begin + bits_size;
} else { int rval;
rval <<= bits_begin; if (fromBe)
unsigned int rval_lo = (unsigned char)(addr[4]); {
rval_lo >>= (8-bits_begin); rval = (int)((( (( (((unsigned int)(unsigned char)(addr[0]))
rval |= rval_lo; << 8) |
} ((unsigned int)(unsigned char)(addr[1]))) << 8) |
if (bits_size < 32) rval >>= (32-bits_size); ((unsigned int)(unsigned char)(addr[2]))) << 8) |
} else { ((unsigned int)(unsigned char)(addr[3])));
rval = (int)((( (( (((unsigned int)(unsigned char)(addr[3])) << 8) | if (bits_end <= 32)
((unsigned int)(unsigned char)(addr[2]))) << 8) | {
((unsigned int)(unsigned char)(addr[1]))) << 8) | if (bits_begin > 0) rval <<= bits_begin;
((unsigned int)(unsigned char)(addr[0]))); }
if (bits_end <= 32) { else
if (bits_end < 32) rval <<= (32-bits_end); {
if (bits_size < 32) rval >>= (32-bits_size); rval <<= bits_begin;
} else { unsigned int rval_lo = (unsigned char)(addr[4]);
int rval_hi = addr[4]; rval_lo >>= (8-bits_begin);
rval_hi <<= (64-bits_end); rval |= rval_lo;
rval_hi >>= (32-bits_size); }
rval = ((unsigned int)rval) >> bits_begin; if (bits_size < 32) rval >>= (32-bits_size);
rval |= rval_hi; }
} else
} {
return rval; rval = (int)((( (( (((unsigned int)(unsigned char)(addr[3]))
} << 8) |
((unsigned int)(unsigned char)(addr[2]))) << 8) |
static ((unsigned int)(unsigned char)(addr[1]))) << 8) |
unsigned int UnpackUBits(bool fromBe,const char *addr,int bits_begin, ((unsigned int)(unsigned char)(addr[0])));
const int bits_size) { if (bits_end <= 32)
Q_ASSERT(bits_size <= 32); {
while (bits_begin >= 8) { if (bits_end < 32) rval <<= (32-bits_end);
bits_begin -= 8; if (bits_size < 32) rval >>= (32-bits_size);
addr++; }
} else
const int bits_end = bits_begin + bits_size; {
unsigned int rval; int rval_hi = addr[4];
if (fromBe) { rval_hi <<= (64-bits_end);
rval = (( (( (((unsigned int)(unsigned char)(addr[0])) << 8) | rval_hi >>= (32-bits_size);
((unsigned int)(unsigned char)(addr[1]))) << 8) | rval = ((unsigned int)rval) >> bits_begin;
((unsigned int)(unsigned char)(addr[2]))) << 8) | rval |= rval_hi;
((unsigned int)(unsigned char)(addr[3])); }
if (bits_end <= 32) { }
if (bits_begin > 0) rval <<= bits_begin; return rval;
} else { }
rval <<= bits_begin;
unsigned int rval_lo = (unsigned char)(addr[4]); static unsigned int UnpackUBits(bool fromBe,const char *addr,int bits_begin
rval_lo >>= (8-bits_begin); , const int bits_size)
rval |= rval_lo; {
} Q_ASSERT(bits_size <= 32);
if (bits_size < 32) rval >>= (32-bits_size); while (bits_begin >= 8)
} else { {
rval = (( (( (((unsigned int)(unsigned char)(addr[3])) << 8) | bits_begin -= 8;
((unsigned int)(unsigned char)(addr[2]))) << 8) | addr++;
((unsigned int)(unsigned char)(addr[1]))) << 8) | }
((unsigned int)(unsigned char)(addr[0])); const int bits_end = bits_begin + bits_size;
if (bits_end <= 32) { unsigned int rval;
if (bits_begin > 0) rval >>= bits_begin; if (fromBe)
} else { {
unsigned int rval_hi = (unsigned char)(addr[4]); rval = (( (( (((unsigned int)(unsigned char)(addr[0])) << 8
rval_hi <<= (32-bits_begin); ) |
rval = rval >> bits_begin; ((unsigned int)(unsigned char)(addr[1]))) << 8) |
rval |= rval_hi; ((unsigned int)(unsigned char)(addr[2]))) << 8) |
} ((unsigned int)(unsigned char)(addr[3]));
if (bits_size < 32) rval &= ((((unsigned int)1)<<bits_size)-1); if (bits_end <= 32)
} {
return rval; if (bits_begin > 0) rval <<= bits_begin;
} }
else
void Star1::repack(bool fromBe) { {
const int _hip = UnpackBits(fromBe,(const char*)this, 0,24); rval <<= bits_begin;
const unsigned int _cids = UnpackUBits(fromBe,(const char*)this,24, 8); unsigned int rval_lo = (unsigned char)(addr[4]);
const int _x0 = UnpackBits(fromBe,(const char*)this,32,32); rval_lo >>= (8-bits_begin);
const int _x1 = UnpackBits(fromBe,(const char*)this,64,32); rval |= rval_lo;
const unsigned int _bV = UnpackUBits(fromBe,(const char*)this, 96, 8); }
const unsigned int _mag = UnpackUBits(fromBe,(const char*)this,104, 8); if (bits_size < 32) rval >>= (32-bits_size);
const unsigned int _spInt = UnpackUBits(fromBe,(const char*)this,112,16); }
const int _dx0 = UnpackBits(fromBe,(const char*)this,128,32); else
const int _dx1 = UnpackBits(fromBe,(const char*)this,160,32); {
const int _plx = UnpackBits(fromBe,(const char*)this,192,32); rval = (( (( (((unsigned int)(unsigned char)(addr[3])) << 8
//Q_ASSERT(hip == _hip); ) |
//Q_ASSERT(componentIds == _cids); ((unsigned int)(unsigned char)(addr[2]))) << 8) |
//Q_ASSERT(x0 == _x0); ((unsigned int)(unsigned char)(addr[1]))) << 8) |
//Q_ASSERT(x1 == _x1); ((unsigned int)(unsigned char)(addr[0]));
//Q_ASSERT(bV == _bV); if (bits_end <= 32)
//Q_ASSERT(mag == _mag); {
//Q_ASSERT(spInt == _spInt); if (bits_begin > 0) rval >>= bits_begin;
//Q_ASSERT(dx0 == _dx0); }
//Q_ASSERT(dx1 == _dx1); else
//Q_ASSERT(plx == _plx); {
hip = _hip; unsigned int rval_hi = (unsigned char)(addr[4]);
componentIds = _cids; rval_hi <<= (32-bits_begin);
x0 = _x0; rval = rval >> bits_begin;
x1 = _x1; rval |= rval_hi;
bV = _bV; }
mag = _mag; if (bits_size < 32) rval &= ((((unsigned int)1)<<bits_size)-
spInt = _spInt; 1);
dx0 = _dx0; }
dx1 = _dx1; return rval;
plx = _plx; }
}
void Star1::repack(bool fromBe)
void Star1::print(void) { {
qDebug() << "hip: " << hip const int _hip = UnpackBits(fromBe,(const char*)this, 0,24);
<< ", componentIds: " << ((unsigned int)componentIds) const unsigned int _cids = UnpackUBits(fromBe,(const char*)this,24,
<< ", x0: " << x0 8);
<< ", x1: " << x1 const int _x0 = UnpackBits(fromBe,(const char*)this,32,32);
<< ", bV: " << ((unsigned int)bV) const int _x1 = UnpackBits(fromBe,(const char*)this,64,32);
<< ", mag: " << ((unsigned int)mag) const unsigned int _bV = UnpackUBits(fromBe,(const char*)this, 96, 8
<< ", spInt: " << spInt );
<< ", dx0: " << dx0 const unsigned int _mag = UnpackUBits(fromBe,(const char*)this,104,
<< ", dx1: " << dx1 8);
<< ", plx: " << plx; const unsigned int _spInt = UnpackUBits(fromBe,(const char*)this,112
} ,16);
const int _dx0 = UnpackBits(fromBe,(const char*)this,128,32);
void Star2::repack(bool fromBe) { const int _dx1 = UnpackBits(fromBe,(const char*)this,160,32);
const int _x0 = UnpackBits(fromBe,(const char*)this, 0,20); const int _plx = UnpackBits(fromBe,(const char*)this,192,32);
const int _x1 = UnpackBits(fromBe,(const char*)this,20,20); //Q_ASSERT(hip == _hip);
const int _dx0 = UnpackBits(fromBe,(const char*)this,40,14); //Q_ASSERT(componentIds == _cids);
const int _dx1 = UnpackBits(fromBe,(const char*)this,54,14); //Q_ASSERT(x0 == _x0);
const unsigned int _bV = UnpackUBits(fromBe,(const char*)this,68, 7); //Q_ASSERT(x1 == _x1);
const unsigned int _mag = UnpackUBits(fromBe,(const char*)this,75, 5); //Q_ASSERT(bV == _bV);
//Q_ASSERT(x0 == _x0); //Q_ASSERT(mag == _mag);
//Q_ASSERT(x1 == _x1); //Q_ASSERT(spInt == _spInt);
//Q_ASSERT(dx0 == _dx0); //Q_ASSERT(dx0 == _dx0);
//Q_ASSERT(dx1 == _dx1); //Q_ASSERT(dx1 == _dx1);
//Q_ASSERT(bV == _bV); //Q_ASSERT(plx == _plx);
//Q_ASSERT(mag == _mag); hip = _hip;
x0 = _x0; componentIds = _cids;
x1 = _x1; x0 = _x0;
dx0 = _dx0; x1 = _x1;
dx1 = _dx1; bV = _bV;
bV = _bV; mag = _mag;
mag = _mag; spInt = _spInt;
} dx0 = _dx0;
dx1 = _dx1;
void Star2::print(void) { plx = _plx;
qDebug() << "x0: " << x0 }
<< ", x1: " << x1
<< ", dx0: " << dx0 void Star1::print(void)
<< ", dx1: " << dx1 {
<< ", bV: " << bV qDebug() << "hip: " << hip
<< ", mag: " << mag; << ", componentIds: " << ((unsigned int)componentIds)
} << ", x0: " << x0
<< ", x1: " << x1
void Star3::repack(bool fromBe) { << ", bV: " << ((unsigned int)bV)
const int _x0 = UnpackBits(fromBe,(const char*)this, 0,18); << ", mag: " << ((unsigned int)mag)
const int _x1 = UnpackBits(fromBe,(const char*)this,18,18); << ", spInt: " << spInt
const unsigned int _bV = UnpackUBits(fromBe,(const char*)this,36, 7); << ", dx0: " << dx0
const unsigned int _mag = UnpackUBits(fromBe,(const char*)this,43, 5); << ", dx1: " << dx1
//Q_ASSERT(x0 == _x0); << ", plx: " << plx;
//Q_ASSERT(x1 == _x1); }
//Q_ASSERT(bV == _bV);
//Q_ASSERT(mag == _mag); void Star2::repack(bool fromBe)
x0 = _x0; {
x1 = _x1; const int _x0 = UnpackBits(fromBe,(const char*)this, 0,20);
bV = _bV; const int _x1 = UnpackBits(fromBe,(const char*)this,20,20);
mag = _mag; const int _dx0 = UnpackBits(fromBe,(const char*)this,40,14);
} const int _dx1 = UnpackBits(fromBe,(const char*)this,54,14);
const unsigned int _bV = UnpackUBits(fromBe,(const char*)this,68, 7)
void Star3::print(void) { ;
qDebug() << "x0: " << x0 const unsigned int _mag = UnpackUBits(fromBe,(const char*)this,75, 5
<< ", x1: " << x1 );
<< ", bV: " << bV //Q_ASSERT(x0 == _x0);
<< ", mag: " << mag; //Q_ASSERT(x1 == _x1);
//Q_ASSERT(dx0 == _dx0);
//Q_ASSERT(dx1 == _dx1);
//Q_ASSERT(bV == _bV);
//Q_ASSERT(mag == _mag);
x0 = _x0;
x1 = _x1;
dx0 = _dx0;
dx1 = _dx1;
bV = _bV;
mag = _mag;
}
void Star2::print(void)
{
qDebug() << "x0: " << x0
<< ", x1: " << x1
<< ", dx0: " << dx0
<< ", dx1: " << dx1
<< ", bV: " << bV
<< ", mag: " << mag;
}
void Star3::repack(bool fromBe)
{
const int _x0 = UnpackBits(fromBe,(const char*)this, 0,18);
const int _x1 = UnpackBits(fromBe,(const char*)this,18,18);
const unsigned int _bV = UnpackUBits(fromBe,(const char*)this,36, 7)
;
const unsigned int _mag = UnpackUBits(fromBe,(const char*)this,43, 5
);
//Q_ASSERT(x0 == _x0);
//Q_ASSERT(x1 == _x1);
//Q_ASSERT(bV == _bV);
//Q_ASSERT(mag == _mag);
x0 = _x0;
x1 = _x1;
bV = _bV;
mag = _mag;
}
void Star3::print(void)
{
qDebug() << "x0: " << x0
<< ", x1: " << x1
<< ", bV: " << bV
<< ", mag: " << mag;
} }
} // namespace BigStarCatalogExtension
 End of changes. 4 change blocks. 
207 lines changed or deleted 251 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/