From 87d2bf22f28a60842203a1a222c7cfb104c9bc45 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Tue, 29 Aug 2017 11:08:41 -0700 Subject: [PATCH] AP_Relay: add static create method --- libraries/AP_Relay/AP_Relay.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libraries/AP_Relay/AP_Relay.h b/libraries/AP_Relay/AP_Relay.h index bcaef0e1f8..35aa164da8 100644 --- a/libraries/AP_Relay/AP_Relay.h +++ b/libraries/AP_Relay/AP_Relay.h @@ -14,10 +14,16 @@ #define AP_RELAY_NUM_RELAYS 4 /// @class AP_Relay -/// @brief Class to manage the APM relay +/// @brief Class to manage the ArduPilot relay class AP_Relay { public: - AP_Relay(); + static AP_Relay create() { return AP_Relay{}; } + + constexpr AP_Relay(AP_Relay &&other) = default; + + /* Do not allow copies */ + AP_Relay(const AP_Relay &other) = delete; + AP_Relay &operator=(const AP_Relay&) = delete; // setup the relay pin void init(); @@ -37,6 +43,8 @@ public: static const struct AP_Param::GroupInfo var_info[]; private: + AP_Relay(); + AP_Int8 _pin[AP_RELAY_NUM_RELAYS]; AP_Int8 _default; };