BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ItemIDFactory.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/utils/ItemIDFactory.h
6 //! @brief Defines class ItemIDFactory
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_COREGUI_UTILS_ITEMIDFACTORY_H
16 #define BORNAGAIN_GUI_COREGUI_UTILS_ITEMIDFACTORY_H
17 
18 #include <QMap>
19 #include <QUuid>
20 
21 class SessionItem;
22 
24 public:
25  // delete copy/move constructor/assignment:
26  ItemIDFactory(const ItemIDFactory&) = delete;
30 
31  static ItemIDFactory& instance();
32 
33  static QString createID(SessionItem* toBeInsertedItem);
34 
35  static QString getID(SessionItem* existingItem);
36 
37  static SessionItem* getItem(QString existingID);
38 
39  static int IDSize();
40 
41 private:
42  ItemIDFactory() = default;
43 
44  QMap<QString, SessionItem*> IDtoItemMap;
45  QMap<SessionItem*, QString> ItemtoIDMap;
46 };
47 
48 #endif // BORNAGAIN_GUI_COREGUI_UTILS_ITEMIDFACTORY_H
static int IDSize()
ItemIDFactory & operator=(ItemIDFactory &&)=delete
ItemIDFactory(ItemIDFactory &&)=delete
ItemIDFactory()=default
QMap< QString, SessionItem * > IDtoItemMap
Definition: ItemIDFactory.h:44
ItemIDFactory(const ItemIDFactory &)=delete
static QString getID(SessionItem *existingItem)
QMap< SessionItem *, QString > ItemtoIDMap
Definition: ItemIDFactory.h:45
static SessionItem * getItem(QString existingID)
static ItemIDFactory & instance()
ItemIDFactory & operator=(const ItemIDFactory &)=delete
static QString createID(SessionItem *toBeInsertedItem)