JUCE  v5.4.1-191-g0ab5e696f
JUCE API
Looking for a senior C++ dev?
I'm looking for work. Hire me!
juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > Class Template Reference

Implements some basic array storage allocation functions. More...

#include <juce_ArrayAllocationBase.h>

Inheritance diagram for juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >:
Collaboration diagram for juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >:

Public Member Functions

 ArrayAllocationBase () noexcept
 Creates an empty array. More...
 
 ArrayAllocationBase (ArrayAllocationBase &&other) noexcept
 
 ~ArrayAllocationBase () noexcept
 Destructor. More...
 
void ensureAllocatedSize (int minNumElements)
 Increases the amount of storage allocated if it is less than a given amount. More...
 
ArrayAllocationBaseoperator= (ArrayAllocationBase &&other) noexcept
 
void setAllocatedSize (int numElements)
 Changes the amount of storage allocated. More...
 
void shrinkToNoMoreThan (int maxNumElements)
 Minimises the amount of storage allocated so that it's no more than the given number of elements. More...
 
void swapWith (ArrayAllocationBase &other) noexcept
 Swap the contents of two objects. More...
 

Public Attributes

HeapBlock< ElementType > elements
 
int numAllocated = 0
 

Detailed Description

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

Implements some basic array storage allocation functions.

This class isn't really for public use - it used to be part of the container classes but has since been superseded by ArrayBase. Eventually it will be removed from the API.

{Core}

Constructor & Destructor Documentation

◆ ArrayAllocationBase() [1/2]

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

Creates an empty array.

◆ ~ArrayAllocationBase()

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

Destructor.

◆ ArrayAllocationBase() [2/2]

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

Member Function Documentation

◆ ensureAllocatedSize()

template<class ElementType , class TypeOfCriticalSectionToUse >
void juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::ensureAllocatedSize ( 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

References juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::elements, jassert, juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::numAllocated, and juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize().

◆ operator=()

template<class ElementType , class TypeOfCriticalSectionToUse >
ArrayAllocationBase& juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::operator= ( ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse > &&  other)
inlinenoexcept

◆ setAllocatedSize()

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

◆ shrinkToNoMoreThan()

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

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

References juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::numAllocated, and juce::ArrayAllocationBase< ElementType, TypeOfCriticalSectionToUse >::setAllocatedSize().

◆ swapWith()

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

Member Data Documentation

◆ elements

◆ numAllocated


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