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(iter.data()->tagName() + "'", 0, plugin.data()); plugin->outputVectors().insert(iter.key(), v); KST::addVectorToList(v); } for (KstScalarMap::ConstIterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) { KstScalarPtr s = new KstScalar(iter.data()->tagName() + "'", plugin.data()); plugin->outputScalars().insert(iter.key(), s); } for (KstStringMap::ConstIterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) { KstStringPtr s = new KstString(iter.data()->tagName() + "'", plugin.data()); plugin->outputStrings().insert(iter.key(), s); } // set the same plugin plugin->setPlugin(_plugin); plugin->setTagName(tagName() + "'"); duplicatedMap.insert(this, KstDataObjectPtr(plugin)); return KstDataObjectPtr(plugin); }
KstDataObjectPtr KstCPlugin::makeDuplicate(KstDataObjectDataObjectMap& duplicatedMap) { KstCPluginPtr plugin = new KstCPlugin; // 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) { KstWriteLocker blockVectorUpdates(&KST::vectorList.lock()); KstVectorPtr v = new KstVector(KstObjectTag(iter.data()->tag().tag() + "'", iter.data()->tag().context()), 0, plugin.data()); // FIXME: unique tag generation plugin->outputVectors().insert(iter.key(), v); } for (KstScalarMap::ConstIterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) { KstScalarPtr s = new KstScalar(KstObjectTag(iter.data()->tag().tag() + "'", iter.data()->tag().context()), plugin.data()); // FIXME: unique tag generation plugin->outputScalars().insert(iter.key(), s); } for (KstStringMap::ConstIterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) { KstStringPtr s = new KstString(KstObjectTag(iter.data()->tag().tag() + "'", iter.data()->tag().context()), plugin.data()); // FIXME: unique tag generation plugin->outputStrings().insert(iter.key(), s); } // set the same plugin plugin->setPlugin(_plugin); plugin->setTagName(KstObjectTag(tag().tag() + "'", tag().context())); // FIXME: unique tag generation method duplicatedMap.insert(this, KstDataObjectPtr(plugin)); return KstDataObjectPtr(plugin); }
void KstCPlugin::setTagName(const QString &in_tag) { KstObjectTag newTag(in_tag, tag().context()); if (newTag == tag()) { return; } KstObject::setTagName(newTag); for (KstVectorMap::Iterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) { (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag())); } for (KstScalarMap::Iterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) { (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag())); } for (KstStringMap::Iterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) { (*iter)->setTagName(KstObjectTag(iter.data()->tag().tag(), tag())); } }
DataObjectPtr BasicPlugin::makeDuplicate() const { #if 0 BasicPluginPtr plugin = kst_cast<BasicPlugin>(DataObject::createPlugin(propertyString())); // use same inputs for (VectorMap::ConstIterator iter = _inputVectors.begin(); iter != _inputVectors.end(); ++iter) { plugin->inputVectors().insert(iter.key(), iter.value()); } for (ScalarMap::ConstIterator iter = _inputScalars.begin(); iter != _inputScalars.end(); ++iter) { plugin->inputScalars().insert(iter.key(), iter.value()); } for (StringMap::ConstIterator iter = _inputStrings.begin(); iter != _inputStrings.end(); ++iter) { plugin->inputStrings().insert(iter.key(), iter.value()); } // create new outputs for (VectorMap::ConstIterator iter = outputVectors().begin(); iter != outputVectors().end(); ++iter) { KstWriteLocker blockVectorUpdates(&vectorList.lock()); VectorPtr v = new Vector(ObjectTag(iter.value()->tag().tag() + "'", iter.value()->tag().context()), 0, plugin.data()); // FIXME: unique tag generation plugin->outputVectors().insert(iter.key(), v); } for (ScalarMap::ConstIterator iter = outputScalars().begin(); iter != outputScalars().end(); ++iter) { ScalarPtr s = new Scalar(ObjectTag(iter.value()->tag().tag() + "'", iter.value()->tag().context()), plugin.data()); // FIXME: unique tag generation plugin->outputScalars().insert(iter.key(), s); } for (StringMap::ConstIterator iter = outputStrings().begin(); iter != outputStrings().end(); ++iter) { StringPtr s = new String(ObjectTag(iter.value()->tag().tag() + "'", iter.value()->tag().context()), plugin.data()); // FIXME: unique tag generation plugin->outputStrings().insert(iter.key(), s); } // set the same plugin plugin->setTagName(ObjectTag(tag().tag() + "'", tag().context())); // FIXME: unique tag generation method map.insert(this, DataObjectPtr(plugin)); return DataObjectPtr(plugin); #endif // FIXME: implement this return 0L; }