diff --git a/GUI/coregui/Models/InstrumentItems.cpp b/GUI/coregui/Models/InstrumentItems.cpp index 86969bac2cd2efbb0450b2222f900c466af0939d..9ddb8428c39706525f44f4075aa4592d6abc7124 100644 --- a/GUI/coregui/Models/InstrumentItems.cpp +++ b/GUI/coregui/Models/InstrumentItems.cpp @@ -151,7 +151,7 @@ void SpecularInstrumentItem::updateToRealData(const RealDataItem* item) throw GUIHelpers::Error("Error in SpecularInstrumentItem::updateToRealData: The type " "of instrument is incompatible with passed data shape."); - const auto& data = item->nativeData()->getOutputData()->axis(0); + const auto& data = item->nativeOutputData()->axis(0); beamItem()->updateToData(data, item->nativeDataUnits()); } @@ -172,7 +172,7 @@ bool SpecularInstrumentItem::alignedWith(const RealDataItem* item) const if (!instrument_axis) return false; - const auto& native_axis = item->nativeData()->getOutputData()->axis(0); + const auto& native_axis = item->nativeOutputData()->axis(0); return *instrument_axis == native_axis; ; } diff --git a/GUI/coregui/Models/JobModelFunctions.cpp b/GUI/coregui/Models/JobModelFunctions.cpp index 26be014f4ce44b66bbc22d868a52e5c8024f8d71..ddc1ad314dbe9b7a6ef67a4cc52a4ff99be549bc 100644 --- a/GUI/coregui/Models/JobModelFunctions.cpp +++ b/GUI/coregui/Models/JobModelFunctions.cpp @@ -207,8 +207,7 @@ void JobModelFunctions::copyRealDataItem(JobItem* jobItem, const RealDataItem* r if (!realDataItem->nativeData()) return; - realDataItemCopy->nativeData()->setOutputData( - realDataItem->nativeData()->getOutputData()->clone()); + realDataItemCopy->setNativeOutputData(realDataItem->nativeOutputData()->clone()); realDataItemCopy->nativeData()->setFileName(ItemFileNameUtils::jobNativeDataFileName(*jobItem)); } diff --git a/GUI/coregui/Models/RealDataItem.cpp b/GUI/coregui/Models/RealDataItem.cpp index ac6a9daddf554bc692561b470374ba190ac4e5d2..f01e6b3fe68a001265a50c3f6b81d17b3bc6181d 100644 --- a/GUI/coregui/Models/RealDataItem.cpp +++ b/GUI/coregui/Models/RealDataItem.cpp @@ -150,6 +150,18 @@ bool RealDataItem::hasNativeData() const return (nativeData() != nullptr) && (nativeData()->getOutputData() != nullptr); } +const OutputData<double>* RealDataItem::nativeOutputData() const +{ + return hasNativeData() ? nativeData()->getOutputData() : nullptr; +} + +//! takes ownership of data + +void RealDataItem::setNativeOutputData(OutputData<double>* data) +{ + nativeData()->setOutputData(data); // takes ownership of odata +} + //! Creates data item if not existing so far. Checks for rank compatibility if already existing. No //! further initialization like clearing the data etc. diff --git a/GUI/coregui/Models/RealDataItem.h b/GUI/coregui/Models/RealDataItem.h index 09e1f2086c08e956e9c6708b2dd59216a46fdb10..f02739059bbec57aa18e29374b0ac3988c4dd7cc 100644 --- a/GUI/coregui/Models/RealDataItem.h +++ b/GUI/coregui/Models/RealDataItem.h @@ -67,7 +67,9 @@ public: void initNativeData(); QString nativeDataUnits() const; void setNativeDataUnits(const QString& units); - bool hasNativeData() const; + bool hasNativeData() const; + const OutputData<double>* nativeOutputData() const; + void setNativeOutputData(OutputData<double>* data); void setOutputData(OutputData<double>* data); void setImportData(ImportDataInfo data);