use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MPSNDArrayQuantizationScheme(pub NSUInteger);
bitflags::bitflags! {
impl MPSNDArrayQuantizationScheme: NSUInteger {
#[doc(alias = "MPSNDArrayQuantizationTypeNone")]
const TypeNone = 0;
#[doc(alias = "MPSNDArrayQuantizationTypeAffine")]
const TypeAffine = 1;
#[doc(alias = "MPSNDArrayQuantizationTypeLUT")]
const TypeLUT = 2;
}
}
unsafe impl Encode for MPSNDArrayQuantizationScheme {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for MPSNDArrayQuantizationScheme {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MPSNDArrayQuantizationDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MPSNDArrayQuantizationDescriptor {}
);
unsafe impl CopyingHelper for MPSNDArrayQuantizationDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MPSNDArrayQuantizationDescriptor {}
);
impl MPSNDArrayQuantizationDescriptor {
extern_methods!(
#[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
#[unsafe(method(quantizationDataType))]
#[unsafe(method_family = none)]
pub unsafe fn quantizationDataType(&self) -> MPSDataType;
#[unsafe(method(quantizationScheme))]
#[unsafe(method_family = none)]
pub unsafe fn quantizationScheme(&self) -> MPSNDArrayQuantizationScheme;
);
}
impl MPSNDArrayQuantizationDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(MPSNDArrayQuantizationDescriptor, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MPSNDArrayAffineQuantizationDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MPSNDArrayAffineQuantizationDescriptor {}
);
unsafe impl CopyingHelper for MPSNDArrayAffineQuantizationDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MPSNDArrayAffineQuantizationDescriptor {}
);
impl MPSNDArrayAffineQuantizationDescriptor {
extern_methods!(
#[unsafe(method(hasZeroPoint))]
#[unsafe(method_family = none)]
pub unsafe fn hasZeroPoint(&self) -> bool;
#[unsafe(method(setHasZeroPoint:))]
#[unsafe(method_family = none)]
pub unsafe fn setHasZeroPoint(&self, has_zero_point: bool);
#[unsafe(method(hasMinValue))]
#[unsafe(method_family = none)]
pub unsafe fn hasMinValue(&self) -> bool;
#[unsafe(method(setHasMinValue:))]
#[unsafe(method_family = none)]
pub unsafe fn setHasMinValue(&self, has_min_value: bool);
#[unsafe(method(implicitZeroPoint))]
#[unsafe(method_family = none)]
pub unsafe fn implicitZeroPoint(&self) -> bool;
#[unsafe(method(setImplicitZeroPoint:))]
#[unsafe(method_family = none)]
pub unsafe fn setImplicitZeroPoint(&self, implicit_zero_point: bool);
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
#[unsafe(method(initWithDataType:hasZeroPoint:hasMinValue:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDataType_hasZeroPoint_hasMinValue(
this: Allocated<Self>,
quantization_data_type: MPSDataType,
has_zero_point: bool,
has_min_value: bool,
) -> Retained<Self>;
);
}
impl MPSNDArrayAffineQuantizationDescriptor {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}
extern_class!(
#[unsafe(super(MPSNDArrayQuantizationDescriptor, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct MPSNDArrayLUTQuantizationDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MPSNDArrayLUTQuantizationDescriptor {}
);
unsafe impl CopyingHelper for MPSNDArrayLUTQuantizationDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MPSNDArrayLUTQuantizationDescriptor {}
);
impl MPSNDArrayLUTQuantizationDescriptor {
extern_methods!(
#[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
#[unsafe(method(initWithDataType:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDataType(
this: Allocated<Self>,
quantization_data_type: MPSDataType,
) -> Retained<Self>;
#[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
#[unsafe(method(initWithDataType:vectorAxis:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithDataType_vectorAxis(
this: Allocated<Self>,
quantization_data_type: MPSDataType,
vector_axis: NSUInteger,
) -> Retained<Self>;
);
}
impl MPSNDArrayLUTQuantizationDescriptor {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}