[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Fri Jan 14 17:47:46 CET 2005
CVS commit by staikos:
I finally understand this code, and I don't like the API change it made. The
flag it added was a special-case hack and should not have gone into the API of
two classes that generally don't even care about it. The real problem is even
hidden by this hack: Out updates don't trigger hierarchically yet, but this is
a work in progress, and once complete, this hack in kstplugin, and the reason
we have it in KstPSD can go away, along with KstVector::setAllNew().
M +2 -4 kstdataobject.cpp 1.37
M +1 -1 kstdataobject.h 1.34
M +6 -4 kstplugin.cpp 1.84
M +2 -6 kstvector.cpp 1.93
M +3 -1 kstvector.h 1.62
--- kdeextragear-2/kst/kst/kstdataobject.cpp #1.36:1.37
@@ -69,5 +69,5 @@ KstDataObject::~KstDataObject() {
}
-double *KstDataObject::vectorRealloced(KstVectorPtr v, double *memptr, int newSize, bool bNew) const {
+double *KstDataObject::vectorRealloced(KstVectorPtr v, double *memptr, int newSize) const {
if (v.data() == 0L) {
return 0L;
@@ -78,7 +78,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, bNew);
-
- return rc;
+ return v->realloced(memptr, newSize);
}
--- kdeextragear-2/kst/kst/kstdataobject.h #1.33:1.34
@@ -79,5 +79,5 @@ class KstDataObject : public KstObject {
protected:
- double *vectorRealloced(KstVectorPtr v, double *memptr, int newSize, bool bNew) const;
+ double *vectorRealloced(KstVectorPtr v, double *memptr, int newSize) const;
KstVectorMap _inputVectors;
--- kdeextragear-2/kst/kst/kstplugin.cpp #1.83:1.84
@@ -259,7 +259,6 @@ 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; // what does this variable name mean? That's why we don't
- // use HN in Kst!!
int itcnt = 0, vitcnt = 0, sitcnt = 0;
+ QDict<bool> doNew(17);
// Populate the input scalars and vectors
@@ -274,5 +273,5 @@ KstObject::UpdateType KstPlugin::update(
}
if (_inputVectors[(*it)._name]->length() == _inputVectors[(*it)._name]->numNew()) {
- bNew = true;
+ doNew.insert((*it)._name, 0L);
}
_inVectors[vitcnt] = _inputVectors[(*it)._name]->value();
@@ -337,5 +336,8 @@ KstObject::UpdateType KstPlugin::update(
++it) {
if ((*it)._type == Plugin::Data::IOValue::TableType) {
- vectorRealloced(_outputVectors[(*it)._name], _outVectors[vitcnt], _outArrayLens[vitcnt], bNew);
+ vectorRealloced(_outputVectors[(*it)._name], _outVectors[vitcnt], _outArrayLens[vitcnt]);
+ if (doNew.find((*it)._name)) {
+ _outputVectors[(*it)._name]->setAllNew();
+ }
vitcnt++;
} else if ((*it)._type == Plugin::Data::IOValue::FloatType) {
--- kdeextragear-2/kst/kst/kstvector.cpp #1.92:1.93
@@ -202,12 +202,8 @@ void KstVector::updateScalars() {
-double* KstVector::realloced(double *memptr, int newSize, bool bNew) {
+double* KstVector::realloced(double *memptr, int newSize) {
double *old = _v;
_v = memptr;
- if (bNew) {
- NumNew = newSize;
- } else {
NumNew = newSize - _size;
- }
_size = newSize;
updateScalars();
--- kdeextragear-2/kst/kst/kstvector.h #1.61:1.62
@@ -110,4 +110,6 @@ class KstVector : public KstObject {
virtual void setProvider(KstObject* obj);
+ void setAllNew() { NumNew = _size; } // FIXME: remove hack when updates are fixed
+
public:
/** Save vector information */
@@ -173,5 +175,5 @@ class KstVector : public KstObject {
protected:
friend class KstDataObject;
- virtual double* realloced(double *memptr, int newSize, bool bNew = false);
+ virtual double* realloced(double *memptr, int newSize);
};
More information about the Kst
mailing list