]> git.llucax.com Git - z.facultad/75.42/plaqui.git/blobdiff - Model/src/simulator.cpp
Ahora genera libplaquimodel.a.
[z.facultad/75.42/plaqui.git] / Model / src / simulator.cpp
index 2d763fe58482409cf098408488e77d69efdd3279..3aeacd667c25c3af77b8fce1853f51e7c6dbe673 100644 (file)
@@ -158,17 +158,27 @@ IConector *Simulator::find(const std::string &name)
        return NULL;
 }
 
        return NULL;
 }
 
-bool Simulator::pump_deactivate(const std::string &name)
+bool Simulator::set_open(const std::string &name, bool open)
 {
        // Busco el elemento, usando RTTI :-(
 {
        // Busco el elemento, usando RTTI :-(
-       Pump *pump = dynamic_cast<Pump *>(find(name));
-
-       if (!pump) {
-               // Ups!, "name" no era un Pump!!!
+       IConector *tmp = find(name);
+       Pump *p;
+       Exclusa *e;
+       if ((p = dynamic_cast<Pump*>(tmp))) {
+               if (open) {
+                       p->activate();
+               } else {
+                       p->deactivate();
+               }
+       } else if ((e = dynamic_cast<Exclusa*>(tmp))) {
+               if (open) {
+                       e->open();
+               } else {
+                       e->close();
+               }
+       } else {
                return false;
        }
                return false;
        }
-       pump->deactivate();
-       return true;
 }
 
 void Simulator::loadBomba(xmlNodePtr nodo)
 }
 
 void Simulator::loadBomba(xmlNodePtr nodo)