Update documentation on duplicate values

This commit is contained in:
Rodrigo Arias 2023-03-21 09:45:03 +01:00 committed by Rodrigo Arias Mallo
parent 9572d79f72
commit fb95abcc25
2 changed files with 19 additions and 6 deletions

View File

@ -15,7 +15,7 @@ Channels become dirty when a new value is written to them. No other
modifications are allowed by default until the channel is flushed by calling modifications are allowed by default until the channel is flushed by calling
`chan_flush()`. This behavior can be controlled with the `CHAN_DIRTY_WRITE` `chan_flush()`. This behavior can be controlled with the `CHAN_DIRTY_WRITE`
property. By default, a duplicated value cannot be written into a channel, property. By default, a duplicated value cannot be written into a channel,
unless the `CHAN_DUPLICATES` property is set. unless the `CHAN_ALLOW_DUP` or `CHAN_IGNORE_DUP` properties are set.
A channel has an unique name used to identify the channel when debugging and A channel has an unique name used to identify the channel when debugging and
also to create derived channels. The name can be set following the printf style also to create derived channels. The name can be set following the printf style
@ -51,8 +51,14 @@ written to a channel and multiple data types can be stored in the stack.
Channels have properties that can be set by `chan_prop_set()`. Setting the Channels have properties that can be set by `chan_prop_set()`. Setting the
`CHAN_DIRTY_WRITE` property to true allows a channel to modify its value while `CHAN_DIRTY_WRITE` property to true allows a channel to modify its value while
being in the dirty state. The `CHAN_DUPLICATES` property determines is a channel being in the dirty state.
can write the same value to the channel twice.
## Duplicate values
By default, writing the same value to a channel twice is forbidden and will
result in a error. The property `CHAN_ALLOW_DUP` allows writing the same value
to the channel. However, the property `CHAN_IGNORE_DUP` will ignore the attempt
to write the duplicated value with no error.
## Callback ## Callback

View File

@ -16,8 +16,15 @@ A channel can be connected to each row in a trace with `prv_register()`, so the
new values of the channel get written in the trace. Only null and int64 data new values of the channel get written in the trace. Only null and int64 data
values are supported for now. values are supported for now.
Duplicated values cause an error by default, unless the channel is registered
with the flag `PRV_DUP`.
The emission phase is controlled by the [patch bay](../patchbay) and runs all The emission phase is controlled by the [patch bay](../patchbay) and runs all
the emit callbacks at once for all dirty channels. the emit callbacks at once for all dirty channels.
## Duplicate values
When a channel feeds a duplicated value, it causes an error by default. The
behavior of each row when a duplicate value is found can be controlled by the
`flags` in `prv_register()`:
- `PRV_EMITDUP` will emit the duplicate values from the channel to the trace.
- `PRV_SKIPDUP` ignore any duplicate values and don't emit them.