Skip to content
Snippets Groups Projects
Commit c93a293e authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

use it

parent c890277d
No related branches found
No related tags found
1 merge request!2675simplification and renaming of catalog classes
......@@ -36,7 +36,10 @@ public:
virtual double scaleFactor() const;
template <typename T> T* setDistributionItemType();
template <typename T> T* setDistributionItemType()
{
return m_distribution.createCertainItem<T>();
}
DistributionItem* distributionItem() const { return m_distribution.certainItem(); }
PolyItem<DistributionsCatalog>& distributionSelection() { return m_distribution; }
......@@ -46,10 +49,4 @@ protected:
PolyItem<DistributionsCatalog> m_distribution;
};
template <typename T> T* BeamDistributionItem::setDistributionItemType()
{
m_distribution.createCertainItem<T>();
return dynamic_cast<T*>(m_distribution.certainItem());
}
#endif // BORNAGAIN_GUI_MODEL_BEAM_BEAMDISTRIBUTIONITEM_H
......@@ -38,7 +38,10 @@ public:
return m_resolution_function;
}
template <typename T> T* setResolutionFunctionType();
template <typename T> T* setResolutionFunctionType()
{
return m_resolution_function.createCertainItem<T>();
}
void writeTo(QXmlStreamWriter* w) const;
void readFrom(QXmlStreamReader* r);
......@@ -63,10 +66,4 @@ private:
std::unique_ptr<MasksSet> m_prjns; //!< projections
};
template <typename T> T* DetectorItem::setResolutionFunctionType()
{
m_resolution_function.createCertainItem<T>();
return dynamic_cast<T*>(m_resolution_function.certainItem());
}
#endif // BORNAGAIN_GUI_MODEL_DETECTOR_DETECTORITEM_H
......@@ -66,7 +66,11 @@ public:
template <typename T> bool is() const { return dynamic_cast<const T*>(this) != nullptr; }
template <typename T> T* setBackgroundItemType();
template <typename T> T* setBackgroundItemType()
{
return m_background.createCertainItem<T>();
}
PolyItem<BackgroundItemCatalog>& backgroundSelection() { return m_background; }
BackgroundItem* backgroundItem() const { return m_background.certainItem(); }
......@@ -197,14 +201,4 @@ private:
AxisProperty m_z_axis;
};
// ************************************************************************************************
// templated functions implementation
// ************************************************************************************************
template <typename T> T* InstrumentItem::setBackgroundItemType()
{
return m_background.createCertainItem<T>();
}
#endif // BORNAGAIN_GUI_MODEL_SIM_INSTRUMENTITEMS_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment