From c10a91964f18a0dec62d3a0b2dced216924cafe5 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Mon, 28 Aug 2017 17:40:36 -0700 Subject: [PATCH] AP_RCMapper: add static create method --- libraries/AP_RCMapper/AP_RCMapper.h | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libraries/AP_RCMapper/AP_RCMapper.h b/libraries/AP_RCMapper/AP_RCMapper.h index 97bf04f2e9..22fe89af05 100644 --- a/libraries/AP_RCMapper/AP_RCMapper.h +++ b/libraries/AP_RCMapper/AP_RCMapper.h @@ -4,12 +4,15 @@ #include #include -class RCMapper -{ +class RCMapper { public: - /// Constructor - /// - RCMapper(); + static RCMapper create() { return RCMapper{}; } + + constexpr RCMapper(RCMapper &&other) = default; + + /* Do not allow copies */ + RCMapper(const RCMapper &other) = delete; + RCMapper &operator=(const RCMapper&) = delete; /// roll - return input channel number for roll / aileron input uint8_t roll() const { return _ch_roll; } @@ -32,6 +35,8 @@ public: static const struct AP_Param::GroupInfo var_info[]; private: + RCMapper(); + // channel mappings AP_Int8 _ch_roll; AP_Int8 _ch_pitch;