1 // ANNA - Anna is Not Nothingness Anymore //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
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 //
9 #ifndef anna_core_util_ComponentManager_hpp
10 #define anna_core_util_ComponentManager_hpp
12 #include <anna/core/Singleton.hpp>
13 #include <anna/core/RuntimeException.hpp>
29 class ComponentManager : public Singleton <ComponentManager> {
34 Returns component instance for the class name provided, <null> if not found.
35 \return component instance for the class name provided, <null> if not found.
37 Component* find(const char* className) throw();
40 Class XML representation.
41 \param parent XML node over which we will put instance information.
42 \return XML documentcon with class content.
44 virtual xml::Node* asXML(xml::Node* parent) const throw();
49 std::map < std::string /* class name */, Component* > a_components;
52 // private constructor
53 ComponentManager() {};
55 void attach(Component*) throw(RuntimeException);
56 void detach(Component*) throw(RuntimeException);
59 friend class Singleton <ComponentManager>;
60 friend class Component; // to access attach & detach