openshot-audio  0.1.7
Public Member Functions | Public Attributes | List of all members
ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > Class Template Reference

#include <juce_ArrayAllocationBase.h>

Inheritance diagram for ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >:

Public Member Functions

 ArrayAllocationBase () noexcept
 
 ~ArrayAllocationBase () noexcept
 
void setAllocatedSize (const int numElements)
 
void ensureAllocatedSize (const int minNumElements)
 
void shrinkToNoMoreThan (const int maxNumElements)
 
void swapWith (ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > &other) noexcept
 

Public Attributes

HeapBlock< ElementType > elements
 
int numAllocated
 

Detailed Description

template<class ElementType, class TypeOfCriticalSectionToUse>
class ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >

Implements some basic array storage allocation functions.

This class isn't really for public use - it's used by the other array classes, but might come in handy for some purposes.

It inherits from a critical section class to allow the arrays to use the "empty base class optimisation" pattern to reduce their footprint.

See also
Array, OwnedArray, ReferenceCountedArray

Constructor & Destructor Documentation

◆ ArrayAllocationBase()

template<class ElementType, class TypeOfCriticalSectionToUse>
ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::ArrayAllocationBase ( )
inlinenoexcept

Creates an empty array.

◆ ~ArrayAllocationBase()

template<class ElementType, class TypeOfCriticalSectionToUse>
ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::~ArrayAllocationBase ( )
inlinenoexcept

Destructor.

Member Function Documentation

◆ ensureAllocatedSize()

template<class ElementType, class TypeOfCriticalSectionToUse>
void ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize ( const int  minNumElements)
inline

Increases the amount of storage allocated if it is less than a given amount.

This will retain any data currently held in the array, but will add extra space at the end to make sure there it's at least as big as the size passed in. If it's already bigger, no action is taken.

Parameters
minNumElementsthe minimum number of elements that are needed

◆ setAllocatedSize()

template<class ElementType, class TypeOfCriticalSectionToUse>
void ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize ( const int  numElements)
inline

Changes the amount of storage allocated.

This will retain any data currently held in the array, and either add or remove extra space at the end.

Parameters
numElementsthe number of elements that are needed

◆ shrinkToNoMoreThan()

template<class ElementType, class TypeOfCriticalSectionToUse>
void ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::shrinkToNoMoreThan ( const int  maxNumElements)
inline

Minimises the amount of storage allocated so that it's no more than the given number of elements.

◆ swapWith()

template<class ElementType, class TypeOfCriticalSectionToUse>
void ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::swapWith ( ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > &  other)
inlinenoexcept

Swap the contents of two objects.

Member Data Documentation

◆ elements

template<class ElementType, class TypeOfCriticalSectionToUse>
HeapBlock<ElementType> ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::elements

◆ numAllocated

template<class ElementType, class TypeOfCriticalSectionToUse>
int ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::numAllocated

The documentation for this class was generated from the following file: