objc2_gameplay_kit/generated/
GKGraphNode.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
10extern_class!(
11    /// A node in a directed graph. Edges are directed and can have variable costs.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkgraphnode?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct GKGraphNode;
17);
18
19extern_conformance!(
20    unsafe impl NSCoding for GKGraphNode {}
21);
22
23extern_conformance!(
24    unsafe impl NSObjectProtocol for GKGraphNode {}
25);
26
27extern_conformance!(
28    unsafe impl NSSecureCoding for GKGraphNode {}
29);
30
31impl GKGraphNode {
32    extern_methods!(
33        /// List of other graph nodes that this node has an edge leading to.
34        #[unsafe(method(connectedNodes))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn connectedNodes(&self) -> Retained<NSArray<GKGraphNode>>;
37
38        /// Add a connection to a group of other nodes indicating those nodes can be reached from this node.
39        /// A new connection is not created if it already exists.
40        ///
41        /// Parameter `nodes`: The array of nodes that are end points for their respective connections
42        ///
43        /// Parameter `bidirectional`: should a connection also be added connecting the destination node back to this node?
44        #[unsafe(method(addConnectionsToNodes:bidirectional:))]
45        #[unsafe(method_family = none)]
46        pub unsafe fn addConnectionsToNodes_bidirectional(
47            &self,
48            nodes: &NSArray<GKGraphNode>,
49            bidirectional: bool,
50        );
51
52        /// Removes connections to a group of other nodes indicating those nodes can no longer be reached from this node.
53        /// Nothing happens if a particular connection does not exist.
54        ///
55        /// Parameter `nodes`: The array of nodes that are end points of the edges to be removed
56        ///
57        /// Parameter `bidirectional`: should the connection also be added the destination node back to this node also be removed if it exists?
58        #[unsafe(method(removeConnectionsToNodes:bidirectional:))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn removeConnectionsToNodes_bidirectional(
61            &self,
62            nodes: &NSArray<GKGraphNode>,
63            bidirectional: bool,
64        );
65
66        /// Returns the estimated heuristic cost to reach the indicated node from this node
67        ///
68        /// Parameter `node`: The end point of the edge who's cost is to be estimated
69        #[unsafe(method(estimatedCostToNode:))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn estimatedCostToNode(&self, node: &GKGraphNode) -> c_float;
72
73        /// Returns the actual cost to reach the indicated node from this node
74        #[unsafe(method(costToNode:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn costToNode(&self, node: &GKGraphNode) -> c_float;
77
78        /// Attempts to find the optimal path between this node and the indicated goal node.
79        /// If such a path exists, it is returned in start to end order.
80        /// If it doesn't exist, the array returned will be empty.
81        ///
82        /// Parameter `goalNode`: the goal node of the pathfinding attempt
83        #[unsafe(method(findPathToNode:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn findPathToNode(
86            &self,
87            goal_node: &GKGraphNode,
88        ) -> Retained<NSArray<GKGraphNode>>;
89
90        /// As with findPathToNode: except this node is the goal node and a startNode is specified
91        ///
92        /// Parameter `startNode`: the start node of the pathfinding attempt
93        #[unsafe(method(findPathFromNode:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn findPathFromNode(
96            &self,
97            start_node: &GKGraphNode,
98        ) -> Retained<NSArray<GKGraphNode>>;
99    );
100}
101
102/// Methods declared on superclass `NSObject`.
103impl GKGraphNode {
104    extern_methods!(
105        #[unsafe(method(init))]
106        #[unsafe(method_family = init)]
107        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
108
109        #[unsafe(method(new))]
110        #[unsafe(method_family = new)]
111        pub unsafe fn new() -> Retained<Self>;
112    );
113}
114
115extern_class!(
116    /// GKGraphNode coupled with a 2D position
117    ///
118    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkgraphnode2d?language=objc)
119    #[unsafe(super(GKGraphNode, NSObject))]
120    #[derive(Debug, PartialEq, Eq, Hash)]
121    pub struct GKGraphNode2D;
122);
123
124extern_conformance!(
125    unsafe impl NSCoding for GKGraphNode2D {}
126);
127
128extern_conformance!(
129    unsafe impl NSObjectProtocol for GKGraphNode2D {}
130);
131
132extern_conformance!(
133    unsafe impl NSSecureCoding for GKGraphNode2D {}
134);
135
136impl GKGraphNode2D {
137    extern_methods!();
138}
139
140/// Methods declared on superclass `NSObject`.
141impl GKGraphNode2D {
142    extern_methods!(
143        #[unsafe(method(init))]
144        #[unsafe(method_family = init)]
145        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
146
147        #[unsafe(method(new))]
148        #[unsafe(method_family = new)]
149        pub unsafe fn new() -> Retained<Self>;
150    );
151}
152
153extern_class!(
154    /// GKGraphNode coupled with a 3D position
155    ///
156    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkgraphnode3d?language=objc)
157    #[unsafe(super(GKGraphNode, NSObject))]
158    #[derive(Debug, PartialEq, Eq, Hash)]
159    pub struct GKGraphNode3D;
160);
161
162extern_conformance!(
163    unsafe impl NSCoding for GKGraphNode3D {}
164);
165
166extern_conformance!(
167    unsafe impl NSObjectProtocol for GKGraphNode3D {}
168);
169
170extern_conformance!(
171    unsafe impl NSSecureCoding for GKGraphNode3D {}
172);
173
174impl GKGraphNode3D {
175    extern_methods!();
176}
177
178/// Methods declared on superclass `NSObject`.
179impl GKGraphNode3D {
180    extern_methods!(
181        #[unsafe(method(init))]
182        #[unsafe(method_family = init)]
183        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
184
185        #[unsafe(method(new))]
186        #[unsafe(method_family = new)]
187        pub unsafe fn new() -> Retained<Self>;
188    );
189}
190
191extern_class!(
192    /// GKGraphNode coupled with a position on a 2D grid
193    ///
194    /// See also [Apple's documentation](https://developer.apple.com/documentation/gameplaykit/gkgridgraphnode?language=objc)
195    #[unsafe(super(GKGraphNode, NSObject))]
196    #[derive(Debug, PartialEq, Eq, Hash)]
197    pub struct GKGridGraphNode;
198);
199
200extern_conformance!(
201    unsafe impl NSCoding for GKGridGraphNode {}
202);
203
204extern_conformance!(
205    unsafe impl NSObjectProtocol for GKGridGraphNode {}
206);
207
208extern_conformance!(
209    unsafe impl NSSecureCoding for GKGridGraphNode {}
210);
211
212impl GKGridGraphNode {
213    extern_methods!();
214}
215
216/// Methods declared on superclass `NSObject`.
217impl GKGridGraphNode {
218    extern_methods!(
219        #[unsafe(method(init))]
220        #[unsafe(method_family = init)]
221        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
222
223        #[unsafe(method(new))]
224        #[unsafe(method_family = new)]
225        pub unsafe fn new() -> Retained<Self>;
226    );
227}