| 39 | } |
| 40 | |
| 41 | Components::~Components() { |
| 42 | |
| 43 | // If there are allocated components |
| 44 | if (mNbAllocatedComponents > 0) { |
| 45 | |
| 46 | // Destroy all the remaining components |
| 47 | for (uint32 i = 0; i < mNbComponents; i++) { |
| 48 | |
| 49 | destroyComponent(i); |
| 50 | } |
| 51 | |
| 52 | // Size for the data of a single component (in bytes) |
| 53 | const size_t totalSizeBytes = mNbAllocatedComponents * mComponentDataSize; |
| 54 | |
| 55 | // Release the allocated memory |
| 56 | mMemoryAllocator.release(mBuffer, totalSizeBytes); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | // Initialize the components: |
| 61 | void Components::init() { |