BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
ParticleItem.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/Model/Sample/ParticleItem.h
6 //! @brief Defines class ParticleItem
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLEITEM_H
16 #define BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLEITEM_H
17 
22 #include <memory>
23 
24 class Particle;
25 
27 public:
28  ParticleItem(const MaterialItems* materials);
29  void serialize(Streamer& s) override;
30 
31  std::unique_ptr<Particle> createParticle() const;
32 
33  template <typename T>
34  T* setFormFactorType();
37  QVector<ItemWithParticles*> containedItemsWithParticles() const override;
38 
39 private:
41 };
42 
43 template <typename T>
45 {
46  T* p = new T();
47  setFormFactor(p);
48  return p;
49 }
50 
51 #endif // BORNAGAIN_GUI_MODEL_SAMPLE_PARTICLEITEM_H
Defines FormFactorItems classes.
Defines abstract item with a material property.
Defines abstract item with a material property.
Defines class SelectionProperty.
SelectionProperty< FormFactorItem * > m_formFactor
Definition: ParticleItem.h:40
std::unique_ptr< Particle > createParticle() const
T * setFormFactorType()
Definition: ParticleItem.h:44
void serialize(Streamer &s) override
ParticleItem(const MaterialItems *materials)
QVector< ItemWithParticles * > containedItemsWithParticles() const override
Return full hierarchical contained items with particles.
FormFactorItem * formfactor_at_bottom() const
void setFormFactor(FormFactorItem *p)
Supports serialization to or deserialization from QXmlStream.
Definition: Streamer.h:36