4 using namespace PlaQui::Model;
10 Simulador::~Simulador()
12 // FIXME REMOVER TODOOOOOO
15 void Simulador::add_pump(const std::string &name)
17 Pump *p = new Pump(name);
20 pump_lst.push_back(p);
24 void Simulador::add_union(const std::string &name)
26 Union *u = new Union(name);
29 union_lst.push_back(u);
33 void Simulador::add_splitter(const std::string &name)
35 Splitter *p = new Splitter(name);
38 split_lst.push_back(p);
42 void Simulador::add_conduct(const std::string &name)
44 Conduct *p = new Conduct(name);
47 conduct_lst.push_back(p);
51 void Simulador::add_exclusa(const std::string &name)
53 Exclusa *p = new Exclusa(name);
55 exclusa_lst.push_back(p);
59 void Simulador::add_tank(const std::string &name)
61 //Tank *p = new Tank(name);
63 //tank_lst.push_back(p);
67 void Simulador::add_drainage(const std::string &name)
69 Drainage *p = new Drainage(name);
71 drainage_lst.push_back(p);
75 bool Simulador::connect(const std::string &name1, const std::string &name2, int flag)
81 if ((o1 == NULL) || (o2 == NULL)) {
82 // NO SE PUDO CONECTAR!, FALTAN ITEMS!!
87 if (flag == IConector::OUT) {
88 b = o1->connect(o2, IConector::OUT);
89 b = b && o2->connect(o1, IConector::IN);
91 b = o1->connect(o2, IConector::IN);
92 b = b && o2->connect(o1, IConector::OUT);
98 void Simulador::simulate()
101 std::list<Pump *>::iterator i1;
102 for(i1=pump_lst.begin(); i1!=pump_lst.end(); i1++)
106 std::list<PlantItem *>::iterator i2;
107 for(i2=items.begin(); i2!=items.end(); i2++)
111 IConector *Simulador::find(const std::string &name)
113 // Busco el item, aca no me importa de que tipo es!
114 std::list<PlantItem *>::iterator i;
115 for(i=items.begin(); i!=items.end(); i++)
116 if ((*i)->get_name() == name)