Editor → Protocol → protocol_transport.h
protocol_transport
| Type | Class |
| Namespace | conjure::editor |
| Include File Path | engine/include/conjure/editor/protocol/protocol_transport.h |
| Source File Path | engine/src/editor/core/protocol/protocol_transport.cpp |
| API ↗ | The AI control protocol, The editor |
Syntax
Derived Classes
Classes that use this as a base
Constructors
| Access | Signature | Description |
|---|---|---|
| public | protocol_transport(); |
Important
Copy constructor and assignment has been deleted.
Destructors
| Access | Signature | Description |
|---|---|---|
| public | virtual ~protocol_transport(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mAllocator | client_id_allocator | {} | |
| private | mNextLocalId | u32 | 1 |
Functions
Public
disconnect
disconnectvirtual void disconnect(
u32 clientId) = 0;Closes a client; the next poll() reports it closed.
flush
flushvirtual void flush() = 0;Writes queued bytes without blocking.
kind
kind[[nodiscard]] virtual transport_kind kind() const noexcept = 0;pending_bytes
pending_bytesBytes queued for a client and not yet written (the backlog policy reads it).
poll
pollvirtual void poll(
std::vector<u32> &outOpened,
std::vector<inbound_line> &outLines,
std::vector<u32> &outClosed) = 0;Collects what happened since the last call: new clients (ids allocated through the allocator), complete lines and closed clients, in that order. Never blocks.
send
sendvirtual void send(
u32 clientId,
std::string_view line) = 0;Queues a line (a newline is appended) for a client. Unknown ids are ignored.
set_client_id_allocator
set_client_id_allocatorvoid set_client_id_allocator(
client_id_allocator allocator);The server installs its id allocator before start(). Without one ids count from 1.
start
start[[nodiscard]] virtual core::result<void> start() = 0;Opens the transport (binds the socket, starts the reader thread).
stop
stopvirtual void stop() = 0;Closes every client and releases the resources. Idempotent.
Protected
allocate_client_id
allocate_client_id[[nodiscard]] u32 allocate_client_id();The next client id from the allocator (or a local counter).