Loading...
Searching...
No Matches
memory

Classes

struct  Atomic< Type >
 A simple wrapper around std::atomic. More...
 
class  ByteOrder
 Contains static methods for converting the byte order between different endiannesses. More...
 
struct  ContainerDeletePolicy< ObjectType >
 Used by container classes as an indirect way to delete an object of a particular type. More...
 
class  CopyableHeapBlock< ElementType, throwOnFailure >
 Wraps a HeapBlock, but additionally provides a copy constructor and remembers its size. More...
 
class  HeapBlock< ElementType, throwOnFailure >
 Very simple container class to hold a pointer to some data on the heap. More...
 
class  HeavyweightLeakedObjectDetector< OwnerClass >
 This class is a useful way of tracking down hard to find memory leaks when the regular LeakedObjectDetector isn't enough. More...
 
class  LeakedObjectDetector< OwnerClass >
 Embedding an instance of this class inside another class can be used as a low-overhead way of detecting leaked instances. More...
 
class  ScopedAutoReleasePool
 A handy C++ wrapper that creates and deletes an NSAutoreleasePool object using RAII. More...
 
class  MemoryBlock
 A class to hold a resizable block of raw data. More...
 
class  OptionalScopedPointer< ObjectType >
 Holds a pointer to an object which can optionally be deleted when this pointer goes out of scope. More...
 
class  ReferenceCountedObject
 A base class which provides methods for reference-counting. More...
 
class  SingleThreadedReferenceCountedObject
 Adds reference-counting to an object. More...
 
class  ReferenceCountedObjectPtr< ObjectType >
 A smart-pointer class which points to a reference-counted object. More...
 
struct  Reservoir
 Helper functions for managing buffered readers. More...
 
class  SharedResourcePointer< SharedObjectType >
 A smart-pointer that automatically creates and manages the lifetime of a shared static instance of a class. More...
 
struct  SingletonHolder< Type, MutexType, onlyCreateOncePerRun >
 Used by the JUCE_DECLARE_SINGLETON macros to manage a static pointer to a singleton instance. More...
 
class  WeakReference< ObjectType, ReferenceCountingType >
 This class acts as a pointer which will automatically become null if the object to which it points is deleted. More...
 
class  WeakReference< ObjectType, ReferenceCountingType >::SharedPointer
 This class is used internally by the WeakReference class - don't use it directly in your code! More...
 
class  WeakReference< ObjectType, ReferenceCountingType >::Master
 This class is embedded inside an object to which you want to attach WeakReference pointers. More...
 

Macros

#define JUCE_HEAVYWEIGHT_LEAK_DETECTOR(OwnerClass)
 This macro lets you embed a heavyweight leak-detecting object inside a class.
 
#define JUCE_LEAK_DETECTOR(OwnerClass)
 This macro lets you embed a leak-detecting object inside a class.
 
#define JUCE_AUTORELEASEPOOL   @autoreleasepool
 A macro that can be used to easily declare a local ScopedAutoReleasePool object for RAII-based obj-C autoreleasing.
 
#define juce_UseDebuggingNewOperator
 (Deprecated) This was a Windows-specific way of checking for object leaks - now please use the JUCE_LEAK_DETECTOR instead.
 
#define JUCE_DECLARE_SINGLETON(Classname, doNotRecreateAfterDeletion)    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::CriticalSection, doNotRecreateAfterDeletion, , get)
 Macro to generate the appropriate methods and boilerplate for a singleton class.
 
#define JUCE_DECLARE_SINGLETON_INLINE(Classname, doNotRecreateAfterDeletion)    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::CriticalSection, doNotRecreateAfterDeletion, inline, get)
 The same as JUCE_DECLARE_SINGLETON, but does not require a matching JUCE_IMPLEMENT_SINGLETON definition.
 
#define JUCE_IMPLEMENT_SINGLETON(Classname)    decltype (Classname::singletonHolder) Classname::singletonHolder;
 This is a counterpart to the JUCE_DECLARE_SINGLETON macros.
 
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED(Classname, doNotRecreateAfterDeletion)    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, doNotRecreateAfterDeletion, , get)
 Macro to declare member variables and methods for a singleton class.
 
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE(Classname, doNotRecreateAfterDeletion)    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, doNotRecreateAfterDeletion, inline, get)
 The same as JUCE_DECLARE_SINGLETON_SINGLETHREADED, but does not require a matching JUCE_IMPLEMENT_SINGLETON definition.
 
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL(Classname)    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, false, , getWithoutChecking)
 Macro to declare member variables and methods for a singleton class.
 
#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE(Classname)    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, false, inline, getWithoutChecking)
 The same as JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL, but does not require a matching JUCE_IMPLEMENT_SINGLETON definition.
 
#define JUCE_DECLARE_WEAK_REFERENCEABLE(Class)
 Macro to easily allow a class to be made weak-referenceable.
 

Functions

void zeromem (void *memory, size_t numBytes) noexcept
 Fills a block of memory with zeros.
 
template<typename Type >
void zerostruct (Type &structure) noexcept
 Overwrites a structure or object with zeros.
 
template<typename Type >
void deleteAndZero (Type &pointer)
 Delete an object pointer, and sets the pointer to null.
 
template<typename Type , typename IntegerType >
Type * snapPointerToAlignment (Type *basePointer, IntegerType alignmentBytes) noexcept
 A handy function to round up a pointer to the nearest multiple of a given number of bytes.
 
template<typename Type1 , typename Type2 >
int getAddressDifference (Type1 *pointer1, Type2 *pointer2) noexcept
 A handy function which returns the difference between any two pointers, in bytes.
 
template<class Type >
Type * createCopyIfNotNull (const Type *objectToCopy)
 If a pointer is non-null, this returns a new copy of the object that it points to, or safely returns nullptr if the pointer is null.
 
template<typename Type >
Type readUnaligned (const void *srcPtr) noexcept
 A handy function to read un-aligned memory without a performance penalty or bus-error.
 
template<typename Type >
void writeUnaligned (void *dstPtr, Type value) noexcept
 A handy function to write un-aligned memory without a performance penalty or bus-error.
 
template<typename Type >
Type unalignedPointerCast (void *ptr) noexcept
 Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes arises when casting pointers to types with different alignment.
 
template<typename Type >
Type unalignedPointerCast (const void *ptr) noexcept
 Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes arises when casting pointers to types with different alignment.
 
template<typename Type , typename IntegerType >
Type * addBytesToPointer (Type *basePointer, IntegerType bytes) noexcept
 A handy function which adds a number of bytes to any type of pointer and returns the result.
 
template<typename Type , typename IntegerType >
const Type * addBytesToPointer (const Type *basePointer, IntegerType bytes) noexcept
 A handy function which adds a number of bytes to any type of pointer and returns the result.
 
template<typename T >
std::unique_ptr< T > rawToUniquePtr (T *ptr)
 Converts an owning raw pointer into a unique_ptr, deriving the type of the unique_ptr automatically.
 
template<typename Type >
bool operator== (const Type *object1, const ReferenceCountedObjectPtr< Type > &object2) noexcept
 Compares two ReferenceCountedObjectPtrs.
 
template<typename Type >
bool operator!= (const Type *object1, const ReferenceCountedObjectPtr< Type > &object2) noexcept
 Compares two ReferenceCountedObjectPtrs.
 
static constexpr uint16 ByteOrder::swap (uint16 value) noexcept
 Swaps the upper and lower bytes of a 16-bit integer.
 
static constexpr int16 ByteOrder::swap (int16 value) noexcept
 Swaps the upper and lower bytes of a 16-bit integer.
 
static int32 ByteOrder::swap (int32 value) noexcept
 Reverses the order of the 4 bytes in a 32-bit integer.
 
static int64 ByteOrder::swap (int64 value) noexcept
 Reverses the order of the 8 bytes in a 64-bit integer.
 
static float ByteOrder::swap (float value) noexcept
 Returns a garbled float which has the reverse byte-order of the original.
 
static double ByteOrder::swap (double value) noexcept
 Returns a garbled double which has the reverse byte-order of the original.
 
static uint32 ByteOrder::swap (uint32 value) noexcept
 Reverses the order of the 4 bytes in a 32-bit integer.
 
static uint64 ByteOrder::swap (uint64 value) noexcept
 Reverses the order of the 8 bytes in a 64-bit integer.
 
static constexpr uint16 ByteOrder::makeInt (uint8 leastSig, uint8 mostSig) noexcept
 Constructs a 16-bit integer from its constituent bytes, in order of significance.
 
static constexpr uint32 ByteOrder::makeInt (uint8 leastSig, uint8 byte1, uint8 byte2, uint8 mostSig) noexcept
 Constructs a 32-bit integer from its constituent bytes, in order of significance.
 
static constexpr uint64 ByteOrder::makeInt (uint8 leastSig, uint8 byte1, uint8 byte2, uint8 byte3, uint8 byte4, uint8 byte5, uint8 byte6, uint8 mostSig) noexcept
 Constructs a 64-bit integer from its constituent bytes, in order of significance.
 
static constexpr uint16 ByteOrder::littleEndianShort (const void *bytes) noexcept
 Turns 2 bytes into a little-endian integer.
 
static constexpr uint32 ByteOrder::littleEndianInt (const void *bytes) noexcept
 Turns 4 bytes into a little-endian integer.
 
static constexpr uint64 ByteOrder::littleEndianInt64 (const void *bytes) noexcept
 Turns 8 bytes into a little-endian integer.
 
static constexpr uint16 ByteOrder::bigEndianShort (const void *bytes) noexcept
 Turns 2 bytes into a big-endian integer.
 
static constexpr uint32 ByteOrder::bigEndianInt (const void *bytes) noexcept
 Turns 4 bytes into a big-endian integer.
 
static constexpr uint64 ByteOrder::bigEndianInt64 (const void *bytes) noexcept
 Turns 8 bytes into a big-endian integer.
 
static constexpr int ByteOrder::littleEndian24Bit (const void *bytes) noexcept
 Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).
 
static constexpr int ByteOrder::bigEndian24Bit (const void *bytes) noexcept
 Converts 3 big-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).
 
static void ByteOrder::littleEndian24BitToChars (int32 value, void *destBytes) noexcept
 Copies a 24-bit number to 3 little-endian bytes.
 
static void ByteOrder::bigEndian24BitToChars (int32 value, void *destBytes) noexcept
 Copies a 24-bit number to 3 big-endian bytes.
 

Detailed Description

Macro Definition Documentation

◆ JUCE_HEAVYWEIGHT_LEAK_DETECTOR

#define JUCE_HEAVYWEIGHT_LEAK_DETECTOR ( OwnerClass)
Value:
friend class juce::HeavyweightLeakedObjectDetector<OwnerClass>; \
static const char* getLeakedObjectClassName() noexcept { return #OwnerClass; } \
juce::HeavyweightLeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__);
#define JUCE_JOIN_MACRO(item1, item2)
A good old-fashioned C macro concatenation helper.
Definition juce_PlatformDefs.h:217

This macro lets you embed a heavyweight leak-detecting object inside a class.

To use it, simply declare a JUCE_HEAVYWEIGHT_LEAK_DETECTOR (YourClassName) inside a private section of the class declaration. E.g.

class MyClass
{
public:
MyClass();
void blahBlah();
private:
};
#define JUCE_HEAVYWEIGHT_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a heavyweight leak-detecting object inside a class.
Definition juce_HeavyweightLeakedObjectDetector.h:150

NB: you should only use this when you really need to track down a tricky memory leak, and should never leave one of these inside a class!

See also
HeavyweightLeakedObjectDetector, JUCE_LEAK_DETECTOR, LeakedObjectDetector

◆ JUCE_LEAK_DETECTOR

#define JUCE_LEAK_DETECTOR ( OwnerClass)
Value:
friend class juce::LeakedObjectDetector<OwnerClass>; \
static const char* getLeakedObjectClassName() noexcept { return #OwnerClass; } \
juce::LeakedObjectDetector<OwnerClass> JUCE_JOIN_MACRO (leakDetector, __LINE__);

This macro lets you embed a leak-detecting object inside a class.

To use it, simply declare a JUCE_LEAK_DETECTOR (YourClassName) inside a private section of the class declaration. E.g.

class MyClass
{
public:
MyClass();
void blahBlah();
private:
};
#define JUCE_LEAK_DETECTOR(OwnerClass)
This macro lets you embed a leak-detecting object inside a class.
Definition juce_LeakedObjectDetector.h:148
See also
JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR, LeakedObjectDetector

◆ JUCE_AUTORELEASEPOOL

#define JUCE_AUTORELEASEPOOL   @autoreleasepool

A macro that can be used to easily declare a local ScopedAutoReleasePool object for RAII-based obj-C autoreleasing.

Because this may use the @autoreleasepool syntax, you must follow the macro with a set of braces to mark the scope of the pool.

◆ juce_UseDebuggingNewOperator

#define juce_UseDebuggingNewOperator

(Deprecated) This was a Windows-specific way of checking for object leaks - now please use the JUCE_LEAK_DETECTOR instead.

◆ JUCE_DECLARE_SINGLETON

#define JUCE_DECLARE_SINGLETON ( Classname,
doNotRecreateAfterDeletion )    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::CriticalSection, doNotRecreateAfterDeletion, , get)

Macro to generate the appropriate methods and boilerplate for a singleton class.

To use this, add the line JUCE_DECLARE_SINGLETON (MyClass, doNotRecreateAfterDeletion) to the class's definition.

Then put a macro JUCE_IMPLEMENT_SINGLETON (MyClass) along with the class's implementation code.

It's also a very good idea to also add the call clearSingletonInstance() in your class's destructor, in case it is deleted by other means than deleteInstance()

Clients can then call the static method MyClass::getInstance() to get a pointer to the singleton, or MyClass::getInstanceWithoutCreating() which will return nullptr if no instance currently exists.

e.g.

struct MySingleton
{
MySingleton() {}
~MySingleton()
{
// this ensures that no dangling pointers are left when the
// singleton is deleted.
clearSingletonInstance();
}
JUCE_DECLARE_SINGLETON (MySingleton, false)
};
// ..and this goes in a suitable .cpp file:
// example of usage:
auto* m = MySingleton::getInstance(); // creates the singleton if there isn't already one.
...
MySingleton::deleteInstance(); // safely deletes the singleton (if it's been created).
#define JUCE_IMPLEMENT_SINGLETON(Classname)
This is a counterpart to the JUCE_DECLARE_SINGLETON macros.
Definition juce_Singleton.h:228
#define JUCE_DECLARE_SINGLETON(Classname, doNotRecreateAfterDeletion)
Macro to generate the appropriate methods and boilerplate for a singleton class.
Definition juce_Singleton.h:208

If doNotRecreateAfterDeletion = true, it won't allow the object to be created more than once during the process's lifetime - i.e. after you've created and deleted the object, getInstance() will refuse to create another one. This can be useful to stop objects being accidentally re-created during your app's shutdown code.

If you know that your object will only be created and deleted by a single thread, you can use the slightly more efficient JUCE_DECLARE_SINGLETON_SINGLETHREADED macro instead of this one.

See also
JUCE_IMPLEMENT_SINGLETON, JUCE_DECLARE_SINGLETON_SINGLETHREADED

◆ JUCE_DECLARE_SINGLETON_INLINE

#define JUCE_DECLARE_SINGLETON_INLINE ( Classname,
doNotRecreateAfterDeletion )    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::CriticalSection, doNotRecreateAfterDeletion, inline, get)

The same as JUCE_DECLARE_SINGLETON, but does not require a matching JUCE_IMPLEMENT_SINGLETON definition.

◆ JUCE_IMPLEMENT_SINGLETON

#define JUCE_IMPLEMENT_SINGLETON ( Classname)     decltype (Classname::singletonHolder) Classname::singletonHolder;

This is a counterpart to the JUCE_DECLARE_SINGLETON macros.

After adding the JUCE_DECLARE_SINGLETON to the class definition, this macro has to be used in the cpp file.

This macro is not required for singletons declared with the INLINE macros, specifically JUCE_DECLARE_SINGLETON_INLINE, JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE, and JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE.

◆ JUCE_DECLARE_SINGLETON_SINGLETHREADED

#define JUCE_DECLARE_SINGLETON_SINGLETHREADED ( Classname,
doNotRecreateAfterDeletion )    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, doNotRecreateAfterDeletion, , get)

Macro to declare member variables and methods for a singleton class.

This is exactly the same as JUCE_DECLARE_SINGLETON, but doesn't use a critical section to make access to it thread-safe. If you know that your object will only ever be created or deleted by a single thread, then this is a more efficient version to use.

If doNotRecreateAfterDeletion = true, it won't allow the object to be created more than once during the process's lifetime - i.e. after you've created and deleted the object, getInstance() will refuse to create another one. This can be useful to stop objects being accidentally re-created during your app's shutdown code.

See the documentation for JUCE_DECLARE_SINGLETON for more information about how to use it. Just like JUCE_DECLARE_SINGLETON you need to also have a corresponding JUCE_IMPLEMENT_SINGLETON statement somewhere in your code.

See also
JUCE_IMPLEMENT_SINGLETON, JUCE_DECLARE_SINGLETON, JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL

◆ JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE

#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_INLINE ( Classname,
doNotRecreateAfterDeletion )    JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, doNotRecreateAfterDeletion, inline, get)

The same as JUCE_DECLARE_SINGLETON_SINGLETHREADED, but does not require a matching JUCE_IMPLEMENT_SINGLETON definition.

◆ JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL

#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL ( Classname)     JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, false, , getWithoutChecking)

Macro to declare member variables and methods for a singleton class.

This is like JUCE_DECLARE_SINGLETON_SINGLETHREADED, but doesn't do any checking for recursion or repeated instantiation. It's intended for use as a lightweight version of a singleton, where you're using it in very straightforward circumstances and don't need the extra checking.

See the documentation for JUCE_DECLARE_SINGLETON for more information about how to use it. Just like JUCE_DECLARE_SINGLETON you need to also have a corresponding JUCE_IMPLEMENT_SINGLETON statement somewhere in your code.

See also
JUCE_IMPLEMENT_SINGLETON, JUCE_DECLARE_SINGLETON

◆ JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE

#define JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL_INLINE ( Classname)     JUCE_PRIVATE_DECLARE_SINGLETON (Classname, juce::DummyCriticalSection, false, inline, getWithoutChecking)

The same as JUCE_DECLARE_SINGLETON_SINGLETHREADED_MINIMAL, but does not require a matching JUCE_IMPLEMENT_SINGLETON definition.

◆ JUCE_DECLARE_WEAK_REFERENCEABLE

#define JUCE_DECLARE_WEAK_REFERENCEABLE ( Class)
Value:
struct WeakRefMaster : public juce::WeakReference<Class>::Master { ~WeakRefMaster() { this->clear(); } }; \
WeakRefMaster masterReference; \
friend class juce::WeakReference<Class>; \

Macro to easily allow a class to be made weak-referenceable.

This can be inserted in a class definition to add the requisite weak-ref boilerplate to that class. e.g.

class MyObject
{
public:
MyObject();
~MyObject();
private:
};
#define JUCE_DECLARE_WEAK_REFERENCEABLE(Class)
Macro to easily allow a class to be made weak-referenceable.
Definition juce_WeakReference.h:246
See also
WeakReference, WeakReference::Master

Function Documentation

◆ zeromem()

◆ zerostruct()

template<typename Type >
void zerostruct ( Type & structure)
noexcept

Overwrites a structure or object with zeros.

◆ deleteAndZero()

template<typename Type >
void deleteAndZero ( Type & pointer)

Delete an object pointer, and sets the pointer to null.

Remember that it's not good c++ practice to use delete directly - always try to use a std::unique_ptr or other automatic lifetime-management system rather than resorting to deleting raw pointers!

◆ snapPointerToAlignment()

template<typename Type , typename IntegerType >
Type * snapPointerToAlignment ( Type * basePointer,
IntegerType alignmentBytes )
noexcept

A handy function to round up a pointer to the nearest multiple of a given number of bytes.

alignmentBytes must be a power of two.

Referenced by dsp::AudioBlock< SampleType >::AudioBlock(), dsp::SIMDRegister< Type >::getNextSIMDAlignedPtr(), and dsp::FIR::Filter< SampleType >::reset().

◆ getAddressDifference()

template<typename Type1 , typename Type2 >
int getAddressDifference ( Type1 * pointer1,
Type2 * pointer2 )
noexcept

A handy function which returns the difference between any two pointers, in bytes.

The address of the second pointer is subtracted from the first, and the difference in bytes is returned.

Referenced by CharacterFunctions::copyWithDestByteLimit().

◆ createCopyIfNotNull()

template<class Type >
Type * createCopyIfNotNull ( const Type * objectToCopy)

If a pointer is non-null, this returns a new copy of the object that it points to, or safely returns nullptr if the pointer is null.

Referenced by OwnedArray< ObjectClass, TypeOfCriticalSectionToUse >::addCopiesOf().

◆ readUnaligned()

template<typename Type >
Type readUnaligned ( const void * srcPtr)
noexcept

A handy function to read un-aligned memory without a performance penalty or bus-error.

Referenced by ARAHostModel::ConversionFunctions< A, B >::fromHostRef(), and ARAHostModel::ConversionFunctions< A, B >::toHostRef().

◆ writeUnaligned()

template<typename Type >
void writeUnaligned ( void * dstPtr,
Type value )
noexcept

A handy function to write un-aligned memory without a performance penalty or bus-error.

◆ unalignedPointerCast() [1/2]

template<typename Type >
Type unalignedPointerCast ( void * ptr)
noexcept

Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes arises when casting pointers to types with different alignment.

You should only use this when you know for a fact that the input pointer points to a region that has suitable alignment for Type, e.g. regions returned from malloc/calloc that should be suitable for any non-over-aligned type.

Referenced by addBytesToPointer(), addBytesToPointer(), dsp::AudioBlock< SampleType >::AudioBlock(), and AudioBuffer< Type >::setSize().

◆ unalignedPointerCast() [2/2]

template<typename Type >
Type unalignedPointerCast ( const void * ptr)
noexcept

Casts a pointer to another type via void*, which suppresses the cast-align warning which sometimes arises when casting pointers to types with different alignment.

You should only use this when you know for a fact that the input pointer points to a region that has suitable alignment for Type, e.g. regions returned from malloc/calloc that should be suitable for any non-over-aligned type.

◆ addBytesToPointer() [1/2]

template<typename Type , typename IntegerType >
Type * addBytesToPointer ( Type * basePointer,
IntegerType bytes )
noexcept

◆ addBytesToPointer() [2/2]

template<typename Type , typename IntegerType >
const Type * addBytesToPointer ( const Type * basePointer,
IntegerType bytes )
noexcept

A handy function which adds a number of bytes to any type of pointer and returns the result.

This can be useful to avoid casting pointers to a char* and back when you want to move them by a specific number of bytes,

References unalignedPointerCast().

◆ rawToUniquePtr()

template<typename T >
std::unique_ptr< T > rawToUniquePtr ( T * ptr)

Converts an owning raw pointer into a unique_ptr, deriving the type of the unique_ptr automatically.

This should only be used with pointers to single objects. Do NOT pass a pointer to an array to this function, as the destructor of the unique_ptr will incorrectly call delete instead of delete[] on the pointer.

Referenced by createPluginFilterOfType().

◆ operator==()

template<typename Type >
bool operator== ( const Type * object1,
const ReferenceCountedObjectPtr< Type > & object2 )
noexcept

Compares two ReferenceCountedObjectPtrs.

◆ operator!=()

template<typename Type >
bool operator!= ( const Type * object1,
const ReferenceCountedObjectPtr< Type > & object2 )
noexcept

Compares two ReferenceCountedObjectPtrs.

◆ swap() [1/8]

uint16 ByteOrder::swap ( uint16 value)
staticconstexprnoexcept

Swaps the upper and lower bytes of a 16-bit integer.

◆ swap() [2/8]

int16 ByteOrder::swap ( int16 value)
staticconstexprnoexcept

Swaps the upper and lower bytes of a 16-bit integer.

◆ swap() [3/8]

int32 ByteOrder::swap ( int32 value)
staticnoexcept

Reverses the order of the 4 bytes in a 32-bit integer.

◆ swap() [4/8]

int64 ByteOrder::swap ( int64 value)
staticnoexcept

Reverses the order of the 8 bytes in a 64-bit integer.

◆ swap() [5/8]

float ByteOrder::swap ( float value)
staticnoexcept

Returns a garbled float which has the reverse byte-order of the original.

◆ swap() [6/8]

double ByteOrder::swap ( double value)
staticnoexcept

Returns a garbled double which has the reverse byte-order of the original.

◆ swap() [7/8]

uint32 ByteOrder::swap ( uint32 value)
staticnoexcept

Reverses the order of the 4 bytes in a 32-bit integer.

◆ swap() [8/8]

uint64 ByteOrder::swap ( uint64 value)
staticnoexcept

Reverses the order of the 8 bytes in a 64-bit integer.

◆ makeInt() [1/3]

uint16 ByteOrder::makeInt ( uint8 leastSig,
uint8 mostSig )
staticconstexprnoexcept

Constructs a 16-bit integer from its constituent bytes, in order of significance.

◆ makeInt() [2/3]

uint32 ByteOrder::makeInt ( uint8 leastSig,
uint8 byte1,
uint8 byte2,
uint8 mostSig )
staticconstexprnoexcept

Constructs a 32-bit integer from its constituent bytes, in order of significance.

◆ makeInt() [3/3]

uint64 ByteOrder::makeInt ( uint8 leastSig,
uint8 byte1,
uint8 byte2,
uint8 byte3,
uint8 byte4,
uint8 byte5,
uint8 byte6,
uint8 mostSig )
staticconstexprnoexcept

Constructs a 64-bit integer from its constituent bytes, in order of significance.

◆ littleEndianShort()

uint16 ByteOrder::littleEndianShort ( const void * bytes)
staticconstexprnoexcept

Turns 2 bytes into a little-endian integer.

◆ littleEndianInt()

uint32 ByteOrder::littleEndianInt ( const void * bytes)
staticconstexprnoexcept

Turns 4 bytes into a little-endian integer.

◆ littleEndianInt64()

uint64 ByteOrder::littleEndianInt64 ( const void * bytes)
staticconstexprnoexcept

Turns 8 bytes into a little-endian integer.

◆ bigEndianShort()

uint16 ByteOrder::bigEndianShort ( const void * bytes)
staticconstexprnoexcept

Turns 2 bytes into a big-endian integer.

◆ bigEndianInt()

uint32 ByteOrder::bigEndianInt ( const void * bytes)
staticconstexprnoexcept

Turns 4 bytes into a big-endian integer.

◆ bigEndianInt64()

uint64 ByteOrder::bigEndianInt64 ( const void * bytes)
staticconstexprnoexcept

Turns 8 bytes into a big-endian integer.

◆ littleEndian24Bit()

int32 ByteOrder::littleEndian24Bit ( const void * bytes)
staticconstexprnoexcept

Converts 3 little-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).

◆ bigEndian24Bit()

int32 ByteOrder::bigEndian24Bit ( const void * bytes)
staticconstexprnoexcept

Converts 3 big-endian bytes into a signed 24-bit value (which is sign-extended to 32 bits).

◆ littleEndian24BitToChars()

void ByteOrder::littleEndian24BitToChars ( int32 value,
void * destBytes )
staticnoexcept

Copies a 24-bit number to 3 little-endian bytes.

◆ bigEndian24BitToChars()

void ByteOrder::bigEndian24BitToChars ( int32 value,
void * destBytes )
staticnoexcept

Copies a 24-bit number to 3 big-endian bytes.

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram