TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
messages.hpp File Reference

Builders for viewer protocol v1 messages (docs/13-viewer-protocol.md). More...

#include <cstdint>
#include <span>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include "model/board.hpp"

Go to the source code of this file.

Classes

struct  tmk::server::RatsEdge
struct  tmk::server::PathPoint
struct  tmk::server::Failure
struct  tmk::server::Stats

Namespaces

namespace  tmk
namespace  tmk::server

Typedefs

using tmk::server::ObjectId = std::int64_t

Functions

std::string tmk::server::board_snapshot_json (const model::Board &b, const std::string &name, bool freeze=true)
 Full scene snapshot (board).
std::string tmk::server::track_add (ObjectId id, const model::Track &t)
std::string tmk::server::track_add (ObjectId id, model::Point a, model::Point b, Coord width, int layer, model::NetId net)
std::string tmk::server::track_remove (ObjectId id)
std::string tmk::server::via_add (ObjectId id, const model::Via &v)
std::string tmk::server::via_remove (ObjectId id)
std::string tmk::server::footprint_move (std::string_view ref, model::Point pos, double angle)
std::string tmk::server::ratsnest (std::span< const RatsEdge > edges)
std::string tmk::server::frontier (std::int64_t conn, int layer, std::span< const model::Point > pts)
 Transient: sampled points of an active search frontier on one copper layer.
std::string tmk::server::path_try (std::int64_t conn, std::span< const PathPoint > pts)
 Transient: a candidate path being evaluated.
std::string tmk::server::failure (const Failure &f)
std::string tmk::server::stats (const Stats &s)
std::string tmk::server::stage (std::string_view name, std::string_view state, std::string_view detail={})
 state is "begin" or "end".
std::string tmk::server::log (std::string_view level, std::string_view text)
 level: "debug" | "info" | "warn" | "error".
std::string tmk::server::heatmap (std::string_view name, model::Point origin, Coord cell, int w, int h, int layer, double max, std::span< const std::uint8_t > data)
 Overlay grid: data is row-major w*h bytes (0–255), cell size in nm, origin (x0, y0); layer -1 = all layers.
std::string tmk::server::message_type (std::string_view json)
 Returns the value of the top-level "type" key of a message, or an empty string.

Detailed Description

Builders for viewer protocol v1 messages (docs/13-viewer-protocol.md).

Pure functions returning one JSON object per message, ready for events::Sink::publish(). No Boost or networking: the router links only this library (tm::viz) and publishes into whatever Sink it was given.

Every message starts with its "type" key (insertion-ordered JSON), so a server can classify messages by looking at the first bytes without parsing them.

Definition in file messages.hpp.