Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
signalcapture_p.h
Go to the documentation of this file.
1#pragma once
2
6
7#include <QtCore/QJsonArray>
8#include <QtCore/QMetaMethod>
9#include <QtCore/QStringList>
10#include <QtCore/QVariantList>
11
12namespace Sonde {
13
14class EventSource;
15class Server;
16
18namespace SignalCapture {
19
26QVariantList arguments(const QMetaMethod &signal, void *const *argv);
27
29QJsonArray toJson(const QVariantList &args, QStringList *texts);
30
33bool &recording();
34
36class Guard
37{
38public:
40 Guard() : m_active(!recording()) { recording() = true; }
43 {
44 if (m_active)
45 recording() = false;
46 }
47 Q_DISABLE_COPY_MOVE(Guard)
48
49
50 bool active() const { return m_active; }
51
52private:
53 bool m_active;
54};
55
56} // namespace SignalCapture
57
60void installSignalTraceTools(Server &server, EventSource *events);
61
62} // namespace Sonde
Base class for anything that produces a stream of events for MCP clients.
Definition eventsource.h:30
An embeddable Model Context Protocol server.
Definition server.h:92
Sets recording() for its lifetime, if it wasn't set already.
Definition signalcapture_p.h:37
~Guard()
Gives the flag back, if this guard took it.
Definition signalcapture_p.h:42
bool m_active
Whether this guard set the flag.
Definition signalcapture_p.h:53
bool active() const
Whether this guard took the flag (false: already recording, so don't).
Definition signalcapture_p.h:50
Guard()
Takes the flag; check active() before recording.
Definition signalcapture_p.h:40
Capturing the arguments of a signal emission.
Definition signalcapture_p.h:18
QJsonArray toJson(const QVariantList &args, QStringList *texts)
Converts what arguments() captured to JSON; texts receives each one as text.
Definition signaltools.cpp:54
bool & recording()
Set while this thread records an emission, so the signals that recording emits (the event machinery's...
Definition signaltools.cpp:72
QVariantList arguments(const QMetaMethod &signal, void *const *argv)
Copies the arguments of an emission of signal, which are argv[1..n].
Definition signaltools.cpp:26
Embeddable Model Context Protocol server for Qt applications.
Definition dispatch.cpp:10
void installSignalTraceTools(Server &server, EventSource *events)
Registers signal_trace_start and signal_trace_stop, which report to events.
Definition signaltrace.cpp:731