#import <Foundation/Foundation.h>
Go to the source code of this file.
Classes | |
class | AEArray |
Real-time safe array. More... | |
Macros | |
#define | __AEArrayVar2(x, y) x ## y |
#define | __AEArrayVar(x, y) __AEArrayVar2(__ ## x ## _line_, y) |
#define | AEArrayEnumerateObjects(array, type, varname) |
Enumerate object types in the array, for use on audio thread. | |
#define | AEArrayEnumeratePointers(array, type, varname) |
Enumerate pointer types in the array, for use on audio thread. | |
Typedefs | |
typedef const void * | AEArrayToken |
Token for real-thread use. | |
typedef void *_Nullable(^ | AEArrayCustomMappingBlock )(id _Nonnull item) |
Block for mapping between objects and opaque pointer values. | |
typedef void *_Nullable(^ | AEArrayIndexedCustomMappingBlock )(id _Nonnull item, int index) |
Block for mapping between objects and opaque pointer values, for use with AEArray's updateWithContentsOfArray:customMapping: method. | |
typedef void(^ | AEArrayReleaseBlock )(id _Nonnull item, void *_Nonnull bytes) |
Block for releasing allocated values. | |
#define __AEArrayVar2 | ( | x, | |
y | |||
) | x ## y |
#define __AEArrayVar | ( | x, | |
y | |||
) | __AEArrayVar2(__ ## x ## _line_, y) |
#define AEArrayEnumerateObjects | ( | array, | |
type, | |||
varname | |||
) |
Enumerate object types in the array, for use on audio thread.
This convenience macro provides the ability to enumerate the objects in the array, in a realtime-thread safe fashion.
Use it like:
AEArrayEnumerateObjects(array, MyObjectType *, myVar) { // Do stuff with myVar, which is a MyObjectType * }
Note: This macro calls AEArrayGetToken to access the array. Consequently, it is not recommended for use when you need to access the array in addition to this enumeration.
Note: Do not use this macro on the main thread
array | The array |
type | The object type |
varname | Name of object variable for inner loop |
#define AEArrayEnumeratePointers | ( | array, | |
type, | |||
varname | |||
) |
Enumerate pointer types in the array, for use on audio thread.
This convenience macro provides the ability to enumerate the pointers in the array, in a realtime-thread safe fashion. It differs from AEArrayEnumerateObjects in that it is designed for use with pointer types, rather than objects.
Use it like:
AEArrayEnumeratePointers(array, MyCType *, myVar) { // Do stuff with myVar, which is a MyCType * }
Note: This macro calls AEArrayGetToken to access the array. Consequently, it is not recommended for use when you need to access the array in addition to this enumeration.
Note: Do not use this macro on the main thread
array | The array |
type | The pointer type (e.g. struct myStruct *) |
varname | Name of pointer variable for inner loop |
typedef const void* AEArrayToken |
Token for real-thread use.
typedef void* _Nullable(^ AEArrayCustomMappingBlock)(id _Nonnull item) |
Block for mapping between objects and opaque pointer values.
Pass a block matching this type to AEArray's initializer in order to map between objects in the array and an arbitrary data block; this can be a pointer to an allocated C structure, for example, or any other collection of bytes.
The block is invoked on the main thread whenever a new item is added to the array during an update. You should allocate the memory you need, set the contents, and return a pointer to this memory. It will be freed automatically once the item is removed from the array, unless you provide a custom releaseBlock .
item | The original object |
typedef void* _Nullable(^ AEArrayIndexedCustomMappingBlock)(id _Nonnull item, int index) |
Block for mapping between objects and opaque pointer values, for use with AEArray's updateWithContentsOfArray:customMapping: method.
See documentation for AEArrayCustomMappingBlock for details.
item | The original object |
typedef void(^ AEArrayReleaseBlock)(id _Nonnull item, void *_Nonnull bytes) |
Block for releasing allocated values.
Assign a block matching this type to AEArray's releaseBlock property to provide a custom release implementation. Use this if you are using a custom mapping block and need to perform extra cleanup tasks beyond simply freeing the returned pointer.
item | The original object |
bytes | The bytes originally returned from the custom mapping block |