mirror of
https://github.com/eclipse/upm.git
synced 2025-07-05 11:21:12 +03:00
memory: Hide all copy/assignment ops for class w/heap allocation
Many of the UPM libraries allocate space on the heap but do not explicitly handle copying and assignment. This commit uses C++11 delete to forbit both the copy and assignment operator for these classes. The C++ examples which used assignment operators to initialize class instances were also updated since it did not appear necessary in those cases to use the assignment operator. Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@ -932,6 +932,10 @@ namespace upm {
|
||||
float m_gyroScale;
|
||||
|
||||
private:
|
||||
/* Disable implicit copy and assignment operators */
|
||||
MPU60X0(const MPU60X0&) = delete;
|
||||
MPU60X0 &operator=(const MPU60X0&) = delete;
|
||||
|
||||
mraa::I2c m_i2c;
|
||||
uint8_t m_addr;
|
||||
|
||||
|
@ -126,6 +126,10 @@ namespace upm {
|
||||
|
||||
|
||||
private:
|
||||
/* Disable implicit copy and assignment operators */
|
||||
MPU9150(const MPU9150&) = delete;
|
||||
MPU9150 &operator=(const MPU9150&) = delete;
|
||||
|
||||
int m_i2cBus;
|
||||
uint8_t m_magAddress;
|
||||
bool m_enableAk8975;
|
||||
|
Reference in New Issue
Block a user