Topologic  0.8.9
TopologyFactoryManager.h
1 // This file is part of Topologic software library.
2 // Copyright(C) 2019, Cardiff University and University College London
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
13 //
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <https://www.gnu.org/licenses/>.
16 
17 #pragma once
18 
19 #include "Topology.h"
20 
21 using namespace System;
22 using namespace System::Collections::Generic;
23 
24 namespace Topologic
25 {
26  namespace Factories
27  {
28  ref class TopologyFactory;
29 
33 
34  ref class TopologyFactoryManager
35  {
36  public protected:
41  static property TopologyFactoryManager^ Instance {
42  TopologyFactoryManager^ get() { return %m_instance; }
43  }
44 
50  void Add(const TopologicCore::Topology::Ptr& topology, TopologyFactory^ value);
51 
57  void Add(String^ key, TopologyFactory^ value);
58 
64  TopologyFactory^ Find(String^ key);
65 
71  static TopologyFactory^ GetDefaultFactory(const TopologicCore::Topology::Ptr& topology);
72 
73  private:
74  TopologyFactoryManager() {}
75  TopologyFactoryManager(const TopologyFactoryManager%) { throw gcnew System::InvalidOperationException("Singleton cannot be copy-constructed"); }
76  static TopologyFactoryManager m_instance;
77  Dictionary<String^, TopologyFactory^>^ m_TopologyFactoryDict = gcnew Dictionary<String^, TopologyFactory^>();
78  };
79  }
80 }
Topologic is an open-source software modelling library enabling hierarchical and topological represen...
Definition: About.h:23