ThunderLib
Loading...
Searching...
No Matches
ThunderAutoMode.hpp
1#pragma once
2
3#include <string>
4#include <memory>
5
6namespace thunder {
7
8class ThunderAutoProject;
9
10namespace driver {
11
12class ThunderAutoMode;
13class ThunderAutoModeStep;
14
15} // namespace driver
16
17class ThunderAutoMode;
18
19enum class ThunderAutoModeStepType {
20 UNKNOWN,
21 ACTION,
22 TRAJECTORY,
23 BRANCH_BOOL,
24 BRANCH_SWITCH,
25};
26
28 public:
30
32 ThunderAutoModeStep& operator=(const ThunderAutoModeStep&) = delete;
33 ThunderAutoModeStep(ThunderAutoModeStep&&) noexcept = delete;
34 ThunderAutoModeStep& operator=(ThunderAutoModeStep&&) noexcept = delete;
35
36 bool isValid() const noexcept;
37
38 ThunderAutoModeStepType type() const noexcept;
39
40 std::string getActionName() const noexcept;
41 std::string getTrajectoryName() const noexcept;
42 std::string getConditionName() const noexcept;
43
44 driver::ThunderAutoModeStep* getHandle() noexcept;
45 const driver::ThunderAutoModeStep* getHandle() const noexcept;
46
47 private:
48 friend class ThunderAutoMode;
49
50 // Ownership is transferred to the constructed object.
51 explicit ThunderAutoModeStep(driver::ThunderAutoModeStep* handle) noexcept;
52
53 private:
54 driver::ThunderAutoModeStep* m_handle;
55};
56
57class ThunderAutoMode final {
58 public:
60
61 ThunderAutoMode(const ThunderAutoMode&) = delete;
62 ThunderAutoMode& operator=(const ThunderAutoMode&) = delete;
63 ThunderAutoMode(ThunderAutoMode&&) noexcept = delete;
64 ThunderAutoMode& operator=(ThunderAutoMode&&) noexcept = delete;
65
66 bool isValid() const noexcept;
67
68 std::shared_ptr<ThunderAutoModeStep> getFirstStep();
69 std::shared_ptr<ThunderAutoModeStep> getNextStep(std::shared_ptr<ThunderAutoModeStep> previousStep);
70
71 std::shared_ptr<ThunderAutoModeStep> getFirstStepOfBranch(std::shared_ptr<ThunderAutoModeStep> branchStep,
72 bool booleanCondition);
73 std::shared_ptr<ThunderAutoModeStep> getFirstStepOfBranch(std::shared_ptr<ThunderAutoModeStep> branchStep,
74 int switchCondition);
75
76 bool isRunnable(const ThunderAutoProject& project) const noexcept;
77
78 driver::ThunderAutoMode* getHandle() noexcept;
79 const driver::ThunderAutoMode* getHandle() const noexcept;
80
81 private:
82 friend class ThunderAutoProject;
83
84 // Ownership is transferred to the constructed object.
85 explicit ThunderAutoMode(driver::ThunderAutoMode* handle) noexcept;
86
87 private:
88 driver::ThunderAutoMode* m_handle = nullptr;
89};
90
91} // namespace thunder
Definition ThunderAutoMode.hpp:27
Definition ThunderAutoMode.hpp:57
Definition ThunderAutoProject.hpp:25