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 #include <anna/core/util/Component.hpp>
10 #include <anna/core/util/ComponentManager.hpp>
12 #include <anna/core/RuntimeException.hpp>
13 #include <anna/core/functions.hpp>
14 #include <anna/xml/Node.hpp>
15 #include <anna/xml/Attribute.hpp>
16 #include <anna/core/tracing/Logger.hpp>
19 anna::Component::Component(const char* className) :
20 a_className(className) {
21 ComponentManager &cm = ComponentManager::instantiate();
25 } catch(anna::RuntimeException& ex) {
30 anna::Component::~Component() {
31 ComponentManager &cm = ComponentManager::instantiate();
35 } catch(anna::RuntimeException& ex) {
40 std::string anna::Component::asString() const
42 std::string result("anna::Component { Name: ");
43 result += a_className;
44 result += " | Reference: ";
45 result += anna::functions::asHexString(anna_ptrnumber_cast(this));
46 return result += " }";
49 anna::xml::Node* anna::Component::asXML(anna::xml::Node* parent) const
51 anna::xml::Node* result = parent->createChild("anna.Component");
52 result->createAttribute("Name", a_className);
53 result->createAttribute("Reference", anna::functions::asHexString(anna_ptrnumber_cast(this)));