[Kst] kdeextragear-2/kst/kst/datasources/planck
George Staikos
staikos at kde.org
Wed Feb 4 13:48:30 CET 2004
CVS commit by staikos:
remove more dead code, make object reads very efficient (no data copies or
extra mallocs)
M +2 -4 planck.cpp 1.9
M +20 -13 plancktoi.cpp 1.7
M +1 -1 plancktoi.h 1.5
--- kdeextragear-2/kst/kst/datasources/planck/planck.cpp #1.8:1.9
@@ -27,7 +27,4 @@ PlanckSource::PlanckSource(const QString
: KstDataSource(filename, "PLANCK I/O") {
- // FIXME
- //_fieldList +=
-
_planckTOI = new Planck::TOI;
if (!_planckTOI->setGroup(filename)) {
@@ -36,4 +33,5 @@ PlanckSource::PlanckSource(const QString
if (_planckTOI && _planckTOI->isValid()) {
+ _fieldList = _planckTOI->fields();
update();
_valid = true;
@@ -49,7 +47,7 @@ KstObject::UpdateType PlanckSource::upda
Q_UNUSED(u)
// We have to update:
- // - group list - a group disappears
// - object list - an object disappears from a group being watched
// - ranges - range of an object in a group being watched is changed
+ // - new contents?
return KstObject::NO_CHANGE;
}
--- kdeextragear-2/kst/kst/datasources/planck/plancktoi.cpp #1.6:1.7
@@ -148,5 +148,5 @@ int TOI::readObject(const QString& objec
#ifdef KST_HAVE_PLANCK
if (isValid()) {
- const TOIGroup *g = findGroup(_group);
+ TOIGroup *g = findGroup(_group);
if (!g) {
return 0;
@@ -172,6 +172,11 @@ int TOI::readObject(const QString& objec
}
- void *data = 0;
- int n = PIOReadTOIObject(&data, g->objectNameList[i], const_cast<char*>("PIODOUBLE"), const_cast<char*>(range.latin1()), g->_group);
+ PIOObject *MyObject;
+ PIOParseData MyData;
+
+ long n = PIOReadTOI_1(g->objectNameList[i], const_cast<char*>(""),
+ const_cast<char*>("PIODOUBLE"),
+ const_cast<char*>(range.latin1()), &(g->_group),
+ &MyObject, &MyData, 0L);
#ifdef TOIDEBUG
kdDebug() << "READ " << n << " doubles." << endl;
@@ -183,18 +188,20 @@ int TOI::readObject(const QString& objec
return n;
}
-#ifdef TOIDEBUG
- kdDebug() << "Read " << n << " samples of data. Range = [" << range << "]" << endl;
-#endif
+
+ PIOReadTOI_2(buf, 0L, 0L, g->objectNameList[i],
+ const_cast<char*>("PIODOUBLE"),
+ const_cast<char*>(range.latin1()),
+ const_cast<char*>(""), g->_group, &MyObject, &MyData, 0L,
+ PIOLONG(n));
+
assert(buf);
- if (data && n > 0) {
#ifdef TOIDEBUG
+ kdDebug() << "Read " << n << " samples of data. Range = [" << range << "]" << endl;
+ if (n > 0) {
kdDebug() << "this = " << (void*)this << endl;
kdDebug() << "buf = " << (void*)buf << endl;
- kdDebug() << "data = " << (void*)data << endl;
-#endif
- memcpy(buf, data, n*sizeof(double)); // argh this is so expensive
- // free(data); The manual is wrong. Don't do this
}
- return n;
+#endif
+ return int(n);
}
#else
@@ -208,5 +215,5 @@ int TOI::readObject(const QString& objec
-const TOIGroup *TOI::findGroup(const QString& group) const {
+TOIGroup *TOI::findGroup(const QString& group) const {
if (_groupInfo.contains(group)) {
return _groupInfo[group];
--- kdeextragear-2/kst/kst/datasources/planck/plancktoi.h #1.4:1.5
@@ -47,5 +47,5 @@ class TOI : public Source {
// We lazy load the groups, hence mutable
mutable QMap<QString, TOIGroup*> _groupInfo;
- const TOIGroup *findGroup(const QString& group) const;
+ TOIGroup *findGroup(const QString& group) const;
};
More information about the Kst
mailing list