[Kst] branches/work/kst/pluginify/kst/src/libkstmath
Adam Treat
treat at kde.org
Mon Sep 18 18:36:46 CEST 2006
SVN commit 586084 by treat:
* Break out the methods to make update as clear
as possible.
* Update outputStrings.
M +38 -29 kstbasicplugin.cpp
M +2 -1 kstbasicplugin.h
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.cpp #586083:586084
@@ -110,42 +110,18 @@
return setLastUpdateResult(NO_CHANGE);
//Update the dependent inputs
- bool depUpdated = updateDependentInput(updateCounter, force);
+ bool depUpdated = updateInput(updateCounter, force);
//Call the plugins algorithm to operate on the inputs
- //to produce the outputs
+ //and produce the outputs
algorithm();
- //Perform any necessary operations on the outputs
+ //Perform update on the outputs
+ updateOutput(updateCounter);
- //output vectors...
- QStringList ov = outputVectors();
- QStringList::ConstIterator ovI = ov.begin();
- for (; ovI != ov.end(); ++ovI) {
- if (KstVectorPtr o = outputVector(*ovI)) {
- vectorRealloced(o, o->value(), o->length());
- o->setDirty();
- o->setNewAndShift(o->length(), o->numShift());
- o->update(updateCounter);
- }
- }
-
- //output scalars...
- QStringList os = outputScalars();
- QStringList::ConstIterator osI = os.begin();
- for (; osI != os.end(); ++osI) {
- if (KstScalarPtr o = outputScalar(*osI)) {
- o->update(updateCounter);
- }
- }
-
- //ouput strings...
- //TODO
-
return setLastUpdateResult(depUpdated ? UPDATE : NO_CHANGE);
}
-
void KstBasicPlugin::load(const QDomElement &e) {
QDomNode n = e.firstChild();
@@ -253,7 +229,7 @@
}
-bool KstBasicPlugin::updateDependentInput(int updateCounter, bool force) const {
+bool KstBasicPlugin::updateInput(int updateCounter, bool force) const {
bool depUpdated = force;
//First, update the inputVectors...
@@ -282,4 +258,37 @@
return depUpdated;
}
+
+void KstBasicPlugin::updateOutput(int updateCounter) const {
+ //output vectors...
+ QStringList ov = outputVectors();
+ QStringList::ConstIterator ovI = ov.begin();
+ for (; ovI != ov.end(); ++ovI) {
+ if (KstVectorPtr o = outputVector(*ovI)) {
+ vectorRealloced(o, o->value(), o->length());
+ o->setDirty();
+ o->setNewAndShift(o->length(), o->numShift());
+ o->update(updateCounter);
+ }
+ }
+
+ //output scalars...
+ QStringList os = outputScalars();
+ QStringList::ConstIterator osI = os.begin();
+ for (; osI != os.end(); ++osI) {
+ if (KstScalarPtr o = outputScalar(*osI)) {
+ o->update(updateCounter);
+ }
+ }
+
+ //ouput strings...
+ QStringList ostr = outputStrings();
+ QStringList::ConstIterator ostrI = ostr.begin();
+ for (; ostrI != ostr.end(); ++ostrI) {
+ if (KstStringPtr o = outputString(*ostrI)) {
+ o->update(updateCounter);
+ }
+ }
+}
+
// vim: ts=2 sw=2 et
--- branches/work/kst/pluginify/kst/src/libkstmath/kstbasicplugin.h #586083:586084
@@ -76,7 +76,8 @@
private:
bool inputsExist() const;
- bool updateDependentInput(int updateCounter, bool force) const;
+ bool updateInput(int updateCounter, bool force) const;
+ void updateOutput(int updateCounter) const;
};
typedef KstSharedPtr<KstBasicPlugin> KstBasicPluginPtr;
More information about the Kst
mailing list