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

Description

Main model to hold sample items.

Definition at line 25 of file MultiLayerItems.h.

Public Member Functions

 ~MultiLayerItems ()
 
MultiLayerItemaddMultiLayer ()
 Adds a sample and returns the new item. More...
 
void addMultiLayer (MultiLayerItem *sample)
 
void removeMultiLayer (MultiLayerItem *sample)
 
QVector< MultiLayerItem * > sampleItems () const
 
QStringList sampleNames () const
 
void serialize (Streamer &s)
 

Private Attributes

QVector< MultiLayerItem * > m_samples
 

Constructor & Destructor Documentation

◆ ~MultiLayerItems()

MultiLayerItems::~MultiLayerItems ( )

Definition at line 21 of file MultiLayerItems.cpp.

22 {
23  qDeleteAll(m_samples);
24 }
QVector< MultiLayerItem * > m_samples

References m_samples.

Member Function Documentation

◆ addMultiLayer() [1/2]

MultiLayerItem * MultiLayerItems::addMultiLayer ( )

Adds a sample and returns the new item.

Definition at line 31 of file MultiLayerItems.cpp.

32 {
33  m_samples << new MultiLayerItem();
34  return m_samples.back();
35 }

References m_samples.

Referenced by SampleListModel::createSample(), SampleListModel::createSampleFromExamples(), and SampleListModel::createSampleFromPython().

◆ addMultiLayer() [2/2]

void MultiLayerItems::addMultiLayer ( MultiLayerItem sample)

Definition at line 37 of file MultiLayerItems.cpp.

38 {
39  m_samples << sample;
40 }

References m_samples.

◆ removeMultiLayer()

void MultiLayerItems::removeMultiLayer ( MultiLayerItem sample)

Definition at line 42 of file MultiLayerItems.cpp.

43 {
44  m_samples.removeAll(sample);
45  delete sample;
46 }

References m_samples.

Referenced by SampleListModel::removeSample().

◆ sampleItems()

◆ sampleNames()

QStringList MultiLayerItems::sampleNames ( ) const

Definition at line 48 of file MultiLayerItems.cpp.

49 {
50  QStringList existingNames;
51  for (const auto* item : m_samples)
52  existingNames << item->sampleName();
53  return existingNames;
54 }

References m_samples.

Referenced by SampleListModel::createSample(), and SimulationView::writeOptionsToUI().

◆ serialize()

void MultiLayerItems::serialize ( Streamer s)

Definition at line 56 of file MultiLayerItems.cpp.

57 {
58  s.assertVersion(0);
59  Serialize::rwVector(s, "Multilayers", m_samples);
60 }
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Definition: Streamer.cpp:26
void rwVector(Streamer &s, const QString &tag, QVector< T > &vec, Args... argsForConstructor)
Serializes a list of items of known and fixed type. Passes optional arguments to the constructor.
Definition: Serialize.h:93

References Streamer::assertVersion(), m_samples, and Serialize::rwVector().

Referenced by ProjectDocument::readProject(), and ProjectDocument::writeTo().

Here is the call graph for this function:

Member Data Documentation

◆ m_samples

QVector<MultiLayerItem*> MultiLayerItems::m_samples
private

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