Rerun C++ SDK
Loading...
Searching...
No Matches
rerun::archetypes::StateConfiguration Struct Reference

Archetype: Define the style and mapping for state values in a state timeline view. More...

#include <rerun/archetypes/state_configuration.hpp>

Public Member Functions

 StateConfiguration (StateConfiguration &&other)=default
 
 StateConfiguration (const StateConfiguration &other)=default
 
StateConfigurationoperator= (const StateConfiguration &other)=default
 
StateConfigurationoperator= (StateConfiguration &&other)=default
 
StateConfiguration with_values (const Collection< rerun::components::Text > &_values) &&
 The raw state values that this configuration applies to.
 
StateConfiguration with_labels (const Collection< rerun::components::Text > &_labels) &&
 Display labels for each state value.
 
StateConfiguration with_colors (const Collection< rerun::components::Color > &_colors) &&
 Colors for each state value.
 
StateConfiguration with_visible (const Collection< rerun::components::Visible > &_visible) &&
 Visibility for each state value.
 
Collection< ComponentColumncolumns (const Collection< uint32_t > &lengths_)
 Partitions the component data into multiple sub-batches.
 
Collection< ComponentColumncolumns ()
 Partitions the component data into unit-length sub-batches.
 

Static Public Member Functions

static StateConfiguration update_fields ()
 Update only some specific fields of a StateConfiguration.
 
static StateConfiguration clear_fields ()
 Clear all the fields of a StateConfiguration.
 

Public Attributes

std::optional< ComponentBatchvalues
 The raw state values that this configuration applies to.
 
std::optional< ComponentBatchlabels
 Display labels for each state value.
 
std::optional< ComponentBatchcolors
 Colors for each state value.
 
std::optional< ComponentBatchvisible
 Visibility for each state value.
 

Static Public Attributes

static constexpr const char ArchetypeName [] = "rerun.archetypes.StateConfiguration"
 The name of the archetype as used in ComponentDescriptors.
 
static constexpr auto Descriptor_values
 ComponentDescriptor for the values field.
 
static constexpr auto Descriptor_labels
 ComponentDescriptor for the labels field.
 
static constexpr auto Descriptor_colors
 ComponentDescriptor for the colors field.
 
static constexpr auto Descriptor_visible
 ComponentDescriptor for the visible field.
 

Detailed Description

Archetype: Define the style and mapping for state values in a state timeline view.

This archetype provides configuration for how state values are displayed. It maps raw state values to display labels, colors, and visibility.

values, labels, colors, and visible are parallel arrays: the entry at index i of each describes the same state value, and only the per-index pairing is meaningful. The four arrays should have matching length; any secondary array (labels, colors, visible) that is shorter than values falls back to defaults for the missing entries.

It's generally recommended to log this type as static.

The underlying data needs to be logged to the same entity path using archetypes::StateChange.

Example

State changes with a custom style

#include <rerun.hpp>
int main(int argc, char* argv[]) {
const auto rec = rerun::RecordingStream("rerun_example_state_configuration");
rec.spawn().exit_on_failure();
// Configure how each raw state value is displayed (label, color, visibility).
rec.log_static(
"door",
.with_values({"open", "closed"})
.with_labels({"Open", "Closed"})
.with_colors({0x4CAF50FF, 0xEF5350FF})
);
rec.set_time_sequence("step", 0);
rec.log("door", rerun::StateChange().with_state("open"));
rec.set_time_sequence("step", 1);
rec.log("door", rerun::StateChange().with_state("closed"));
rec.set_time_sequence("step", 2);
rec.log("door", rerun::StateChange().with_state("open"));
}
A RecordingStream handles everything related to logging data into Rerun.
Definition recording_stream.hpp:73
Archetype: A state change, representing a transition of an entity into a new state.
Definition state_change.hpp:51
Archetype: Define the style and mapping for state values in a state timeline view.
Definition state_configuration.hpp:67
StateConfiguration with_colors(const Collection< rerun::components::Color > &_colors) &&
Colors for each state value.
Definition state_configuration.hpp:154
StateConfiguration with_values(const Collection< rerun::components::Text > &_values) &&
The raw state values that this configuration applies to.
Definition state_configuration.hpp:136
StateConfiguration with_labels(const Collection< rerun::components::Text > &_labels) &&
Display labels for each state value.
Definition state_configuration.hpp:145

This type is unstable and may change significantly in a way that the data won't be backwards compatible.

Member Function Documentation

◆ with_values()

StateConfiguration rerun::archetypes::StateConfiguration::with_values ( const Collection< rerun::components::Text > &  _values) &&
inline

The raw state values that this configuration applies to.

Each entry defines a known state value. The order determines the mapping to labels, colors, and visible (by index).

◆ with_labels()

StateConfiguration rerun::archetypes::StateConfiguration::with_labels ( const Collection< rerun::components::Text > &  _labels) &&
inline

Display labels for each state value.

If provided, the label at index i is shown instead of the raw value at index i. If not provided or shorter than values, the raw value is used as the label.

◆ with_colors()

StateConfiguration rerun::archetypes::StateConfiguration::with_colors ( const Collection< rerun::components::Color > &  _colors) &&
inline

Colors for each state value.

If provided, the color at index i is used for the state at index i. If not provided, colors are assigned automatically from a built-in palette.

◆ with_visible()

StateConfiguration rerun::archetypes::StateConfiguration::with_visible ( const Collection< rerun::components::Visible > &  _visible) &&
inline

Visibility for each state value.

If provided, the visibility at index i controls whether the state at index i is shown. If not provided, all state values are visible.

◆ columns() [1/2]

Collection< ComponentColumn > rerun::archetypes::StateConfiguration::columns ( const Collection< uint32_t > &  lengths_)

Partitions the component data into multiple sub-batches.

Specifically, this transforms the existing ComponentBatch data into ComponentColumns instead, via ComponentBatch::partitioned.

This makes it possible to use RecordingStream::send_columns to send columnar data directly into Rerun.

The specified lengths must sum to the total length of the component batch.

◆ columns() [2/2]

Collection< ComponentColumn > rerun::archetypes::StateConfiguration::columns ( )

Partitions the component data into unit-length sub-batches.

This is semantically similar to calling columns with std::vector<uint32_t>(n, 1), where n is automatically guessed.

Member Data Documentation

◆ values

std::optional<ComponentBatch> rerun::archetypes::StateConfiguration::values

The raw state values that this configuration applies to.

Each entry defines a known state value. The order determines the mapping to labels, colors, and visible (by index).

◆ labels

std::optional<ComponentBatch> rerun::archetypes::StateConfiguration::labels

Display labels for each state value.

If provided, the label at index i is shown instead of the raw value at index i. If not provided or shorter than values, the raw value is used as the label.

◆ colors

std::optional<ComponentBatch> rerun::archetypes::StateConfiguration::colors

Colors for each state value.

If provided, the color at index i is used for the state at index i. If not provided, colors are assigned automatically from a built-in palette.

◆ visible

std::optional<ComponentBatch> rerun::archetypes::StateConfiguration::visible

Visibility for each state value.

If provided, the visibility at index i controls whether the state at index i is shown. If not provided, all state values are visible.

◆ Descriptor_values

constexpr auto rerun::archetypes::StateConfiguration::Descriptor_values
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "StateConfiguration:values",
Loggable<rerun::components::Text>::ComponentType
)
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition state_configuration.hpp:94

ComponentDescriptor for the values field.

◆ Descriptor_labels

constexpr auto rerun::archetypes::StateConfiguration::Descriptor_labels
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "StateConfiguration:labels",
Loggable<rerun::components::Text>::ComponentType
)

ComponentDescriptor for the labels field.

◆ Descriptor_colors

constexpr auto rerun::archetypes::StateConfiguration::Descriptor_colors
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "StateConfiguration:colors",
Loggable<rerun::components::Color>::ComponentType
)

ComponentDescriptor for the colors field.

◆ Descriptor_visible

constexpr auto rerun::archetypes::StateConfiguration::Descriptor_visible
staticconstexpr
Initial value:
= ComponentDescriptor(
ArchetypeName, "StateConfiguration:visible",
Loggable<rerun::components::Visible>::ComponentType
)

ComponentDescriptor for the visible field.


The documentation for this struct was generated from the following file: