More work on client and server

This commit is contained in:
2021-11-11 13:56:49 -05:00
parent 051e6bc8bf
commit caa5bab9d3
6 changed files with 314 additions and 199 deletions

View File

@@ -71,9 +71,11 @@
#include "streambuffer.hpp"
#include "util.hpp"
#include "invocation.hpp"
#include <deque>
#include <string>
#include <memory>
#include <ostream>
class PrintBuffer {
private:
@@ -136,5 +138,25 @@ public:
using UniquePrintBuffer = std::unique_ptr<PrintBuffer>;
class PrintChanneler {
private:
int64_t line_;
public:
PrintChanneler() { line_ = 0; }
// Reset the print channeler.
void reset() { line_ = 0; }
// Copy any new lines from the printbuffer to the stdostream.
// Update the current line number. Return true if the printbuffer
// contains any lines that have already been channeled.
bool channel(const PrintBuffer *pb, std::ostream &ostream);
// Generate an invocation that removes unnecessary lines from the
// printbuffer.
Invocation invocation(int64_t actor_id);
};
#endif // PRINTBUFFER_HPP