ANNA Suite  2020b
Multipurpose development suite for Telco applications
ComponentManager.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_core_util_ComponentManager_hpp
10 #define anna_core_util_ComponentManager_hpp
11 
12 #include <anna/core/Singleton.hpp>
14 
15 // STL
16 #include <string>
17 #include <map>
18 
19 namespace anna {
20 namespace xml {
21 class Node;
22 }
23 }
24 
25 namespace anna {
26 
27 class Component;
28 
29 class ComponentManager : public Singleton <ComponentManager> {
30 
31 public:
32 
37  Component* find(const char* className) ;
38 
44  virtual xml::Node* asXML(xml::Node* parent) const ;
45 
46 
47 private:
48 
49  std::map < std::string /* class name */, Component* > a_components;
50 
51 
52  // private constructor
53  ComponentManager() {};
54 
55  // private destructor
56  virtual ~ComponentManager() {};
57 
58  void attach(Component*) noexcept(false);
59  void detach(Component*) noexcept(false);
60 
61 
62  friend class Singleton <ComponentManager>;
63  friend class Component; // to access attach & detach
64 };
65 
66 }
67 
68 #endif
69 
Definition: ComponentManager.hpp:29
Definition: Node.hpp:56
Definition: Singleton.hpp:76
Definition: Component.hpp:39
xml::Node Node
Definition: Node.hpp:21
Definition: app.hpp:12