X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/9317ed8f3f8241a30fd09b6800ff96b2ac138747..c5c8d16a2d8c4a0ec1a8d3e83104f73512c91001:/Server/src/plant.cpp diff --git a/Server/src/plant.cpp b/Server/src/plant.cpp index de4e6c1..f3a0a98 100644 --- a/Server/src/plant.cpp +++ b/Server/src/plant.cpp @@ -67,18 +67,6 @@ Plant::Plant(const string& filename): simulator(filename), filename(filename), cerr << __FILE__ << "(" << __LINE__ << ")" << ": constructor. filename = " << filename << endl; #endif // DEBUG - // TODO plant -/* simulator.add_pump("bomba1"); - simulator.add_conduct("c"); - simulator.add_conduct("c1"); - simulator.add_drainage("d"); - simulator.add_tank("tanque"); - - simulator.connect("bomba1", "c", Model::IConector::OUT); - simulator.connect("c", "tanque", Model::IConector::OUT); - simulator.connect("tanque", "c1", Model::IConector::OUT); - simulator.connect("c1", "d", Model::IConector::OUT); -*/ } void Plant::real_run(void) throw() { @@ -130,22 +118,13 @@ bool Plant::transmission_start(string& host, Connection::Port& port) { Transmitter* trans; try { trans = new Transmitter(host, port); - } catch (const sockerr& e) { // TODO - Hace mas selectivo el catch? + } catch (const sockerr& e) { #ifdef DEBUG cerr << __FILE__ << "(" << __LINE__ << ")" << ": transmission_start ERROR (" << e.serrno() << "): " << e.errstr() << endl; #endif // DEBUG - //delete trans; return false; -// } catch (...) { // TODO - Hace mas selectivo el catch? -//#ifdef DEBUG -// cerr << __FILE__ << "(" << __LINE__ << ")" -// << ": transmission_start ERROR: desconocido." -// << endl; -//#endif // DEBUG -// //delete trans; -// return false; } transmissions.push_back(trans); trans->signal_finished().connect(SigC::bind( @@ -210,6 +189,9 @@ const string Plant::get_xml(void) const { #endif // DEBUG ostringstream oss; ifstream ifs(filename.c_str()); + // FIXME Saco la línea de definición de XML (), ver si esta hecho muy + // feo. + ifs.ignore(50, '\n'); // Ignora 50 caracteres o hasta un enter. ifs >> oss.rdbuf(); return oss.str(); } @@ -224,29 +206,6 @@ void Plant::set_paused(bool paused_) { paused = paused_; } -/* -bool Plant::transmission_exists(const string& host, - const Connection::Port& port) { - Glib::Mutex::Lock lock(transmissions_mutex); - for (TransmitterList::const_iterator i = transmissions.begin(); - i != transmissions.end(); i++) { - if (((*i)->get_host() == host) && ((*i)->get_oprt() == port)) { - return true; - } - } - return false; // No la encontró. -} -*/ - -//const std::string& Plant::get_filename(void) const { -// return filename; -//} - -/// \todo FIXME esto deberia estar protegido por un mutex. -//Plant::SignalUpdated& Plant::signal_updated(void) { -// return updated; -//} - } // namespace Server } // namespace PlaQui