LoadDevice.hpp
1 #pragma once
2 #include <Device/Node/DeviceNode.hpp>
3 
4 #include <Explorer/Commands/DeviceExplorerCommandFactory.hpp>
5 
6 #include <score/command/AggregateCommand.hpp>
7 #include <score/command/Command.hpp>
8 #include <score/model/path/Path.hpp>
9 
10 #include <score_plugin_deviceexplorer_export.h>
11 
12 namespace Explorer
13 {
14 class DeviceDocumentPlugin;
15 namespace Command
16 {
17 class SCORE_PLUGIN_DEVICEEXPLORER_EXPORT LoadDevice final : public score::Command
18 {
19  SCORE_COMMAND_DECL(DeviceExplorerCommandFactoryName(), LoadDevice, "Load a device")
20 public:
21  LoadDevice(const DeviceDocumentPlugin& devplug, const Device::DeviceSettings& set);
22  LoadDevice(const DeviceDocumentPlugin& devplug, Device::Node&& node);
23 
24  void undo(const score::DocumentContext& ctx) const override;
25  void redo(const score::DocumentContext& ctx) const override;
26 
27 protected:
28  void serializeImpl(DataStreamInput&) const override;
29  void deserializeImpl(DataStreamOutput&) override;
30 
31 private:
32  Device::Node m_deviceNode;
33 };
34 
35 class ReloadWholeDevice final : public score::Command
36 {
37  SCORE_COMMAND_DECL(
38  DeviceExplorerCommandFactoryName(), ReloadWholeDevice, "Reload a device")
39 public:
41  const DeviceDocumentPlugin& devplug, Device::Node&& oldnode,
42  Device::Node&& newnode);
43 
44  void undo(const score::DocumentContext& ctx) const override;
45  void redo(const score::DocumentContext& ctx) const override;
46 
47 protected:
48  void serializeImpl(DataStreamInput&) const override;
49  void deserializeImpl(DataStreamOutput&) override;
50 
51 private:
52  Device::Node m_oldNode;
53  Device::Node m_newNode;
54 };
55 
57 {
58  SCORE_COMMAND_DECL(
59  DeviceExplorerCommandFactoryName(), UpdateAndReloadMacro, "Reload a device")
60 };
61 }
62 }
Definition: LoadDevice.hpp:18
Definition: LoadDevice.hpp:36
Definition: LoadDevice.hpp:57
Allows for grouping of multiple commands in a single one.
Definition: AggregateCommand.hpp:15
The Command class.
Definition: Command.hpp:34
Definition: DataStreamHelpers.hpp:99
Definition: DataStreamHelpers.hpp:103
Definition: DeviceSettings.hpp:16
Definition: DocumentContext.hpp:18