9#include "MantidAPI/DllConfig.h"
22using PreviewRegister = std::map<std::string, std::map<std::string, std::map<std::string, IPreview_uptr>>>;
31 std::vector<std::string> getPreviews(
const std::string &facility,
const std::string &technique =
"")
const;
32 const IPreview &getPreview(
const std::string &facility,
const std::string &technique,
33 const std::string &preview)
const;
35 static_assert(std::is_base_of<IPreview, T>::value);
37 const auto facility = preview->facility();
38 const auto technique = preview->technique();
39 const auto name = preview->name();
40 if (checkPreview(facility, technique, name)) {
41 throw std::runtime_error(
"Preview with the same name is already registered for the same "
42 "facility and technique.");
44 m_previews[facility][technique][name] = std::move(preview);
48 bool checkFacility(
const std::string &facility)
const;
49 bool checkTechnique(
const std::string &facility,
const std::string &technique)
const;
50 bool checkPreview(
const std::string &facility,
const std::string &technique,
const std::string &preview)
const;
65#define DECLARE_PREVIEW(classname) \
67 Mantid::Kernel::RegistrationHelper \
68 register_preview_##classname(((Mantid::API::PreviewManager::Instance().subscribe<classname>()), 0)); \
IPreview : This is the abstract base class of the raw data previews.
PreviewManager : Manages the raw data previews.
PreviewManagerImpl(const PreviewManagerImpl &)=delete
PreviewManagerImpl()=default
PreviewRegister m_previews
PreviewManagerImpl & operator=(const PreviewManagerImpl &)=delete
Manage the lifetime of a class intended to be a singleton.
std::unique_ptr< IPreview > IPreview_uptr
std::map< std::string, std::map< std::string, std::map< std::string, IPreview_uptr > > > PreviewRegister
Helper class which provides the Collimation Length for SANS instruments.