Loading...
Searching...
No Matches
ReplaceDevice.hpp
1#pragma once
2#include <Device/Node/DeviceNode.hpp>
3
4#include <Explorer/Commands/DeviceExplorerCommandFactory.hpp>
5
6#include <score/command/Command.hpp>
7#include <score/model/path/Path.hpp>
8
9struct DataStreamInput;
10struct DataStreamOutput;
11
12namespace Explorer
13{
14class DeviceDocumentPlugin;
15namespace Command
16{
17// Replaces all the nodes of a device by new nodes.
18class ReplaceDevice final : public score::Command
19{
20 SCORE_COMMAND_DECL(
21 DeviceExplorerCommandFactoryName(), ReplaceDevice, "Replace a device")
22public:
24 const DeviceDocumentPlugin& device_tree, int deviceIndex, Device::Node&& rootNode);
26 const DeviceDocumentPlugin& device_tree, int deviceIndex, Device::Node&& oldDevice,
27 Device::Node&& newDevice);
28
29 void undo(const score::DocumentContext& ctx) const override;
30 void redo(const score::DocumentContext& ctx) const override;
31
32protected:
33 void serializeImpl(DataStreamInput&) const override;
34 void deserializeImpl(DataStreamOutput&) override;
35
36private:
37 int m_deviceIndex{};
38 Device::Node m_deviceNode;
39 Device::Node m_savedNode;
40};
41}
42}
Definition ReplaceDevice.hpp:19
The Command class.
Definition Command.hpp:34
Definition DataStreamHelpers.hpp:99
Definition DataStreamHelpers.hpp:103
Definition DocumentContext.hpp:18