本文整理汇总了C++中KstScalarPtr::setProvider方法的典型用法代码示例。如果您正苦于以下问题:C++ KstScalarPtr::setProvider方法的具体用法?C++ KstScalarPtr::setProvider怎么用?C++ KstScalarPtr::setProvider使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstScalarPtr
的用法示例。
在下文中一共展示了KstScalarPtr::setProvider方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFitScalars
// FIXME: KstPlugin should not know about fit scalars!!
void KstPlugin::createFitScalars() {
if (_plugin->data()._isFit && _outputVectors.contains("Parameters")) {
KstVectorPtr vectorParam = _outputVectors["Parameters"];
if (vectorParam) {
QString paramName;
int i = 0;
int length = vectorParam->length();
for (paramName = _plugin->parameterName(i);
!paramName.isEmpty() && i < length;
paramName = _plugin->parameterName(++i)) {
double scalarValue = vectorParam->value(i);
if (!_outputScalars.contains(paramName)) {
QString scalarName = i18n("%1-%2").arg(tagName()).arg(paramName);
KstScalarPtr s = new KstScalar(scalarName, scalarValue);
s->writeLock();
s->setProvider(this);
s->writeUnlock();
_outputScalars.insert(paramName, s);
} else {
_outputScalars[paramName]->setValue(scalarValue);
}
}
}
}
}
示例2: makeDuplicate
KstDataObjectPtr KstPlugin::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) {
KstPluginPtr plugin = new KstPlugin;
// use same inputs
for (KstVectorMap::ConstIterator iter = _inputVectors.begin(); iter != _inputVectors.end(); ++iter) {
plugin->inputVectors().insert(iter.key(), iter.data());
}
for (KstScalarMap::ConstIterator iter = _inputScalars.begin(); iter != _inputScalars.end(); ++iter) {
plugin->inputScalars().insert(iter.key(), iter.data());
}
for (KstStringMap::ConstIterator iter = _inputStrings.begin(); iter != _inputStrings.end(); ++iter) {
plugin->inputStrings().insert(iter.key(), iter.data());
}
// create new outputs
for (KstVectorMap::ConstIterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) {
KstVectorPtr v = new KstVector;
v->writeLock();
plugin->outputVectors().insert(iter.key(), v);
v->setTagName(iter.data()->tagName() + "'");
v->setProvider(plugin.data());
KST::addVectorToList(v);
v->writeUnlock();
}
for (KstScalarMap::ConstIterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) {
KstScalarPtr s = new KstScalar;
s->writeLock();
plugin->outputScalars().insert(iter.key(), s);
s->setTagName(iter.data()->tagName() + "'");
s->setProvider(plugin.data());
s->writeUnlock();
}
for (KstStringMap::ConstIterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) {
KstStringPtr s = new KstString;
s->writeLock();
plugin->outputStrings().insert(iter.key(), s);
s->setTagName(iter.data()->tagName() + "'");
s->setProvider(plugin.data());
s->writeUnlock();
}
// set the same plugin
plugin->setPlugin(_plugin);
plugin->setTagName(tagName() + "'");
duplicatedMap.insert(this, KstDataObjectPtr(plugin));
return KstDataObjectPtr(plugin);
}
示例3: setPlugin
bool KstPlugin::setPlugin(KstSharedPtr<Plugin> plugin) {
// Assumes that this is called with a write lock in place on this object
if (plugin == _plugin) {
return true;
}
freeParameters();
if (_localData) {
if (!_plugin || !_plugin->freeLocalData(&_localData)) {
free(_localData);
}
_localData = 0L;
}
if (!plugin) {
_inputVectors.clear();
_inputScalars.clear();
_inputStrings.clear();
_outputVectors.clear();
_outputScalars.clear();
_outputStrings.clear();
_plugin = 0L;
return true;
}
Plugin::countScalarsVectorsAndStrings(plugin->data()._inputs, _inScalarCnt, _inArrayCnt, _inStringCnt, _inPid);
if (_inputVectors.count() != _inArrayCnt ||
_inputScalars.count() != _inScalarCnt - _inPid ||
_inputStrings.count() != _inStringCnt) {
_plugin = 0L;
return false;
}
_outScalarCnt = 0;
_outArrayCnt = 0;
_outStringCnt = 0;
_outputVectors.clear();
_outputScalars.clear();
_outputStrings.clear();
const QValueList<Plugin::Data::IOValue>& otable = plugin->data()._outputs;
for (QValueList<Plugin::Data::IOValue>::ConstIterator it = otable.begin();
it != otable.end();
++it) {
if ((*it)._type == Plugin::Data::IOValue::TableType) {
KstVectorPtr v;
if ((*it)._subType == Plugin::Data::IOValue::FloatNonVectorSubType) {
v = new KstVector(QString::null, 0, true);
} else {
v = new KstVector;
}
v->writeLock();
v->setProvider(this);
_outputVectors.insert((*it)._name, v);
_outArrayCnt++;
KST::addVectorToList(v);
} else if ((*it)._type == Plugin::Data::IOValue::FloatType) {
KstScalarPtr s = new KstScalar;
s->writeLock();
s->setProvider(this);
_outputScalars.insert((*it)._name, s);
_outScalarCnt++;
} else if ((*it)._type == Plugin::Data::IOValue::StringType) {
KstStringPtr s = new KstString;
s->writeLock();
s->setProvider(this);
_outputStrings.insert((*it)._name, s);
_outStringCnt++;
}
}
allocateParameters();
_plugin = plugin;
return true;
}
示例4: KstDataObject
KstPlugin::KstPlugin(const QDomElement& e)
: KstDataObject(e) {
QString pluginName;
_inStringCnt = 0;
_outStringCnt = 0;
commonConstructor();
QDomNode n = e.firstChild();
while (!n.isNull()) {
QDomElement e = n.toElement();
if (!e.isNull()) {
if (e.tagName() == "tag") {
setTagName(e.text());
} else if (e.tagName() == "name") {
pluginName = e.text();
} else if (e.tagName() == "ivector") {
_inputVectorLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
} else if (e.tagName() == "iscalar") {
_inputScalarLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
} else if (e.tagName() == "istring") {
_inputStringLoadQueue.append(qMakePair(e.attribute("name"), e.text()));
} else if (e.tagName() == "ovector") {
KstVectorPtr v;
if (e.attribute("scalarList", "0").toInt()) {
v = new KstVector(e.text(), 0, true);
} else {
v = new KstVector(e.text(), 0, false);
}
v->setProvider(this);
_outputVectors.insert(e.attribute("name"), v);
KST::addVectorToList(v);
} else if (e.tagName() == "oscalar") {
KstScalarPtr sp = new KstScalar(e.text());
sp->writeLock();
sp->setProvider(this);
sp->writeUnlock();
_outputScalars.insert(e.attribute("name"), sp);
} else if (e.tagName() == "ostring") {
KstStringPtr sp = new KstString(e.text());
sp->writeLock();
sp->setProvider(this);
sp->writeUnlock();
_outputStrings.insert(e.attribute("name"), sp);
}
}
n = n.nextSibling();
}
_plugin = PluginCollection::self()->plugin(pluginName);
if (!_plugin.data()) {
KstDebug::self()->log(i18n("Unable to load plugin %1 for \"%2\".").arg(pluginName).arg(tagName()), KstDebug::Warning);
} else {
Plugin::countScalarsVectorsAndStrings(_plugin->data()._inputs, _inScalarCnt, _inArrayCnt, _inStringCnt, _inPid);
const QValueList<Plugin::Data::IOValue>& otable = _plugin->data()._outputs;
for (QValueList<Plugin::Data::IOValue>::ConstIterator it = otable.begin();
it != otable.end();
++it) {
// FIXME: i18n?
if ((*it)._type == Plugin::Data::IOValue::TableType) {
_outArrayCnt++;
if (!_outputVectors.contains((*it)._name)) {
KstVectorPtr v;
if ((*it)._subType == Plugin::Data::IOValue::FloatNonVectorSubType) {
v = new KstVector(tagName() + " vector - " + (*it)._name, 0, true);
} else {
v = new KstVector(tagName() + " vector - " + (*it)._name, 0, false);
}
v->setProvider(this);
_outputVectors.insert((*it)._name, v);
KST::addVectorToList(v);
}
} else if ((*it)._type == Plugin::Data::IOValue::MatrixType) {
abort(); // FIXME:
#if 0
_outArrayCnt += 2;
if (!_outputMatrices.contains((*it)._name)) {
KstMatrixPtr m;
if ((*it)._subType == Plugin::Data::IOValue::FloatNonVectorSubType) {
m = new KstMatrix(tagName() + " matrix - " + (*it)._name, 0, true);
} else {
m = new KstMatrix(tagName() + " matrix - " + (*it)._name, 0, false);
}
m->setProvider(this);
_outputMatrices.insert((*it)._name, m);
KST::addVectorToList(v);
}
#endif
} else if ((*it)._type == Plugin::Data::IOValue::FloatType) {
_outScalarCnt++;
if (!_outputScalars.contains((*it)._name)) {
KstScalarPtr s = new KstScalar(tagName() + " scalar - " + (*it)._name);
s->writeLock();
s->setProvider(this);
s->writeUnlock();
//.........这里部分代码省略.........