objc2_core_motion/generated/
CMAttitude.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmrotationmatrix?language=objc)
11#[repr(C)]
12#[derive(Clone, Copy, Debug, PartialEq)]
13pub struct CMRotationMatrix {
14    pub m11: c_double,
15    pub m12: c_double,
16    pub m13: c_double,
17    pub m21: c_double,
18    pub m22: c_double,
19    pub m23: c_double,
20    pub m31: c_double,
21    pub m32: c_double,
22    pub m33: c_double,
23}
24
25unsafe impl Encode for CMRotationMatrix {
26    const ENCODING: Encoding = Encoding::Struct(
27        "?",
28        &[
29            <c_double>::ENCODING,
30            <c_double>::ENCODING,
31            <c_double>::ENCODING,
32            <c_double>::ENCODING,
33            <c_double>::ENCODING,
34            <c_double>::ENCODING,
35            <c_double>::ENCODING,
36            <c_double>::ENCODING,
37            <c_double>::ENCODING,
38        ],
39    );
40}
41
42unsafe impl RefEncode for CMRotationMatrix {
43    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
44}
45
46/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmquaternion?language=objc)
47#[repr(C)]
48#[derive(Clone, Copy, Debug, PartialEq)]
49pub struct CMQuaternion {
50    pub x: c_double,
51    pub y: c_double,
52    pub z: c_double,
53    pub w: c_double,
54}
55
56unsafe impl Encode for CMQuaternion {
57    const ENCODING: Encoding = Encoding::Struct(
58        "?",
59        &[
60            <c_double>::ENCODING,
61            <c_double>::ENCODING,
62            <c_double>::ENCODING,
63            <c_double>::ENCODING,
64        ],
65    );
66}
67
68unsafe impl RefEncode for CMQuaternion {
69    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
70}
71
72/// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmattitudereferenceframe?language=objc)
73// NS_OPTIONS
74#[repr(transparent)]
75#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
76pub struct CMAttitudeReferenceFrame(pub NSUInteger);
77bitflags::bitflags! {
78    impl CMAttitudeReferenceFrame: NSUInteger {
79        #[doc(alias = "CMAttitudeReferenceFrameXArbitraryZVertical")]
80        const XArbitraryZVertical = 1<<0;
81        #[doc(alias = "CMAttitudeReferenceFrameXArbitraryCorrectedZVertical")]
82        const XArbitraryCorrectedZVertical = 1<<1;
83        #[doc(alias = "CMAttitudeReferenceFrameXMagneticNorthZVertical")]
84        const XMagneticNorthZVertical = 1<<2;
85        #[doc(alias = "CMAttitudeReferenceFrameXTrueNorthZVertical")]
86        const XTrueNorthZVertical = 1<<3;
87    }
88}
89
90unsafe impl Encode for CMAttitudeReferenceFrame {
91    const ENCODING: Encoding = NSUInteger::ENCODING;
92}
93
94unsafe impl RefEncode for CMAttitudeReferenceFrame {
95    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
96}
97
98extern_class!(
99    /// [Apple's documentation](https://developer.apple.com/documentation/coremotion/cmattitude?language=objc)
100    #[unsafe(super(NSObject))]
101    #[derive(Debug, PartialEq, Eq, Hash)]
102    pub struct CMAttitude;
103);
104
105extern_conformance!(
106    unsafe impl NSCoding for CMAttitude {}
107);
108
109extern_conformance!(
110    unsafe impl NSCopying for CMAttitude {}
111);
112
113unsafe impl CopyingHelper for CMAttitude {
114    type Result = Self;
115}
116
117extern_conformance!(
118    unsafe impl NSObjectProtocol for CMAttitude {}
119);
120
121extern_conformance!(
122    unsafe impl NSSecureCoding for CMAttitude {}
123);
124
125impl CMAttitude {
126    extern_methods!(
127        #[unsafe(method(roll))]
128        #[unsafe(method_family = none)]
129        pub unsafe fn roll(&self) -> c_double;
130
131        #[unsafe(method(pitch))]
132        #[unsafe(method_family = none)]
133        pub unsafe fn pitch(&self) -> c_double;
134
135        #[unsafe(method(yaw))]
136        #[unsafe(method_family = none)]
137        pub unsafe fn yaw(&self) -> c_double;
138
139        #[unsafe(method(rotationMatrix))]
140        #[unsafe(method_family = none)]
141        pub unsafe fn rotationMatrix(&self) -> CMRotationMatrix;
142
143        #[unsafe(method(quaternion))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn quaternion(&self) -> CMQuaternion;
146
147        #[unsafe(method(multiplyByInverseOfAttitude:))]
148        #[unsafe(method_family = none)]
149        pub unsafe fn multiplyByInverseOfAttitude(&self, attitude: &CMAttitude);
150    );
151}
152
153/// Methods declared on superclass `NSObject`.
154impl CMAttitude {
155    extern_methods!(
156        #[unsafe(method(init))]
157        #[unsafe(method_family = init)]
158        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
159
160        #[unsafe(method(new))]
161        #[unsafe(method_family = new)]
162        pub unsafe fn new() -> Retained<Self>;
163    );
164}