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

Description

Definition at line 23 of file Lattice2DItemCatalog.h.

Classes

struct  UiInfo
 

Public Types

using CatalogedType = Lattice2DItem
 
enum class  Type : uint8_t { Basic = 1 , Square = 2 , Hexagonal }
 

Static Public Member Functions

static CatalogedTypecreate (Type type)
 Creates the item of the given type. More...
 
static Type type (const CatalogedType *item)
 Returns the enum type of the given item. More...
 
static QVector< Typetypes ()
 List of available types, sorted as expected in the UI. More...
 
static UiInfo uiInfo (Type t)
 UiInfo on the given type. More...
 

Member Typedef Documentation

◆ CatalogedType

Member Enumeration Documentation

◆ Type

enum Lattice2DItemCatalog::Type : uint8_t
strong
Enumerator
Basic 
Square 
Hexagonal 

Definition at line 28 of file Lattice2DItemCatalog.h.

28 : uint8_t { Basic = 1, Square = 2, Hexagonal };

Member Function Documentation

◆ create()

Lattice2DItemCatalog::CatalogedType * Lattice2DItemCatalog::create ( Type  type)
static

Creates the item of the given type.

Definition at line 19 of file Lattice2DItemCatalog.cpp.

20 {
21  switch (type) {
22  case Type::Basic:
23  return new BasicLattice2DItem();
24  case Type::Square:
25  return new SquareLattice2DItem();
26  case Type::Hexagonal:
27  return new HexagonalLattice2DItem();
28  default:
29  ASSERT(false);
30  }
31 }
static Type type(const CatalogedType *item)
Returns the enum type of the given item.

References Basic, Hexagonal, Square, and type().

Here is the call graph for this function:

◆ type()

Lattice2DItemCatalog::Type Lattice2DItemCatalog::type ( const CatalogedType item)
static

Returns the enum type of the given item.

Definition at line 52 of file Lattice2DItemCatalog.cpp.

53 {
54  ASSERT(item);
55 
56  if (dynamic_cast<const BasicLattice2DItem*>(item))
57  return Type::Basic;
58  if (dynamic_cast<const SquareLattice2DItem*>(item))
59  return Type::Square;
60  if (dynamic_cast<const HexagonalLattice2DItem*>(item))
61  return Type::Hexagonal;
62 
63  ASSERT(false);
64 }

References Basic, Hexagonal, and Square.

Referenced by create(), and uiInfo().

◆ types()

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

List of available types, sorted as expected in the UI.

Definition at line 33 of file Lattice2DItemCatalog.cpp.

34 {
36 }

References Basic, Hexagonal, and Square.

◆ uiInfo()

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

UiInfo on the given type.

Definition at line 38 of file Lattice2DItemCatalog.cpp.

39 {
40  switch (type) {
41  case Type::Basic:
42  return {"Basic", "Two dimensional lattice", ""};
43  case Type::Square:
44  return {"Square", "", ""};
45  case Type::Hexagonal:
46  return {"Hexagonal", "", ""};
47  default:
48  ASSERT(false);
49  }
50 }

References Basic, Hexagonal, Square, and type().

Here is the call graph for this function:

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