Debian Codegraph @

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

raw
1 #include "SpecifierPanelFactory.h"
2
3 namespace objectives
4 {
5
6 namespace ce
7 {
8
9 // Static instance owner
10 SpecifierPanelFactory::PanelMap& SpecifierPanelFactory::getMap()
11 {
12 static PanelMap _instance;
13 return _instance;
14 }
15
16 // Register a panel map
17 void SpecifierPanelFactory::registerType(const std::string& name,
18 SpecifierPanelPtr cls)
19 {
20 getMap().insert(PanelMap::value_type(name, cls));
21 }
22
23 // Create a panel type
24 SpecifierPanelPtr SpecifierPanelFactory::create(wxWindow* parent, const std::string& name)
25 {
26 PanelMap::const_iterator i = getMap().find(name);
27 if (i != getMap().end())
28 return i->second->create(parent);
29 else
30 return SpecifierPanelPtr();
31 }
32
33 }
34
35 }