API — ICoreBlocks/ICoreStudio/StudioObjects/MessageTraffic
The public contract of 2 header(s) under src/ICoreBlocks/ICoreStudio/StudioObjects/MessageTraffic — 2 class/struct definition(s), 16 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.
| Header | Defines | Declarations | Bases |
|---|---|---|---|
ICoreMessageTrafficDiagram.h | ICoreMessageTrafficDiagram | 7 | — |
ICoreMessageTrafficWindow.h | ICoreMessageTrafficWindow | 9 | public ICoreWidget |
ICoreMessageTrafficDiagram.h#
src/ICoreBlocks/ICoreStudio/StudioObjects/MessageTraffic/ICoreMessageTrafficDiagram.h
ICoreMessageTrafficDiagram#
ICoreMessageTrafficDiagram.h:22 · class · nested Arrow, Drop, Layout · 7 declaration(s)
A sequence diagram of a run's message traffic: one LIFELINE per block that sent or read a message, left to right in the order they first appear, time running DOWN, and one ARROW per message from it...
class ICoreMessageTrafficDiagram {
public:
struct Arrow {
std::size_t from = 0; // lifeline indices
std::size_t to = 0;
double sendTime = 0.0;
double takeTime = 0.0; // == sendTime when not taken
bool taken = false;
std::string label; // the value, as "100" or "[1 2]"
};
struct Drop {
std::size_t lifeline = 0;
double time = 0.0;
};
struct Layout {
std::vector<std::string> lifelines; // block paths
std::vector<Arrow> arrows;
std::vector<Drop> drops;
double firstTime = 0.0;
double lastTime = 0.0;
};
// `timeDigits` >= 0 adds each message's send time to its label, to that many decimals,
// as a Sequence Viewer's VariableStepTimePrecision gives it; -1 (the default) leaves it off.
static Layout layoutOf(const std::vector<ICoreMessageTraffic::Event>& events, int timeDigits = -1);
// Where things are drawn in a `width` x `height` area.
static double lifelineX(const Layout& layout, std::size_t lifeline, double width);
static double timeY(const Layout& layout, double time, double height);
static double headerHeight();
// A size that gives every lifeline and every step room.
static double preferredWidth(const Layout& layout);
static double preferredHeight(const Layout& layout);
static void paint(ICorePainter& painter, const Layout& layout, double width, double height);
};
};
ICoreMessageTrafficWindow.h#
src/ICoreBlocks/ICoreStudio/StudioObjects/MessageTraffic/ICoreMessageTrafficWindow.h
ICoreMessageTrafficWindow#
ICoreMessageTrafficWindow.h:16 · class · bases public ICoreWidget · pImpl · 9 declaration(s)
The message traffic of the last run, drawn as a sequence diagram (ICoreMessageTrafficDiagram): lifelines, and an arrow per message from its sender to its reader.
class ICoreMessageTrafficWindow : public ICoreWidget {
public:
explicit ICoreMessageTrafficWindow(ICoreWidget* parent = nullptr);
~ICoreMessageTrafficWindow() override;
// Reads ICoreMessageTraffic again and redraws.
void refresh();
// How many arrows and lifelines the window draws now.
std::size_t arrowCount() const;
std::size_t lifelineCount() const;
// The one window, made on first use, refreshed and shown.
static ICoreMessageTrafficWindow* open();
// What a Sequence Viewer block opens: the traffic at the viewer's level and below, at most
// its History events, each arrow labelled with its send time to its Variable Step Time
// Precision (ICoreMessageTraffic::eventsWithin). One window per viewer, made on first use,
// refreshed and shown; nullptr for a block that is not a Sequence Viewer.
static ICoreMessageTrafficWindow* openFor(const ICoreBlock* viewer);
// What this window shows on each refresh; an empty level is the whole model.
void setFilter(const std::string& levelPath, std::size_t history, int timeDigits);
// The arrows' labels as drawn now, in order.
std::vector<std::string> arrowLabels() const;
private:
class Impl; // the two-line residue; state lives here
std::unique_ptr<Impl> impl;
};