void cleanup() { if (m_memblock) { memory_block_decref(m_memblock); m_memblock = NULL; } }
/** Move assignment */ memory_block_ptr &operator=(memory_block_ptr &&rhs) { if (m_memblock != 0) { memory_block_decref(m_memblock); } m_memblock = rhs.m_memblock; rhs.m_memblock = 0; return *this; }
/** Assignment from raw memory_block pointer */ memory_block_ptr &operator=(memory_block_data *rhs) { if (m_memblock != 0) { memory_block_decref(m_memblock); } m_memblock = rhs; if (rhs != 0) { memory_block_incref(rhs); } return *this; }
/** Assignment */ memory_block_ptr &operator=(const memory_block_ptr &rhs) { if (m_memblock != 0) { memory_block_decref(m_memblock); } if (rhs.m_memblock != 0) { m_memblock = rhs.m_memblock; memory_block_incref(m_memblock); } else { m_memblock = 0; } return *this; }
/** Destructor */ ~memory_block_ptr() { if (m_memblock != 0) { memory_block_decref(m_memblock); } }