[Kst] branches/work/kst/portto4/kst/src/datasources/ascii

Peter Kümmel syntheticpp at gmx.net
Sat Jan 29 14:31:14 CET 2011


SVN commit 1217897 by kuemmel:

don't read the ascii data file completely in the constructor

 M  +10 -3     asciisource.cpp  
 M  +2 -0      asciisource.h  


--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.cpp #1217896:1217897
@@ -198,7 +198,7 @@
 
   _valid = true;
   registerChange();
-  internalDataSourceUpdate();
+  internalDataSourceUpdate(false);
 }
 
 
@@ -296,9 +296,16 @@
 
 
 //-------------------------------------------------------------------------------------------
-#define MAXBUFREADLEN KST_PREALLOC
 Kst::Object::UpdateType AsciiSource::internalDataSourceUpdate() 
 {
+  return internalDataSourceUpdate(true);
+}
+
+
+//-------------------------------------------------------------------------------------------
+#define MAXBUFREADLEN KST_PREALLOC
+Kst::Object::UpdateType AsciiSource::internalDataSourceUpdate(bool read_completely)
+{
   MeasureTime t("AsciiSource::internalDataSourceUpdate");
 
   if (!_haveHeader) {
@@ -371,7 +378,7 @@
       }
     }
 
-  } while ((bufread == MAXBUFREADLEN));
+  } while (bufread == MAXBUFREADLEN  && read_completely);
 
   _rowIndex.resize(_numFrames + 1);
 
--- branches/work/kst/portto4/kst/src/datasources/ascii/asciisource.h #1217896:1217897
@@ -44,6 +44,8 @@
 
     bool initRowIndex();
 
+    UpdateType internalDataSourceUpdate(bool read_completely);
+
     virtual UpdateType internalDataSourceUpdate();
 
     int readField(double *v, const QString &field, int s, int n);


More information about the Kst mailing list