[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu Sep 2 00:05:00 CEST 2004


CVS commit by arwalker: 

Further ensure that we update the PSD of a plugin output vector if the data file was changed on any of the input vectors. This was previously not happening, unless the new vector happened to be significantly longer than the old vector.


  M +2 -2      kstdataobject.cpp   1.29
  M +1 -1      kstdataobject.h   1.26
  M +5 -1      kstplugin.cpp   1.64
  M +6 -2      kstvector.cpp   1.81
  M +1 -1      kstvector.h   1.53


--- kdeextragear-2/kst/kst/kstdataobject.cpp  #1.28:1.29
@@ -57,5 +57,5 @@ KstDataObject::~KstDataObject() {
 }
 
-double *KstDataObject::vectorRealloced(KstVectorPtr v, double *memptr, int newSize) const {
+double *KstDataObject::vectorRealloced(KstVectorPtr v, double *memptr, int newSize, bool bNew) const {
   if (v.data() == 0L) {
     return 0L;
@@ -66,5 +66,5 @@ double *KstDataObject::vectorRealloced(K
   // you call vectorRealloced() and v is not locked by you already, you'd
   // better lock it!
-  double *rc = v->realloced(memptr, newSize);
+  double *rc = v->realloced(memptr, newSize, bNew);
 
   return rc;

--- kdeextragear-2/kst/kst/kstdataobject.h  #1.25:1.26
@@ -68,5 +68,5 @@ class KstDataObject : public KstObject {
 
   protected:
-    double *vectorRealloced(KstVectorPtr v, double *memptr, int newSize) const;
+    double *vectorRealloced(KstVectorPtr v, double *memptr, int newSize, bool bNew) const;
 
     KstVectorMap _inputVectors;

--- kdeextragear-2/kst/kst/kstplugin.cpp  #1.63:1.64
@@ -198,4 +198,5 @@ KstObject::UpdateType KstPlugin::update(
   const QValueList<Plugin::Data::IOValue>& itable = _plugin->data()._inputs;
   const QValueList<Plugin::Data::IOValue>& otable = _plugin->data()._outputs;
+  bool bNew = false;
   int itcnt = 0, vitcnt = 0;
 
@@ -210,4 +211,7 @@ KstObject::UpdateType KstPlugin::update(
         return NO_CHANGE;
       }
+      if (_inputVectors[(*it)._name]->sampleCount() == _inputVectors[(*it)._name]->numNew()) {
+        bNew = true;
+      }
       inVectors[vitcnt] = _inputVectors[(*it)._name]->value();
       inArrayLens[vitcnt++] = _inputVectors[(*it)._name]->sampleCount();
@@ -250,5 +254,5 @@ KstObject::UpdateType KstPlugin::update(
         ++it) {
       if ((*it)._type == Plugin::Data::IOValue::TableType) {
-        vectorRealloced(_outputVectors[(*it)._name], outVectors[vitcnt], outArrayLens[vitcnt]);
+        vectorRealloced(_outputVectors[(*it)._name], outVectors[vitcnt], outArrayLens[vitcnt], bNew);
         vitcnt++;
       } else if ((*it)._type == Plugin::Data::IOValue::FloatType) {

--- kdeextragear-2/kst/kst/kstvector.cpp  #1.80:1.81
@@ -239,8 +239,12 @@ void KstVector::updateScalars() {
 }
 
-double* KstVector::realloced(double *memptr, int newSize) {
+double* KstVector::realloced(double *memptr, int newSize, bool bNew) {
   double *old = _v;
   _v = memptr;
+  if (bNew) {
+    NumNew = newSize;
+  } else {
   NumNew = newSize - _size;
+  }
   _size = newSize;
   updateScalars();

--- kdeextragear-2/kst/kst/kstvector.h  #1.52:1.53
@@ -167,5 +167,5 @@ class KstVector : public KstObject {
   protected:
     friend class KstDataObject;
-    virtual double* realloced(double *memptr, int newSize);
+    virtual double* realloced(double *memptr, int newSize, bool bNew = false);
     
   private:





More information about the Kst mailing list