Trivial IConfigStore that holds its state in process memory. More...
#include <phosphor-screens/include/PhosphorScreens/InMemoryConfigStore.h>
Public Member Functions | |
| InMemoryConfigStore (QObject *parent=nullptr) | |
| InMemoryConfigStore (int maxScreensPerPhysical, QObject *parent=nullptr) | |
| Construct with an explicit maximum-virtual-screens-per-physical cap. | |
| QHash< QString, VirtualScreenConfig > | loadAll () const override |
| Snapshot every persisted virtual-screen config, keyed by physical screen ID. | |
| VirtualScreenConfig | get (const QString &physicalScreenId) const override |
| Single-key read for callers that only need one entry (e.g. | |
| bool | save (const QString &physicalScreenId, const VirtualScreenConfig &config) override |
Persist config for physicalScreenId. | |
| bool | remove (const QString &physicalScreenId) override |
Drop the entry for physicalScreenId. | |
Public Member Functions inherited from Phosphor::Screens::IConfigStore | |
| IConfigStore (QObject *parent=nullptr) | |
| ~IConfigStore () override=default | |
Static Public Attributes | |
| static constexpr int | DefaultMaxScreensPerPhysical = 8 |
| Production-matching default cap. | |
Additional Inherited Members | |
Signals inherited from Phosphor::Screens::IConfigStore | |
| void | changed () |
| Some entry in the store has changed (via this interface or by an external writer — KCM, settings UI, hand-edited file). | |
Trivial IConfigStore that holds its state in process memory.
Use in unit tests, in hosts that synthesise topology programmatically, and as a placeholder during ScreenManager bring-up before the host's persistent store is wired. No serialisation, no schema migration — configs disappear with the process.
Header-only and inline.
|
inlineexplicit |
|
inlineexplicit |
Construct with an explicit maximum-virtual-screens-per-physical cap.
Pass 0 for "no cap" (test-only; production parity requires matching the daemon's cap).
|
inlineoverridevirtual |
Single-key read for callers that only need one entry (e.g.
the VirtualScreenSwapper, which mutates one physical screen at a time). Returns an empty config if no entry exists for physicalScreenId — callers can distinguish via isEmpty().
Implements Phosphor::Screens::IConfigStore.
|
inlineoverridevirtual |
Snapshot every persisted virtual-screen config, keyed by physical screen ID.
Empty configs are NOT included — absence means "no subdivision". Callers should treat the returned map as authoritative and fully replace any prior cache.
Implements Phosphor::Screens::IConfigStore.
|
inlineoverridevirtual |
Drop the entry for physicalScreenId.
No-op + true if no entry exists; a removal of a missing entry is not an error.
Contract: remove(id) MUST be functionally equivalent to save(id, VirtualScreenConfig{}) — i.e. both forms drop the entry and emit changed(). The empty-config-as-removal sentinel exists because some hosts (Settings-backed adapters) have a single unified setter on their underlying store; exposing both forms lets callers use whichever reads more cleanly at the call site without forcing implementers to duplicate the mutation path.
Implements Phosphor::Screens::IConfigStore.
|
inlineoverridevirtual |
Persist config for physicalScreenId.
An empty config is a removal request; implementations should drop the entry rather than store an empty marker.
Implements Phosphor::Screens::IConfigStore.
|
staticconstexpr |
Production-matching default cap.
Mirrors ScreenManagerConfig::maxVirtualScreensPerPhysical so tests that spin up a store without specifying a cap still exercise the same admission ceiling the daemon enforces. A lower default (or 0 = "no cap") silently accepted over-limit configs the real consumer would have rejected, which masked regressions at the layer boundary. Tests that deliberately want no cap pass 0 explicitly.