BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
sessionitemcontainer.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/sessionitemcontainer.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_SESSIONITEMCONTAINER_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_MODEL_SESSIONITEMCONTAINER_H
17 
18 #include "mvvm/model/taginfo.h"
19 #include "mvvm/model_export.h"
20 #include <vector>
21 
22 namespace ModelView {
23 
24 class SessionItem;
25 
26 //! Holds collection of SessionItem objects related to the same tag.
27 
28 class MVVM_MODEL_EXPORT SessionItemContainer {
29 public:
30  using container_t = std::vector<SessionItem*>;
31  using const_iterator = container_t::const_iterator;
32 
33  SessionItemContainer(TagInfo tag_info);
37 
38  bool empty() const;
39 
40  int itemCount() const;
41 
42  std::vector<SessionItem*> items() const;
43 
44  bool insertItem(SessionItem* item, int index);
45 
46  SessionItem* takeItem(int index);
47 
48  bool canTakeItem(int index) const;
49 
50  bool canInsertItem(const SessionItem* item, int index) const;
51 
52  int indexOfItem(const SessionItem* item) const;
53 
54  SessionItem* itemAt(int index) const;
55 
56  std::string name() const;
57 
58  TagInfo tagInfo() const;
59 
60  const_iterator begin() const;
61 
62  const_iterator end() const;
63 
64 private:
65  bool maximum_reached() const;
66  bool minimum_reached() const;
67  bool is_valid_item(const SessionItem* item) const;
70 };
71 
72 } // namespace ModelView
73 
74 #endif // BORNAGAIN_MVVM_MODEL_MVVM_MODEL_SESSIONITEMCONTAINER_H
Holds collection of SessionItem objects related to the same tag.
SessionItemContainer & operator=(const SessionItemContainer &)=delete
container_t::const_iterator const_iterator
SessionItemContainer(const SessionItemContainer &)=delete
std::vector< SessionItem * > container_t
The main object representing an editable/displayable/serializable entity.
Definition: sessionitem.h:38
Holds info about single tag for SessionItem.
Definition: taginfo.h:28
materialitems.h Collection of materials to populate MaterialModel.
QString const & name(EShape k)
Definition: particles.cpp:21
Defines class CLASS?