AP_L1_Control: add static create method

This commit is contained in:
Lucas De Marchi 2017-08-30 11:11:02 -07:00 committed by Francisco Ferreira
parent 15527d762f
commit 67e02e3c55

View File

@ -21,13 +21,16 @@
class AP_L1_Control : public AP_Navigation {
public:
AP_L1_Control(AP_AHRS &ahrs, const AP_SpdHgtControl * spdHgtControl)
: _ahrs(ahrs),
_spdHgtControl(spdHgtControl)
{
AP_Param::setup_object_defaults(this, var_info);
static AP_L1_Control create(AP_AHRS &ahrs, const AP_SpdHgtControl *spdHgtControl) {
return AP_L1_Control{ahrs, spdHgtControl};
}
constexpr AP_L1_Control(AP_L1_Control &&other) = default;
/* Do not allow copies */
AP_L1_Control(const AP_L1_Control &other) = delete;
AP_L1_Control &operator=(const AP_L1_Control&) = delete;
/* see AP_Navigation.h for the definitions and units of these
* functions */
int32_t nav_roll_cd(void) const;
@ -72,6 +75,13 @@ public:
}
private:
AP_L1_Control(AP_AHRS &ahrs, const AP_SpdHgtControl *spdHgtControl)
: _ahrs(ahrs)
, _spdHgtControl(spdHgtControl)
{
AP_Param::setup_object_defaults(this, var_info);
}
// reference to the AHRS object
AP_AHRS &_ahrs;