BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
InstrumentItemCatalog.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/CatDevice/InstrumentItemCatalog.cpp
6 //! @brief Implements class InstrumentItemCatalog
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::GISAS:
23  return new GISASInstrumentItem();
24  case Type::Offspec:
25  return new OffspecInstrumentItem();
26  case Type::Specular:
27  return new SpecularInstrumentItem();
28  case Type::DepthProbe:
29  return new DepthProbeInstrumentItem();
30  }
31  ASSERT(false);
32 }
33 
34 QVector<InstrumentItemCatalog::Type> InstrumentItemCatalog::types()
35 {
37 }
38 
40 {
41  switch (type) {
42  case Type::GISAS:
43  return {"GISAS", ""};
44  case Type::Offspec:
45  return {"Off specular", ""};
46  case Type::Specular:
47  return {"Specular", ""};
48  case Type::DepthProbe:
49  return {"Depth probe", ""};
50  }
51  ASSERT(false);
52 }
53 
55 {
56  if (dynamic_cast<const GISASInstrumentItem*>(item))
57  return Type::GISAS;
58  if (dynamic_cast<const OffspecInstrumentItem*>(item))
59  return Type::Offspec;
60  if (dynamic_cast<const SpecularInstrumentItem*>(item))
61  return Type::Specular;
62  if (dynamic_cast<const DepthProbeInstrumentItem*>(item))
63  return Type::DepthProbe;
64 
65  ASSERT(false);
66 }
Defines class InstrumentItemCatalog.
Defines class InstrumentItem and all its children.
static UiInfo uiInfo(Type t)
UiInfo on the given type.
static Type type(const InstrumentItem *item)
Returns the enum type of the given item.
static InstrumentItem * create(Type type)
Creates the item of the given type.
static QVector< Type > types()
Available types of items.
Abstract base class for instrument-specific item classes.