From 6aaa00d9159fd222474e2c6bd4106c8a784eb62a Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Wed, 23 Aug 2017 07:59:52 -0700 Subject: [PATCH] AP_LeakDetector: add static create method --- libraries/AP_LeakDetector/AP_LeakDetector.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libraries/AP_LeakDetector/AP_LeakDetector.h b/libraries/AP_LeakDetector/AP_LeakDetector.h index 23da92f812..26d034189d 100644 --- a/libraries/AP_LeakDetector/AP_LeakDetector.h +++ b/libraries/AP_LeakDetector/AP_LeakDetector.h @@ -14,7 +14,13 @@ class AP_LeakDetector { friend class AP_LeakDetector_Digital; public: - AP_LeakDetector(); + static AP_LeakDetector create() { return AP_LeakDetector{}; } + + constexpr AP_LeakDetector(AP_LeakDetector &&other) = default; + + /* Do not allow copies */ + AP_LeakDetector(const AP_LeakDetector &other) = delete; + AP_LeakDetector &operator=(const AP_LeakDetector&) = delete; enum LeakDetector_Type { LEAKDETECTOR_TYPE_NONE = 0, @@ -42,6 +48,8 @@ public: static const struct AP_Param::GroupInfo var_info[]; private: + AP_LeakDetector(); + AP_LeakDetector_Backend *_drivers[LEAKDETECTOR_MAX_INSTANCES]; LeakDetector_State _state[LEAKDETECTOR_MAX_INSTANCES];