BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
BackgroundItemCatalog.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatDevice/BackgroundItemCatalog.cpp
6 //! @brief Implements class BackgroundItemCatalog
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2021
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
16 #include "Base/Util/Assert.h"
18 
20 {
21  switch (type) {
22  case Type::None:
23  return new NoBackgroundItem();
24  case Type::Constant:
25  return new ConstantBackgroundItem();
26  case Type::Poission:
27  return new PoissonBackgroundItem();
28  }
29  ASSERT(false);
30 }
31 
32 QVector<BackgroundItemCatalog::Type> BackgroundItemCatalog::types()
33 {
35 }
36 
38 {
39  switch (type) {
40  case Type::None:
41  return {"None", ""};
42  case Type::Constant:
43  return {"Constant background", ""};
44  case Type::Poission:
45  return {"Poisson noise", ""};
46  }
47  ASSERT(false);
48 }
49 
51 {
52  if (dynamic_cast<const NoBackgroundItem*>(item))
53  return Type::None;
54  if (dynamic_cast<const ConstantBackgroundItem*>(item))
55  return Type::Constant;
56  if (dynamic_cast<const PoissonBackgroundItem*>(item))
57  return Type::Poission;
58 
59  ASSERT(false);
60 }
Defines class BackgroundItemCatalog.
Defines BackgroundItem classes.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
static Type type(const BackgroundItem *item)
Returns the enum type of the given item.
static QVector< Type > types()
Available types of items.
static BackgroundItem * create(Type type)
Creates the item of the given type.