preamble changes started

This commit is contained in:
2020-06-04 14:08:26 +02:00
parent 764608005b
commit f8fb370ae7
5 changed files with 104 additions and 52 deletions

View File

@ -1,15 +1,33 @@
#include <framework/serviceinterface/ServiceInterfaceStream.h>
ServiceInterfaceStream::ServiceInterfaceStream(std::string setMessage,
bool errStream, bool addCrToPreamble, uint16_t port) :
std::ostream(&streambuf),
streambuf(setMessage, errStream, addCrToPreamble, port) {
bool addCrToPreamble, bool buffered, bool errStream, uint16_t port) :
std::ostream(&buf),
buf(setMessage, addCrToPreamble, buffered, errStream, port) {
}
void ServiceInterfaceStream::setActive( bool myActive) {
this->streambuf.isActive = myActive;
this->buf.isActive = myActive;
}
std::string ServiceInterfaceStream::getPreamble() {
return streambuf.getPreamble();
return buf.getPreamble();
}
void ServiceInterfaceStream::print(std::string error,
bool withPreamble, bool withNewline, bool flush) {
if(not buffered and withPreamble) {
*this << getPreamble() << error;
}
else {
*this << error;
}
if(withNewline) {
*this << "\n";
}
// if mode is non-buffered, no need to flush.
if(flush and buffered) {
this->flush();
}
}