Loading...
Searching...
No Matches
Beacon.java
Go to the documentation of this file.
1package com.navigine.idl.java;
2
3import java.util.concurrent.atomic.AtomicBoolean;
4
18public abstract class Beacon {
31 public abstract Point getPoint();
32
45 public abstract int getLocationId();
46
59 public abstract int getSublocationId();
60
73 public abstract String getName();
74
87 public abstract int getMajor();
88
101 public abstract int getMinor();
102
115 public abstract String getUuid();
116
129 public abstract Integer getPower();
130
143 public abstract TransmitterStatus getStatus();
144
145 private static final class CppProxy extends Beacon
146 {
147 private final long nativeRef;
148 private final AtomicBoolean destroyed = new AtomicBoolean(false);
149
150 private CppProxy(long nativeRef)
151 {
152 if (nativeRef == 0) throw new RuntimeException("nativeRef is zero");
153 this.nativeRef = nativeRef;
154 }
155
156 private native void nativeDestroy(long nativeRef);
157 public void _djinni_private_destroy()
158 {
159 boolean destroyed = this.destroyed.getAndSet(true);
160 if (!destroyed) nativeDestroy(this.nativeRef);
161 }
162 protected void finalize() throws java.lang.Throwable
163 {
164 _djinni_private_destroy();
165 super.finalize();
166 }
167
168 // Beacon methods
169
170 @Override
171 public Point getPoint()
172 {
173 assert !this.destroyed.get() : "trying to use a destroyed object";
174 return native_getPoint(this.nativeRef);
175 }
176 private native Point native_getPoint(long _nativeRef);
177
178 @Override
179 public int getLocationId()
180 {
181 assert !this.destroyed.get() : "trying to use a destroyed object";
182 return native_getLocationId(this.nativeRef);
183 }
184 private native int native_getLocationId(long _nativeRef);
185
186 @Override
187 public int getSublocationId()
188 {
189 assert !this.destroyed.get() : "trying to use a destroyed object";
190 return native_getSublocationId(this.nativeRef);
191 }
192 private native int native_getSublocationId(long _nativeRef);
193
194 @Override
195 public String getName()
196 {
197 assert !this.destroyed.get() : "trying to use a destroyed object";
198 return native_getName(this.nativeRef);
199 }
200 private native String native_getName(long _nativeRef);
201
202 @Override
203 public int getMajor()
204 {
205 assert !this.destroyed.get() : "trying to use a destroyed object";
206 return native_getMajor(this.nativeRef);
207 }
208 private native int native_getMajor(long _nativeRef);
209
210 @Override
211 public int getMinor()
212 {
213 assert !this.destroyed.get() : "trying to use a destroyed object";
214 return native_getMinor(this.nativeRef);
215 }
216 private native int native_getMinor(long _nativeRef);
217
218 @Override
219 public String getUuid()
220 {
221 assert !this.destroyed.get() : "trying to use a destroyed object";
222 return native_getUuid(this.nativeRef);
223 }
224 private native String native_getUuid(long _nativeRef);
225
226 @Override
227 public Integer getPower()
228 {
229 assert !this.destroyed.get() : "trying to use a destroyed object";
230 return native_getPower(this.nativeRef);
231 }
232 private native Integer native_getPower(long _nativeRef);
233
234 @Override
235 public TransmitterStatus getStatus()
236 {
237 assert !this.destroyed.get() : "trying to use a destroyed object";
238 return native_getStatus(this.nativeRef);
239 }
240 private native TransmitterStatus native_getStatus(long _nativeRef);
241 }
242}