From beabccf9efb3db53d8faeb676b9bf337eecca2dd Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 29 Aug 2017 16:57:36 -0700 Subject: [PATCH] AP_LandingGear: add static create method --- libraries/AP_LandingGear/AP_LandingGear.h | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/libraries/AP_LandingGear/AP_LandingGear.h b/libraries/AP_LandingGear/AP_LandingGear.h index de7bc78bfc..7f0af1cb4c 100644 --- a/libraries/AP_LandingGear/AP_LandingGear.h +++ b/libraries/AP_LandingGear/AP_LandingGear.h @@ -11,8 +11,14 @@ /// @class AP_LandingGear /// @brief Class managing the control of landing gear class AP_LandingGear { - public: + static AP_LandingGear create() { return AP_LandingGear{}; } + + constexpr AP_LandingGear(AP_LandingGear &&other) = default; + + /* Do not allow copies */ + AP_LandingGear(const AP_LandingGear &other) = delete; + AP_LandingGear &operator=(const AP_LandingGear&) = delete; // Gear command modes enum LandingGearCommand { @@ -28,13 +34,6 @@ public: LandingGear_Startup_Deploy = 2, }; - /// Constructor - AP_LandingGear() - { - // setup parameter defaults - AP_Param::setup_object_defaults(this, var_info); - } - /// initialise state of landing gear void init(); @@ -47,6 +46,10 @@ public: static const struct AP_Param::GroupInfo var_info[]; private: + AP_LandingGear() { + // setup parameter defaults + AP_Param::setup_object_defaults(this, var_info); + } // Parameters AP_Int16 _servo_retract_pwm; // PWM value to move servo to when gear is retracted