From b4f5256a9ef62f0b4c9c3226597b30839d813c7b Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 29 Aug 2017 16:28:18 -0700 Subject: [PATCH] ArduCopter: add static create method to AP_Rally --- ArduCopter/AP_Rally.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ArduCopter/AP_Rally.h b/ArduCopter/AP_Rally.h index dace66f48a..bfc9e77d6d 100644 --- a/ArduCopter/AP_Rally.h +++ b/ArduCopter/AP_Rally.h @@ -12,7 +12,6 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ - #pragma once #include @@ -20,12 +19,19 @@ class AP_Rally_Copter : public AP_Rally { - public: - // constructor - AP_Rally_Copter(AP_AHRS &ahrs) : AP_Rally(ahrs) {}; + static AP_Rally_Copter create(AP_AHRS &ahrs) { + return AP_Rally_Copter{ahrs}; + } + + constexpr AP_Rally_Copter(AP_Rally_Copter &&other) = default; + + /* Do not allow copies */ + AP_Rally_Copter(const AP_Rally_Copter &other) = delete; + AP_Rally_Copter &operator=(const AP_Rally_Copter&) = delete; private: - bool is_valid(const Location &rally_point) const override; + AP_Rally_Copter(AP_AHRS &ahrs) : AP_Rally(ahrs) { } + bool is_valid(const Location &rally_point) const override; };