Updates to message framework documentation

This commit is contained in:
John Wellbelove 2026-05-28 14:27:15 +01:00
parent 28b3a0f38c
commit b8c5990585
9 changed files with 29 additions and 4 deletions

View File

@ -2,3 +2,22 @@
title: "Messaging"
weight: 100
---
## Headers
- `message.h`
Defines the core message model. etl::imessage is the base interface (virtual or non-virtual, depending on `ETL_HAS_VIRTUAL_MESSAGES`). `etl::message<ID>` provides typed messages with static IDs. Type traits (`is_message`, `is_message_type`, etc.) and ID comparison utilities support compile-time validation.
- `message_router.h`
Defines `etl::imessage_router`, the central routing interface with receive, accepts, and router identity. Provides message_router<TDerived, ...> that statically dispatches by message ID (contiguous IDs optimized). Includes null_message_router and message_producer helpers, plus send_message utilities.
- `message_bus.h`
Implements `etl::imessage_bus`, a router that manages a sorted list of subscribed routers and forwards messages based on destination ID (broadcast or addressed). Supports subscription limits and forwards to successors.
- `message_broker.h`
Implements etl::message_broker, a router with explicit subscription objects mapping routers to message ID lists (span). It routes only to subscribers that match both message ID and destination ID, then forwards to any successor.
- `message_packet.h`
A type-erased, in-place container for a fixed set of message types. Validates message ID acceptance, supports copy/move, and exposes `get()` as `etl::imessage&`. Uses aligned storage sized to the largest message type.
- `shared_message.h`
Reference-counted wrapper around pooled messages (`ireference_counted_message_pool`). Supports copy/move semantics with automatic release when the last reference drops.
## Basic architecture
![message-framework](images/message-framework.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -1,5 +1,6 @@
---
title: "message_broker"
weight: 6
---
{{< callout type="info">}}

View File

@ -1,5 +1,6 @@
---
title: "message_bus"
weight: 5
---
{{< callout type="info">}}

View File

@ -1,5 +1,6 @@
---
title: "message_router_registry"
weight: 4
---
{{< callout type="info">}}

View File

@ -1,5 +1,6 @@
---
title: message_router
weight: 3
---
A class that will automatically route incoming messages to specific handlers based on the message types declared in the template parameter list. Messages are passed to the receive member function which will static cast it to its real type and call the matching on_receive function in the derived class. A compilation error will occur if the matching on_receive does not exist.
@ -16,7 +17,6 @@ etl::null_message_router
Note: This C++03 portion of this header is a generated from `message_router_generator.h`. To handle more than the standard 16 message types then a new one must be generated.
See [Generators](./generators-tutorial)
## Message router ID
Allowable router IDs run from `0` to `MAX_MESSAGE_ROUTER` (`249`) inclusive.

View File

@ -1,5 +1,6 @@
---
title: "Messages"
title: "message"
weight: 1
---
{{< callout type="info">}}

View File

@ -1,5 +1,6 @@
---
title: "shared_message"
weight: 2
---
{{< callout type="info">}}

View File

@ -11,8 +11,8 @@ If `A` & `B` are vectors, the dot product is `|A||B|cos(θ)`, where `θ` is the
`|A|` is the length of the vector `A`.
`|B|` is the length of the vector `B`.
Therefore, we can calculate `Cos(θ) = (A ⋅ B)/(|A||B|)`.
A dot product of `0` indicates two perpendicular lines, and that the dot product is greatest when the lines are parallel.
Therefore, we can calculate `cos(θ) = (A ⋅ B)/(|A||B|)`.
A dot product of `0` indicates two perpendicular lines, and the dot product is greatest when the lines are parallel.
## Cross Product
@ -20,3 +20,4 @@ The cross product of vectors `(x1, y1)` and `(x2, y2)` is `x1 * y2 - y1 * x2`
If `A` & `B` are vectors, the cross product is `|A||B|sin(θ)`.
`|θ|` is the angle between the two vectors, but `θ` can be positive or negative.
Therefore, we can calculate `sin(θ) = (A x B)/(|A||B|)`.