[Kst] kdeextragear-2/kst/kst

George Staikos staikos at kde.org
Mon Jan 17 23:48:12 CET 2005


CVS commit by staikos: 

merge fastskip branch into HEAD.  Only makes a difference for piolib use.
Branch remains open to come up with a solution for doing boxcar inside the
datasource if we care.


  M +46 -19    kstrvector.cpp   1.72
  M +3 -1      kstrvector.h   1.30


--- kdeextragear-2/kst/kst/kstrvector.cpp  #1.71:1.72
@@ -51,5 +51,5 @@ KstRVector::KstRVector(KstDataSourcePtr 
 
 
-KstRVector::KstRVector(const QDomElement &e, const QString &o_file,
+KstRVector::KstRVector(QDomElement &e, const QString &o_file,
                        int o_n, int o_f, int o_s, bool o_ave)
 : KstVector() {
@@ -121,4 +121,5 @@ void KstRVector::commonRVConstructor(Kst
                                      int in_n, int in_skip, bool in_DoSkip,
                                      bool in_DoAve) {
+  _dontUseSkipAccel = false;
   _numSamples = 0;
   _scalars["sum"]->setValue(0.0);
@@ -171,4 +172,5 @@ void KstRVector::change(KstDataSourcePtr
   }
 
+  _dontUseSkipAccel = false;
   _file = in_file;
   ReqF0 = in_f0;
@@ -367,4 +369,5 @@ QString KstRVector::label() const {
 
 void KstRVector::reset() { // must be called with a lock
+  _dontUseSkipAccel = false;
   if (_file) {
     SPF = _file->samplesPerFrame(_field);
@@ -493,4 +496,25 @@ KstObject::UpdateType KstRVector::doUpda
       }
     }
+    if (!_dontUseSkipAccel) {
+      int rc;
+      int lastRead = -1;
+      if (DoAve) {
+        // We don't support boxcar inside data sources yet.
+        _dontUseSkipAccel = true;
+      } else {
+        rc = _file->readField(_v + _numSamples, _field, new_f0, (new_nf - NF)/Skip, Skip, &lastRead);
+        if (rc != -9999) {
+          //kdDebug() << "USED SKIP FOR READ - " << _field << " - rc=" << rc << " for Skip=" << Skip << " s=" << new_f0 << " n=" << (DoAve ? (new_nf - NF)/Skip : -1) << endl;
+          if (rc >= 0) {
+            n_read = rc;
+          } else {
+            n_read = 0;
+          }
+        } else {
+          _dontUseSkipAccel = true;
+        }
+      }
+    }
+    if (_dontUseSkipAccel) {
     n_read = 0;
     /** read each sample from the File */
@@ -517,4 +541,5 @@ KstObject::UpdateType KstRVector::doUpda
       }
     }
+    }
   } else {
     // reallocate V if necessary
@@ -553,4 +578,5 @@ KstObject::UpdateType KstRVector::doUpda
   _dirty = false;
   if (_numSamples != _size && !(_numSamples == 0 && _size == 1)) {
+    kdDebug() << "SET DIRTY since _numSamples = " << _numSamples << " but _size = " << _size << endl;
     _dirty = true;
     for (i = _numSamples; i < _size; i++) {
@@ -613,4 +639,5 @@ void KstRVector::reload() {
         KST::dataSourceList.lock().writeLock();
         KST::dataSourceList.remove(_file);
+        _dontUseSkipAccel = false;
         _file = newsrc;
         _file->writeLock();

--- kdeextragear-2/kst/kst/kstrvector.h  #1.29:1.30
@@ -38,5 +38,5 @@ public:
              bool in_doAve);
 
-  KstRVector(const QDomElement &e,
+  KstRVector(QDomElement &e,
              const QString &o_file="|",
              int o_n = -2, int o_f = -2,
@@ -159,4 +159,6 @@ private:
 
   void checkIntegrity(); // must be called with a lock
+
+  bool _dontUseSkipAccel;
 };
 




More information about the Kst mailing list