summaryrefslogtreecommitdiff
path: root/i/simulotron/src/gs/gs_message.cc
diff options
context:
space:
mode:
Diffstat (limited to 'i/simulotron/src/gs/gs_message.cc')
-rw-r--r--i/simulotron/src/gs/gs_message.cc11
1 files changed, 8 insertions, 3 deletions
diff --git a/i/simulotron/src/gs/gs_message.cc b/i/simulotron/src/gs/gs_message.cc
index 0ab8bb8..df37ca0 100644
--- a/i/simulotron/src/gs/gs_message.cc
+++ b/i/simulotron/src/gs/gs_message.cc
@@ -25,6 +25,7 @@
#include "gs/gs_message.hh"
#include "gs/gs_transmitter.hh"
+#include "utils/simulotron_exception.hh"
#include <stdexcept>
@@ -33,9 +34,9 @@ GSMessage::GSMessage(void)
{
}
-GSMessage::GSMessage(GSTransmitter & gst)
+GSMessage::GSMessage(GSTransmitter & gst, bool bloquant)
{
- gst.getGS(*this);
+ gst.getGS(*this, bloquant);
}
const std::string &
@@ -50,7 +51,7 @@ GSMessage::readGS(void * data, size_t size)
std::string str;
str.assign(igs_, gs_.end());
if (size > str.size())
- throw std::runtime_error("CHIER!!! La size dans readGS est trop grande!!");
+ throw simulotron_exception("GSMessage:", "CHIER!!! La size dans readGS est trop grande!!");
memcpy(data, str.data(), size);
igs_ += size;
}
@@ -66,7 +67,11 @@ GSMessage::getString(std::string & str)
void
GSMessage::getString(std::string & str, size_t size)
{
+ unsigned int pos0;
str.assign(igs_, igs_ + size);
+ pos0 = str.find('\0');
+ if (pos0 != std::string::npos)
+ str.erase(pos0);
igs_ += size;
}