TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
events.hpp
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-3.0-or-later
2#pragma once
3// Event sink for live visualisation and replay (design doc 02 ยง7, protocol in docs/13-viewer-protocol.md).
4// Producers (router, placer, DRC) publish JSON messages; the viewer server implements Sink. Publishing must
5// never block a stage: implementations queue and coalesce.
6#include <memory>
7#include <string>
8
9namespace tmk::events {
10
11class Sink {
12 public:
13 virtual ~Sink() = default;
14 // One JSON object per message (see the protocol document for the message types).
15 virtual void publish(std::string json) = 0;
16 // Transient, droppable messages (search frontiers, ghosts). Return false to let producers skip building them.
17 virtual bool wants_transient() const { return true; }
18};
19
20class NullSink final : public Sink {
21 public:
22 void publish(std::string) override {}
23 bool wants_transient() const override { return false; }
24};
25
26} // namespace tmk::events
void publish(std::string) override
One JSON object per message (see the protocol document for the message types).
Definition events.hpp:22
bool wants_transient() const override
Transient, droppable messages (search frontiers, ghosts). Return false to let producers skip building...
Definition events.hpp:23
virtual void publish(std::string json)=0
One JSON object per message (see the protocol document for the message types).
virtual bool wants_transient() const
Transient, droppable messages (search frontiers, ghosts). Return false to let producers skip building...
Definition events.hpp:17
virtual ~Sink()=default