[Kst] kdeextragear-2/kst/kst/datasources/cdf

George Staikos staikos at kde.org
Wed Dec 8 07:01:13 CET 2004


CVS commit by staikos: 

that was not supposed to be committed


  M +16 -13    cdf.cpp   1.15


--- kdeextragear-2/kst/kst/datasources/cdf/cdf.cpp  #1.14:1.15
@@ -16,7 +16,7 @@
  ***************************************************************************/
 
-#include "cdf.h" // Local header for the kst CDF datasource
-#include <cdf.h> // Main CDF header (not sure it is a good idea for it to have the same name as the local one, but that one should not be changed as it's the official CDF distribution !)
-#include <cdfdist.h> // Macros to handle rVars and zVars transparently
+#include "cdf_source.h" // Local header for the kst CDF datasource
+#include <cdf.h>
+#include "cdfdefs.h" // Macros to handle rVars and zVars transparently
 
 #include <kdebug.h>
@@ -28,6 +28,6 @@
 #include <stdlib.h>
 
-CdfSource::CdfSource(const QString& filename, const QString& type)
-  : KstDataSource(filename, type) {
+CdfSource::CdfSource(KConfig *cfg, const QString& filename, const QString& type)
+: KstDataSource(cfg, filename, type) {
     if (!type.isEmpty() && type != "CDF") {
       return;
@@ -127,5 +127,4 @@ int CdfSource::readField(double *v, cons
   CDFstatus status;
   CDFid id;
-  double time_conversion = 1.0;
   long dataType;          /* CDF data type */
   long maxRec;            /* max number of values for this var */
@@ -137,5 +136,9 @@ int CdfSource::readField(double *v, cons
   // Handle the special case where we query INDEX
   if (field.lower() == "index") {
-    for (i = 0; i < n; i++) {
+    if (n < 0) {
+      v[0] = double(s);
+      return 1;
+    }
+    for (int i = 0; i < n; ++i) {
       v[i] = double(s + i);
     }
@@ -153,5 +156,4 @@ int CdfSource::readField(double *v, cons
   QString ftmp = field;
   ftmp.truncate(CDF_VAR_NAME_LEN);
-  if (ftmp.contains("_CYCLE") > 0) time_conversion = 0.00199997;
   // Variable selection
   strcpy(varName, ftmp.latin1());
@@ -211,6 +213,4 @@ int CdfSource::readField(double *v, cons
         break;
     }
-    // Hack for DLR's CDF files so that cycle times appear in s not cycle numbers
-    v[i-s] = v[i-s] * time_conversion;
     // Uncomment following to see that it DOES read the values successfully
     //kdDebug() << field << "[" << i << "]=" << v[i] << endl;
@@ -255,4 +255,5 @@ QString CdfSource::fileType() const {
 
 void CdfSource::save(QTextStream &ts, const QString& indent) {
+  // FIXME (copied from ascii.cpp !)
   KstDataSource::save(ts, indent);
 }
@@ -265,6 +266,6 @@ bool CdfSource::isEmpty() const {
 
 extern "C" {
-KstDataSource *create_cdf(const QString& filename, const QString& type) {
-  return new CdfSource(filename, type);
+KstDataSource *create_cdf(KConfig *cfg, const QString& filename, const QString& type) {
+  return new CdfSource(cfg, filename, type);
 }
 
@@ -279,5 +280,5 @@ QStringList provides_cdf() {
     - the file has a .cdf extension (required by the cdf lib)
     - CDFopen does not complain (currently disabled) **/
-int understands_cdf(const QString& filename) {
+int understands_cdf(KConfig*, const QString& filename) {
   QFile f(filename);
   QFileInfo fInfo(f);
@@ -310,4 +311,6 @@ int understands_cdf(const QString& filen
 }
 
+// FIXME: implement fieldlist accelerator static here for better performance?
+
 }
 





More information about the Kst mailing list