BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ResolutionFunctionItemCatalog Class Reference

Description

Definition at line 25 of file ResolutionFunctionItemCatalog.h.

Classes

struct  UiInfo
 

Public Types

using CatalogedType = ResolutionFunctionItem
 
enum class  Type : uint8_t { None = 0 , Gaussian = 1 }
 

Static Public Member Functions

static ResolutionFunctionItemcreate (Type type, const std::variant< QString, Unit > &unit=Unit::unitless)
 Creates the item of the given type. More...
 
static Type type (const ResolutionFunctionItem *item)
 Returns the enum type of the given item. More...
 
static QVector< Typetypes ()
 Available types of items. More...
 
static UiInfo uiInfo (Type t)
 UiInfo on the given type. More...
 

Member Typedef Documentation

◆ CatalogedType

Member Enumeration Documentation

◆ Type

enum ResolutionFunctionItemCatalog::Type : uint8_t
strong
Enumerator
None 
Gaussian 

Definition at line 30 of file ResolutionFunctionItemCatalog.h.

30 : uint8_t { None = 0, Gaussian = 1 };

Member Function Documentation

◆ create()

ResolutionFunctionItem * ResolutionFunctionItemCatalog::create ( Type  type,
const std::variant< QString, Unit > &  unit = Unit::unitless 
)
static

Creates the item of the given type.

Definition at line 20 of file ResolutionFunctionItemCatalog.cpp.

21 {
22  switch (type) {
23  case Type::None: {
24  auto* p = new ResolutionFunctionNoneItem();
25  p->setUnit(unit);
26  return p;
27  }
28  case Type::Gaussian: {
29  auto* p = new ResolutionFunction2DGaussianItem();
30  p->setUnit(unit);
31  return p;
32  }
33  }
34  ASSERT(false);
35 }
static Type type(const ResolutionFunctionItem *item)
Returns the enum type of the given item.

References Gaussian, None, and type().

Here is the call graph for this function:

◆ type()

ResolutionFunctionItemCatalog::Type ResolutionFunctionItemCatalog::type ( const ResolutionFunctionItem item)
static

Returns the enum type of the given item.

Definition at line 54 of file ResolutionFunctionItemCatalog.cpp.

55 {
56  if (dynamic_cast<const ResolutionFunctionNoneItem*>(item))
57  return Type::None;
58  if (dynamic_cast<const ResolutionFunction2DGaussianItem*>(item))
59  return Type::Gaussian;
60 
61  ASSERT(false);
62 }

References Gaussian, and None.

Referenced by create(), and uiInfo().

◆ types()

QVector< ResolutionFunctionItemCatalog::Type > ResolutionFunctionItemCatalog::types ( )
static

Available types of items.

This list is sorted as expected in the UI (e.g. in combo box)

Definition at line 37 of file ResolutionFunctionItemCatalog.cpp.

38 {
39  return {Type::None, Type::Gaussian};
40 }

References Gaussian, and None.

◆ uiInfo()

ResolutionFunctionItemCatalog::UiInfo ResolutionFunctionItemCatalog::uiInfo ( Type  t)
static

UiInfo on the given type.

Definition at line 42 of file ResolutionFunctionItemCatalog.cpp.

43 {
44  switch (type) {
45  case Type::None:
46  return {"None", ""};
47  case Type::Gaussian:
48  return {"2D Gaussian", ""};
49  }
50  ASSERT(false);
51 }

References Gaussian, None, and type().

Here is the call graph for this function:

The documentation for this class was generated from the following files: