Demultiplexer
Inputs: i1
Controls: c1
...cN
where N is defined by numPorts
Outputs: o1
...oN
where N is defined by numPorts
A Demultiplexer
is an operator that routes its incoming data through its possible output ports.
The choice of the output port is controlled by the messages received through its control ports.
The Demultiplexer
operator holds a message buffer on i1
and c1
...cN
respectivily. A message
received on i1
with time will be routed through ok
if a message with time and value 1 is
recieved on ck
and a message with time and value 0 is received on all controls different that ck
.
A message received on i1
with time will be dropped if a message with time
and value 0 is recieved on all of the control ports c1
...cN
respectively. It is important to notice
that a Demultiplexer
operator expects instructions on the control ports for all messages received on i1
.
Parameters
id: The id of the operator.
numPorts: The number of output ports through which data will be routed. Default value: 1. Minimum value: 1.
Usage
- TypeScript
- Python
- C++
- YAML
- Json
import { Program, Demultiplexer } from "@rtbot-dev/rtbot";
const id = "id";
const numPorts = 2;
const program = new Program();
program.addOperator(new Demultiplexer(id, numPorts));
import rtbot as rb
id = "id";
numPorts = 2;
program = rb.Program()
program.addOperator(rb.Demultiplexer(id, numPorts))
#include "rtbot/Demultiplexer.h"
auto id = "id";
auto numPorts = 2;
auto op = Demultiplexer<std::uint64_t, double>(id, numPorts)
# minimal RtBot program
operators:
- type: Demultiplexer
id: "id"
numPorts: 2
{
"operators": [
{ "type": "Demultiplexer", "id": "id", "numPorts": 2 }
]
}