1
0
forked from fsfw/fsfw

new service interface stream

This commit is contained in:
2020-06-04 19:40:43 +02:00
parent f2a9d29696
commit 6ff1cf46c5
4 changed files with 63 additions and 64 deletions

View File

@ -10,25 +10,22 @@
* std::cerr but has additional capability. Add preamble and timestamp
* to output. Can be run in buffered or unbuffered mode.
*/
class ServiceInterfaceStream :
public std::ostream {
protected:
ServiceInterfaceBuffer buf;
class ServiceInterfaceStream : public std::ostream {
public:
/**
* This constructor is used by specifying the preamble message.
* Optionally, the output can be directed to stderr and a CR character
* can be prepended to the preamble.
* @param setMessage message of preamble.
* @param addCrToPreamble Useful for applications like Puttty.
* @param buffered specify whether to use buffered mode.
* @param errStream specify which output stream to use (stderr or stdout).
*/
ServiceInterfaceStream(std::string setMessage,
bool addCrToPreamble = false, bool buffered = true,
/**
* This constructor is used by specifying the preamble message.
* Optionally, the output can be directed to stderr and a CR character
* can be prepended to the preamble.
* @param setMessage message of preamble.
* @param addCrToPreamble Useful for applications like Puttty.
* @param buffered specify whether to use buffered mode.
* @param errStream specify which output stream to use (stderr or stdout).
*/
ServiceInterfaceStream(std::string setMessage,
bool addCrToPreamble = false, bool buffered = true,
bool errStream = false, uint16_t port = 1234);
//! An inactive stream will not print anything.
//! An inactive stream will not print anything.
void setActive( bool );
/**
@ -45,7 +42,8 @@ public:
void print(std::string error, bool withPreamble = true,
bool withNewline = true, bool flush = true);
bool buffered = false;
protected:
ServiceInterfaceBuffer streambuf;
};
// Forward declaration of interface streams. These should be instantiated in