X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/f61a5ebd00d4620af70c3780ba821f5af68def1c..be1908f8097dbbc871bfd7c55432de43d25647b7:/Model/src/simulator.cpp diff --git a/Model/src/simulator.cpp b/Model/src/simulator.cpp index 2fe6f6e..72c59ca 100644 --- a/Model/src/simulator.cpp +++ b/Model/src/simulator.cpp @@ -10,9 +10,12 @@ Simulator::Simulator(const std::string &filename) xmlDocPtr document; document = xmlParseFile(filename.c_str()); if (document == NULL) { + is_load_ok = false; return; } + is_load_ok = true; + /* bien, el archivo se parseo bien! */ xmlNodePtr nodo, items; nodo = document->children; @@ -40,17 +43,25 @@ Simulator::Simulator(const std::string &filename) // Bien, la planta esta cargada, conectemos todo!! do_connections(nodo->children); } + xmlFreeDoc(document); } Simulator::~Simulator() { - // FIXME REMOVER TODOOOOOO + std::list::iterator i = items.begin(); + PlantItem *o; + + while (i != items.end()) { + o = (*i); + items.remove(o); + delete o; + i = items.begin(); + } } void Simulator::add_pump(const std::string &name, float max_flow, RGB color) { Pump *p = new Pump(name); - // FIXME no va!! p->set_max_flow(max_flow); p->set_color(color); pump_lst.push_back(p); @@ -60,7 +71,6 @@ void Simulator::add_pump(const std::string &name, float max_flow, RGB color) void Simulator::add_union(const std::string &name, float max_flow) { Union *u = new Union(name); - // FIXME no va!! u->set_max_flow(max_flow); union_lst.push_back(u); items.push_back(u); @@ -77,8 +87,6 @@ void Simulator::add_splitter(const std::string &name, float max_flow) void Simulator::add_conduct(const std::string &name, float flujo) { Conduct *p = new Conduct(name); - // FIXME no va!! - std::cout << flujo << std::endl; p->set_max_flow(flujo); conduct_lst.push_back(p); items.push_back(p);