src/WhiskerToolbox/TableDesignerWidget/TableDesignerStateData.hpp
src/WhiskerToolbox/TableDesignerWidget/TableDesignerStateData.hpp
Comprehensive serializable state data structure for TableDesignerWidget. More…
Classes
| Name | |
|---|---|
| struct | RowSourceSettings Settings for row source selection. |
| struct | GroupModeSettings Settings for group mode organization. |
| struct | ComputerStateEntry State for a single computer/column in the tree. |
| struct | TableColumnOrder Column order for preview per table. |
| struct | TableDesignerStateData Complete serializable state for TableDesignerWidget. |
Types
| Name | |
|---|---|
| enum class | IntervalRowMode { Beginning, End, Itself} Mode for how intervals are used as row sources. |
Detailed Description
Comprehensive serializable state data structure for TableDesignerWidget.
This file defines the full state structure that TableDesignerState serializes to JSON using reflect-cpp. It captures all persistent state needed for workspace save/restore:
- Currently selected table ID
- Row source selection and settings (capture range, interval mode)
- Column/computer enabled states and custom names
- Group mode settings
- Preview column order
Design Principles
- Nested objects for clarity - Top-level structure uses nested objects for clear JSON organization
- Native enum serialization - Enums serialize as strings automatically
- No Qt types - All Qt types converted to std equivalents (QString → std::string)
- Transient state excluded - Parameter widgets, tree widget state, etc. NOT included
Example JSON Output
{
"instance_id": "abc123",
"display_name": "Table Designer",
"current_table_id": "table_1",
"row_settings": {
"source_name": "Intervals: trial_intervals",
"capture_range": 30000,
"interval_mode": "Beginning"
},
"group_settings": {
"enabled": true,
"pattern": "(.+)_\\d+$"
},
"computer_states": {
"analog:signal_1||Mean": {
"enabled": true,
"column_name": "Signal1_Mean"
}
}
}TableDesignerState for the Qt wrapper class
TableDesignerWidget for the widget implementation
Types Documentation
enum IntervalRowMode
| Enumerator | Value | Description |
|---|---|---|
| Beginning | Use beginning of interval with capture range. | |
| End | Use end of interval with capture range. | |
| Itself | Use the interval as-is (no capture range). |
Mode for how intervals are used as row sources.
Serializes as “Beginning”, “End”, or “Itself” automatically.
Source code
#ifndef TABLE_DESIGNER_STATE_DATA_HPP
#define TABLE_DESIGNER_STATE_DATA_HPP
#include <rfl.hpp>
#include <rfl/json.hpp>
#include <map>
#include <string>
#include <vector>
// ==================== Interval Mode ====================
enum class IntervalRowMode {
Beginning,
End,
Itself
};
// ==================== Row Settings ====================
struct RowSourceSettings {
std::string source_name;
int capture_range = 30000;
IntervalRowMode interval_mode = IntervalRowMode::Beginning;
};
// ==================== Group Mode Settings ====================
struct GroupModeSettings {
bool enabled = true;
std::string pattern = "(.+)_\\d+$";
};
// ==================== Computer State ====================
struct ComputerStateEntry {
bool enabled = false;
std::string column_name;
};
// ==================== Column Order ====================
struct TableColumnOrder {
std::string table_id;
std::vector<std::string> column_names;
};
// ==================== Main State Structure ====================
struct TableDesignerStateData {
// === Identity ===
std::string instance_id;
std::string display_name = "Table Designer";
// === Table Selection ===
std::string current_table_id;
// === Row Source Settings ===
RowSourceSettings row_settings;
// === Group Mode Settings ===
GroupModeSettings group_settings;
// === Computer States ===
// Key format: "dataSource||computerName" (e.g., "analog:signal_1||Mean")
// Value: enabled state and custom column name
std::map<std::string, ComputerStateEntry> computer_states;
// === Column Order ===
// Per-table column order for preview
std::map<std::string, std::vector<std::string>> column_orders;
};
#endif // TABLE_DESIGNER_STATE_DATA_HPPUpdated on 2026-11-13 at 20:25:45 +0000