Switch
Picks one of several value sets and unpacks it into individual output ports
Overview
Selects one active bundle among multiple incoming ValueSet (Set) inputs and unpacks its elements into individual typed output ports. All connected Set inputs must share the same schema (the same number of elements and the same sequence of primitive types).
When you connect a ValueSet to a Switch input port, the Switch node automatically synchronizes its dynamic output ports to match the row count, names, and data types of the connected ValueSet. Clicking a radio button on the Switch card or changing the active input in the inspector immediately switches which upstream ValueSet feeds the downstream pipeline.
When to Use
- Switching between multiple NIST/RFC test vectors (e.g., 128-bit vs. 256-bit test cases, or valid vs. tampered ciphertext vectors) without rewiring the workflow.
- Toggling between a deterministic debug key/IV bundle and a randomized key/IV bundle during protocol development.
Parameter Configuration
Switch is configured via its active-branch selector on the node card and in the property inspector:
| Setting | Type | Default | Description |
|---|---|---|---|
Active Input (selected) |
select (Input port ID) |
in_1 (first connected input) |
Selects which incoming Set port is routed to the unpacked output ports at runtime. If the selected port is unconnected, the node falls back to the first connected input port. |
Port I/O Specification
See Ports & Connections for general wiring rules, data type colors, and dynamic port creation.
Input Ports
| Attribute | Specification |
|---|---|
| Port Nature | Dynamic / Variable Input Ports |
| Initial Default on Canvas | Starts with 1 default input port (Set 1, id: in_1, type Set). |
| Port Count Range | 1 or more Set input ports. |
| Allowed Data Types | Set only (must be connected from a ValueSet node's Set output port, and all connected sets must have matching row types). |
| Adding & Managing Ports | Drag a connection from another ValueSet onto the [+] auto-create handle or add/remove input ports in the inspector. |
| Evaluation & Ordering Rule | Each input port represents one candidate ValueSet branch; only the branch matching Active Input is unpacked at runtime. |
Output Ports
| Attribute | Specification |
|---|---|
| Port Nature | Dynamic / Variable Output Ports (Schema-Synchronized) |
| Initial Default on Canvas | 0 output ports before a ValueSet is connected; automatically populated to match the connected ValueSet rows upon connection. |
| Port Count Range | Matches the number of rows in the connected ValueSet. |
| Allowed Data Types | Bytes, String, Int, or Bool (mirrors the element types of the connected ValueSet). |
| Adding & Managing Ports | Output port count and types are automatically derived from the connected ValueSet schema; output port labels can be customized in the inspector. |
| Evaluation & Ordering Rule | The i-th output port receives the i-th row value from the currently active ValueSet input. |
Error Cases
When any of the following conditions occurs at runtime, this node transitions to an ERROR state and downstream nodes connected to its outputs do not execute.
| Error Code | Default Engine Message | Trigger Condition |
|---|---|---|
SET_SCHEMA_MISMATCH |
The active set is not compatible with the baseline set | Raised on a Switch node when the selected active ValueSet does not have the same row count and row types as the baseline ValueSet. |
Examples
Toggling Between Two Cryptographic Test Vectors
Connect two ValueSet nodes to a Switch node to swap all inputs to an encryption pipeline at once.
- Create two ValueSet nodes, each with rows
Key (Bytes)andPlaintext (Bytes). - Connect the
Setoutput of the first ValueSet toSet 1on the Switch node, and the second ValueSet to the[+]handle (creatingSet 2). - Connect the Switch node's unpacked
KeyandPlaintextoutput ports to your cipher node, and toggle betweenSet 1andSet 2.