Debian Codegraph @

plugins/dm.objectives/ce/specpanel/SpecifierPanelFactory.h

raw
1 #pragma once
2
3 #include "SpecifierPanel.h"
4 #include "../../SpecifierType.h"
5
6 #include <map>
7
8 namespace objectives
9 {
10
11 namespace ce
12 {
13
14 /**
15 * Factory class for creating SpecifierPanel subclasses for a particular type
16 * of SpecifierType.
17 */
18 class SpecifierPanelFactory
19 {
20 // Static map instance
21 typedef std::map<std::string, SpecifierPanelPtr> PanelMap;
22 static PanelMap& getMap();
23
24 public:
25
26 /**
27 * Register a SpecifierPanel subclass.
28 *
29 * This method is invoked by SpecifierPanel subclasses to register
30 * themselves for virtual construction. Once a SpecifierPanel is registered
31 * it can be created and returned by the SpecifierPanelFactory::create()
32 * method based on its SpecifierType type.
33 *
34 * @param name
35 * Name of the SpecifierType type that this panel will edit.
36 *
37 * @param cls
38 * The SpecifierPanel subclass to register.
39 */
40 static void registerType(const std::string& name,
41 SpecifierPanelPtr cls);
42
43 /**
44 * Create a SpecifierPanel to edit the given SpecifierType type.
45 *
46 * @param parent
47 * The parent container needed for widget construction.
48 *
49 * @param name
50 * Name of the SpecifierType type for which a SpecifierPanel must be created.
51 *
52 * @return
53 * Shared pointer to a SpecifierPanel which contains widgets to edit this
54 * SpecifierType type. If no SpecifierPanl has been registered for this type,
55 * a NULL shared_ptr is returned.
56 */
57 static SpecifierPanelPtr create(wxWindow* parent, const std::string& name);
58 };
59
60 }
61
62 }