TraceMaker
C++ API of the engine
Loading...
Searching...
No Matches
tmk::server Namespace Reference

Classes

struct  RatsEdge
struct  PathPoint
struct  Failure
struct  Stats
class  ReplayWriter
class  ReplayReader
struct  ServerOptions
class  ViewerServer

Typedefs

using ObjectId = std::int64_t

Functions

std::string board_snapshot_json (const model::Board &b, const std::string &name, bool freeze=true)
 Full scene snapshot (board).
std::string track_add (ObjectId id, const model::Track &t)
std::string track_add (ObjectId id, model::Point a, model::Point b, Coord width, int layer, model::NetId net)
std::string track_remove (ObjectId id)
std::string via_add (ObjectId id, const model::Via &v)
std::string via_remove (ObjectId id)
std::string footprint_move (std::string_view ref, model::Point pos, double angle)
std::string ratsnest (std::span< const RatsEdge > edges)
std::string 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 path_try (std::int64_t conn, std::span< const PathPoint > pts)
 Transient: a candidate path being evaluated.
std::string failure (const Failure &f)
std::string stats (const Stats &s)
std::string stage (std::string_view name, std::string_view state, std::string_view detail={})
 state is "begin" or "end".
std::string log (std::string_view level, std::string_view text)
 level: "debug" | "info" | "warn" | "error".
std::string 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 message_type (std::string_view json)
 Returns the value of the top-level "type" key of a message, or an empty string.
std::string default_host ()
 Who can reach the viewer (issue #4, docs/09-visualization.md "Security", D116): by default only this machine.
std::string default_web_root ()
 Default directory of the built viewer: $TM_VIEW_DIR, else <prefix>/share/tracemaker/viewer for a binary in <prefix>/bin, else <repo>/viewer/dist.

Typedef Documentation

◆ ObjectId

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

Definition at line 21 of file messages.hpp.

Function Documentation

◆ board_snapshot_json()

std::string tmk::server::board_snapshot_json ( const model::Board & b,
const std::string & name,
bool freeze = true )

Full scene snapshot (board).

freeze false adds "freeze": false to the snapshot: the viewer does not hold the scene on a routing stall (route –no-freeze, issue #8).

◆ default_host()

std::string tmk::server::default_host ( )

Who can reach the viewer (issue #4, docs/09-visualization.md "Security", D116): by default only this machine.

A viewer bound to any other address requires a token on the page and on /ws (a random one unless token is given; allow_open serves without, a deliberate choice that is said so), and every WebSocket upgrade must come from the server's own origin, so a web page open in the user's browser cannot read the stream. The bind address when none is given: $TM_VIEW_HOST if set, else 127.0.0.1 (this machine only).

◆ default_web_root()

std::string tmk::server::default_web_root ( )

Default directory of the built viewer: $TM_VIEW_DIR, else <prefix>/share/tracemaker/viewer for a binary in <prefix>/bin, else <repo>/viewer/dist.

◆ failure()

std::string tmk::server::failure ( const Failure & f)

◆ footprint_move()

std::string tmk::server::footprint_move ( std::string_view ref,
model::Point pos,
double angle )

◆ frontier()

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.

◆ heatmap()

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.

◆ log()

std::string tmk::server::log ( std::string_view level,
std::string_view text )

level: "debug" | "info" | "warn" | "error".

◆ message_type()

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.

Fast path for messages built here ("type" first); falls back to a full parse otherwise.

◆ path_try()

std::string tmk::server::path_try ( std::int64_t conn,
std::span< const PathPoint > pts )

Transient: a candidate path being evaluated.

◆ ratsnest()

std::string tmk::server::ratsnest ( std::span< const RatsEdge > edges)

◆ stage()

std::string tmk::server::stage ( std::string_view name,
std::string_view state,
std::string_view detail = {} )

state is "begin" or "end".

◆ stats()

std::string tmk::server::stats ( const Stats & s)

◆ track_add() [1/2]

std::string tmk::server::track_add ( ObjectId id,
const model::Track & t )

◆ track_add() [2/2]

std::string tmk::server::track_add ( ObjectId id,
model::Point a,
model::Point b,
Coord width,
int layer,
model::NetId net )

◆ track_remove()

std::string tmk::server::track_remove ( ObjectId id)

◆ via_add()

std::string tmk::server::via_add ( ObjectId id,
const model::Via & v )

◆ via_remove()

std::string tmk::server::via_remove ( ObjectId id)