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

Description

Definition at line 23 of file BackgroundItemCatalog.h.

Classes

struct  UiInfo
 

Public Types

using CatalogedType = BackgroundItem
 
enum class  Type : uint8_t { None = 0 , Constant = 1 , Poission = 2 }
 

Static Public Member Functions

static BackgroundItemcreate (Type type)
 Creates the item of the given type. More...
 
static Type type (const BackgroundItem *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 BackgroundItemCatalog::Type : uint8_t
strong
Enumerator
None 
Constant 
Poission 

Definition at line 28 of file BackgroundItemCatalog.h.

28 : uint8_t { None = 0, Constant = 1, Poission = 2 };

Member Function Documentation

◆ create()

BackgroundItem * BackgroundItemCatalog::create ( Type  type)
static

Creates the item of the given type.

Definition at line 19 of file BackgroundItemCatalog.cpp.

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 }
static Type type(const BackgroundItem *item)
Returns the enum type of the given item.

References Constant, None, Poission, and type().

Here is the call graph for this function:

◆ type()

BackgroundItemCatalog::Type BackgroundItemCatalog::type ( const BackgroundItem item)
static

Returns the enum type of the given item.

Definition at line 50 of file BackgroundItemCatalog.cpp.

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 }

References Constant, None, and Poission.

Referenced by create(), and uiInfo().

◆ types()

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

Available types of items.

Contains also type "None". This list is sorted as expected in the UI (e.g. in combo box)

Definition at line 32 of file BackgroundItemCatalog.cpp.

33 {
35 }

References Constant, None, and Poission.

◆ uiInfo()

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

UiInfo on the given type.

Definition at line 37 of file BackgroundItemCatalog.cpp.

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 }

References Constant, None, Poission, and type().

Here is the call graph for this function:

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