[Kst] extragear/graphics/kst/kst/datasources/cdf
Nicolas Brisset
nicolas.brisset at eurocopter.com
Tue Nov 8 10:52:06 CET 2005
SVN commit 478898 by brisset:
Make less verbose; replace kdDebug() with kstdDebug()
M +11 -19 cdf.cpp
--- trunk/extragear/graphics/kst/kst/datasources/cdf/cdf.cpp #478897:478898
@@ -19,7 +19,7 @@
#include <cdf.h>
#include "cdfdefs.h" // Macros to handle rVars and zVars transparently
-#include <kdebug.h>
+#include <ksdebug.h>
#include <qfile.h>
#include <qfileinfo.h>
@@ -45,6 +45,7 @@
bool CdfSource::reset() {
+ // kstdDebug() << "Calling reset() for " << _filename << endl;
_maxFrameCount = 0;
_fieldList.clear();
return _valid = initFile();
@@ -52,16 +53,14 @@
bool CdfSource::initFile() {
- kdDebug() << _filename << ": entering initFile()" << endl;
CDFid id;
CDFstatus status = CDFopen(_filename.latin1(), &id);
if (status < CDF_OK) {
- kdDebug() << _filename << ": failed to open in initFile()" << endl;
+ kstdDebug() << _filename << ": failed to open in initFile()" << endl;
return false;
}
// Query field list and store it in _fieldList (plus "INDEX")
- kdDebug() << _filename << ": building field list" << endl;
_fieldList.clear();
//_fieldList += "INDEX"; commented out as it leads to problems in countFrames():
// which value should the method return when not all variables have the same length ?
@@ -96,10 +95,8 @@
_fieldList += varName;
}
}
- kdDebug() << _filename << ": variables found: " << _fieldList.count() << endl;
// Count frames for all fields and store the result in _frameCounts
- kdDebug() << _filename << ": counting frames " << endl;
long maxRec;
bool isZvar = true;
for (QStringList::Iterator it = _fieldList.begin(); it != _fieldList.end(); ++it ) {
@@ -113,7 +110,7 @@
}
if (status < CDF_OK) { // No such var in the file, I know this is not supposed to happen but... :-)
CDFclose(id);
- kdDebug() << _filename << ": critical problem with" << ftmp << endl;
+ kstdDebug() << _filename << ": critical problem with" << ftmp << endl;
return false;
}
// If we've come so far, it means the var exists and we know whether it is a Zvar
@@ -148,8 +145,7 @@
long maxRec; /* max number of values for this var */
char varName[CDF_VAR_NAME_LEN+1];
bool isZvar = true; /* Should be the case for recent cdf files */
- // Allocate an arbitrary (large) size
- kdDebug() << "Entering CdfSource::readField with params: " << field << ", from " << s << " for " << n << " values" << endl;
+ // kstdDebug() << "Entering CdfSource::readField with params: " << field << ", from " << s << " for " << n << " values" << endl;
// Handle the special case where we query INDEX
if (field.lower() == "index") {
@@ -166,24 +162,23 @@
// If not INDEX, look into the CDF file...
status = CDFopen(_filename.latin1(), &id);
if (status < CDF_OK) {
- kdDebug() << _filename << ": failed to open to read from field " << field << endl;
+ kstdDebug() << _filename << ": failed to open to read from field " << field << endl;
return -1;
}
- kdDebug() << _filename << " opened." << endl;
QString ftmp = field;
ftmp.truncate(CDF_VAR_NAME_LEN);
// Variable selection
strcpy(varName, ftmp.latin1());
status = CDFlib(SELECT_, zVAR_NAME_, varName, GET_, zVAR_DATATYPE_, &dataType, NULL_);
if (status < CDF_OK) { // if not zVar, try rVar
- kdDebug() << ftmp << ": " << " not a zVAR (" << status <<")" << endl;
+ kstdDebug() << ftmp << ": " << " not a zVAR (" << status <<")" << endl;
isZvar = false;
status = CDFlib(SELECT_, rVAR_NAME_, varName, GET_, rVAR_DATATYPE_, &dataType, NULL_);
}
// I suppose the returned int is the number of values read, <0 when there is a problem
if (status < CDF_OK) {
- kdDebug() << ftmp << ": " << " not a rVAR either -> exiting" << endl;
+ kstdDebug() << ftmp << ": " << " not a rVAR either -> exiting" << endl;
CDFclose(id);
return -1;
}
@@ -199,7 +194,6 @@
void *binary = malloc(sizeof(long double)); // FIXME: put this on the stack
- kdDebug() << "Starting to read " << n << " value(s)... from " << s << " to " << s+n << " and less than " << maxRec << endl;
for (i = s; i < s+n && i < maxRec; i++) {
status = CDFlib (SELECT_,
BOO(isZvar, zVAR_RECNUMBER_, rVAR_SEQPOS_), (long) i,
@@ -231,11 +225,10 @@
break;
}
// Uncomment following to see that it DOES read the values successfully
- //kdDebug() << field << "[" << i << "]=" << v[i] << endl;
+ //kstdDebug() << field << "[" << i << "]=" << v[i] << endl;
}
free(binary);
- kdDebug() << "Finished reading " << field << endl;
status = CDFclose(id);
@@ -302,12 +295,11 @@
QFileInfo fInfo(f);
if (!f.open(IO_ReadOnly)) {
- kdDebug() << "Unable to read file !" << endl;
+ kstdDebug() << "Unable to read file !" << endl;
return 0;
}
if (fInfo.extension(false) != "cdf") {
- kdDebug() << "Wrong extension for CDF reader !" << endl;
return 0;
}
@@ -318,7 +310,7 @@
CDFstatus status;
status = CDFopen (fInfo.baseName(true).latin1(), &id);
if (status < CDF_OK) {
- kdDebug() << "CDFlib unable to read the file !" << endl;
+ kstdDebug() << "CDFlib unable to read the file !" << endl;
return false;
}
else {
More information about the Kst
mailing list