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);
62 tank_lst.push_back(p);
66 void Simulador::add_drainage(const std::string &name)
68 Drainage *p = new Drainage(name);
70 drainage_lst.push_back(p);
74 bool Simulador::connect(const std::string &name1, const std::string &name2, int flag)
80 if ((o1 == NULL) || (o2 == NULL)) {
81 // NO SE PUDO CONECTAR!, FALTAN ITEMS!!
86 if (flag == IConector::OUT) {
87 b = o1->connect(o2, IConector::OUT);
88 b = b && o2->connect(o1, IConector::IN);
90 b = o1->connect(o2, IConector::IN);
91 b = b && o2->connect(o1, IConector::OUT);
97 void Simulador::simulate()
100 std::list<Pump *>::iterator i1;
101 for(i1=pump_lst.begin(); i1!=pump_lst.end(); i1++)
105 std::list<PlantItem *>::iterator i2;
106 for(i2=items.begin(); i2!=items.end(); i2++)
110 IConector *Simulador::find(const std::string &name)
112 // Busco el item, aca no me importa de que tipo es!
113 std::list<PlantItem *>::iterator i;
114 for(i=items.begin(); i!=items.end(); i++)
115 if ((*i)->get_name() == name)