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

Description

Definition at line 23 of file DetectorItemCatalog.h.

Classes

struct  UiInfo
 

Public Types

using CatalogedType = DetectorItem
 
enum class  Type : uint8_t { Spherical = 0 , Rectangular = 1 }
 

Static Public Member Functions

static DetectorItemcreate (Type type)
 Creates the item of the given type. More...
 
static Type type (const DetectorItem *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 DetectorItemCatalog::Type : uint8_t
strong
Enumerator
Spherical 
Rectangular 

Definition at line 28 of file DetectorItemCatalog.h.

28 : uint8_t { Spherical = 0, Rectangular = 1 };

Member Function Documentation

◆ create()

DetectorItem * DetectorItemCatalog::create ( Type  type)
static

Creates the item of the given type.

Definition at line 20 of file DetectorItemCatalog.cpp.

21 {
22  switch (type) {
23  case Type::Spherical:
24  return new SphericalDetectorItem();
25  case Type::Rectangular:
26  return new RectangularDetectorItem();
27  }
28  ASSERT(false);
29 }
static Type type(const DetectorItem *item)
Returns the enum type of the given item.

References Rectangular, Spherical, and type().

Here is the call graph for this function:

◆ type()

DetectorItemCatalog::Type DetectorItemCatalog::type ( const DetectorItem item)
static

Returns the enum type of the given item.

Definition at line 47 of file DetectorItemCatalog.cpp.

48 {
49  if (dynamic_cast<const SphericalDetectorItem*>(item))
50  return Type::Spherical;
51  if (dynamic_cast<const RectangularDetectorItem*>(item))
52  return Type::Rectangular;
53 
54  ASSERT(false);
55 }

References Rectangular, and Spherical.

Referenced by create(), and uiInfo().

◆ types()

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

Available types of items.

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

Definition at line 31 of file DetectorItemCatalog.cpp.

32 {
34 }

References Rectangular, and Spherical.

◆ uiInfo()

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

UiInfo on the given type.

Definition at line 36 of file DetectorItemCatalog.cpp.

37 {
38  switch (type) {
39  case Type::Spherical:
40  return {"Spherical detector", ""};
41  case Type::Rectangular:
42  return {"Rectangular detector", ""};
43  }
44  ASSERT(false);
45 }

References Rectangular, Spherical, and type().

Here is the call graph for this function:

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