BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
taginfo.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/model/mvvm/model/taginfo.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_MODEL_MVVM_MODEL_TAGINFO_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_MODEL_TAGINFO_H
17 
18 #include "mvvm/model_export.h"
19 #include <string>
20 #include <vector>
21 
22 namespace ModelView {
23 
24 //! Holds info about single tag for SessionItem.
25 //! The tag specifies information about children that can be added to a SessionItem. A tag has a
26 //! name, min, max allowed number of children, and vector of all modelTypes that children can have.
27 
28 class MVVM_MODEL_EXPORT TagInfo {
29 public:
30  TagInfo();
31 
32  TagInfo(std::string name, int min, int max, std::vector<std::string> modelTypes);
33 
34  //! Constructs universal tag intended for unlimited amount of various items.
35  static TagInfo universalTag(std::string name, std::vector<std::string> modelTypes = {});
36 
37  //! Constructs tag intended for single property.
38  static TagInfo propertyTag(std::string name, std::string model_type);
39 
40  std::string name() const;
41 
42  int min() const;
43 
44  int max() const;
45 
46  std::vector<std::string> modelTypes() const;
47 
48  bool maximumReached() const;
49 
50  bool isValidChild(const std::string& modelType) const;
51 
52  bool isSinglePropertyTag() const;
53 
54  bool operator==(const TagInfo& other) const;
55  bool operator!=(const TagInfo& other) const;
56 
57 private:
58  std::string m_name;
59  int m_min;
60  int m_max;
61  std::vector<std::string> m_modelTypes;
62 };
63 
64 } // namespace ModelView
65 
66 #endif // BORNAGAIN_MVVM_MODEL_MVVM_MODEL_TAGINFO_H
bool operator!=(const Material &left, const Material &right)
Comparison operator for material wrapper (inequality check)
Definition: Material.cpp:126
bool operator==(const Material &left, const Material &right)
Comparison operator for material wrapper (equality check)
Definition: Material.cpp:113
Holds info about single tag for SessionItem.
Definition: taginfo.h:28
std::vector< std::string > m_modelTypes
Definition: taginfo.h:61
bool maximumReached() const
std::string m_name
Definition: taginfo.h:58
materialitems.h Collection of materials to populate MaterialModel.
std::string model_type
Definition: types.h:23
QString const & name(EShape k)
Definition: particles.cpp:21