Package org.bytedeco.javacpp.annotation
Annotation Type Allocator
-
@Documented @Retention(RUNTIME) @Target({TYPE,METHOD}) public @interface Allocator
An annotation indicating that a method should behave like an allocator. However, methods with signaturenative void allocate(...)
are recognized as allocators even without annotation. This behavior can be changed by annotating the method with theFunction
annotation. An allocator must have no return values, but can have parameters corresponding to the ones found on the native C++ constructors.In a nutshell, an allocator uses the C++
new
operator along with all the given arguments, and initializes thePointer.address
as well as thePointer.deallocator
withNativeDeallocator
, based on thedelete
operator, if not additionally annotated withNoDeallocator
.Can also be used on classes to set the
max()
value for enclosed function pointers.- See Also:
Pointer.init(long, long, long, long)
,Generator
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description int
max
The maximum number of instances that can be allocated in the case of aFunctionPointer
subclass.
-
-
-
Element Detail
-
max
int max
The maximum number of instances that can be allocated in the case of aFunctionPointer
subclass. Does not affect the underlying function object or otherPointer
which have no such allocation limits.- Default:
- 10
-
-