AP_OpticalFlow: add static create method

This commit is contained in:
Lucas De Marchi 2017-08-28 14:55:46 -07:00 committed by Francisco Ferreira
parent eed3c83079
commit 04c3dca3ce
1 changed files with 9 additions and 2 deletions

View File

@ -30,8 +30,13 @@ class OpticalFlow
friend class OpticalFlow_backend;
public:
// constructor
OpticalFlow(AP_AHRS_NavEKF& ahrs);
static OpticalFlow create(AP_AHRS_NavEKF& ahrs) { return OpticalFlow{ahrs}; }
constexpr OpticalFlow(OpticalFlow &&other) = default;
/* Do not allow copies */
OpticalFlow(const OpticalFlow &other) = delete;
OpticalFlow &operator=(const OpticalFlow&) = delete;
// init - initialise sensor
void init(void);
@ -76,6 +81,8 @@ public:
static const struct AP_Param::GroupInfo var_info[];
private:
OpticalFlow(AP_AHRS_NavEKF& ahrs);
AP_AHRS_NavEKF &_ahrs;
OpticalFlow_backend *backend;