X-Git-Url: https://git.llucax.com/z.facultad/75.42/plaqui.git/blobdiff_plain/dd5a5045d5549015b6500726098cb43d1e1c614c..9523acd2d7be7b8bbbf6d8c786c68c91f9fcc700:/Server/src/plant.cpp?ds=inline diff --git a/Server/src/plant.cpp b/Server/src/plant.cpp index c56035c..69ce671 100644 --- a/Server/src/plant.cpp +++ b/Server/src/plant.cpp @@ -28,6 +28,9 @@ #include "plaqui/server/plant.h" #include #include +#include +#include +#include #ifdef DEBUG # include #endif // DEBUG @@ -50,7 +53,7 @@ Plant::~Plant(void) { } } -Plant::Plant(const string& filename): simulator(filename) { +Plant::Plant(const string& filename): simulator(filename), filename(filename) { #ifdef DEBUG cerr << __FILE__ << ": constructor. filename = " << filename << endl; #endif // DEBUG @@ -83,8 +86,7 @@ void Plant::real_run(void) { } } -bool Plant::transmission_start(const string& host, - const Connection::Port& port) { +bool Plant::transmission_start(string& host, Connection::Port& port) { Glib::Mutex::Lock lock(transmissions_mutex); for (TransmitterList::iterator i = transmissions.begin(); i != transmissions.end(); i++) { @@ -117,6 +119,19 @@ bool Plant::transmission_stop(const string& host, return false; // No la encontrĂ³. } +const string Plant::get_xml(void) const { + ostringstream oss; + try { + ifstream ifs(filename.c_str()); + ifs >> noskipws; + copy(istream_iterator(ifs), istream_iterator(), + ostream_iterator(oss)); + } catch (...) { // TODO hacerlo mas selectivo? + return ""; + } + return oss.str(); +} + /* bool Plant::transmission_exists(const string& host, const Connection::Port& port) {