|
| 1 | +// Auto-generated by JniExt — do not edit by hand. |
| 2 | +package io.zenoh.jni.query |
| 3 | + |
| 4 | +import io.zenoh.jni.Error |
| 5 | +import io.zenoh.jni.JNINative |
| 6 | +import io.zenoh.jni.JniBindingError |
| 7 | +import io.zenoh.jni.bytes.ZEncoding |
| 8 | +import io.zenoh.jni.bytes.ZZBytes |
| 9 | +import io.zenoh.jni.keyexpr.ZKeyExpr |
| 10 | + |
| 11 | +/** Typed handle for a native Zenoh `ZQuery`. */ |
| 12 | +public class ZQuery(initialPtr: Long) : AutoCloseable { |
| 13 | + @Volatile internal var ptr: Long = initialPtr |
| 14 | + |
| 15 | + public fun peek(): Long = ptr |
| 16 | + public fun isClosed(): Boolean = ptr == 0L |
| 17 | + |
| 18 | + @Synchronized |
| 19 | + override fun close() { |
| 20 | + val p = ptr |
| 21 | + if (p != 0L) { |
| 22 | + ptr = 0L |
| 23 | + freePtr(p) |
| 24 | + } |
| 25 | + } |
| 26 | + |
| 27 | + @Synchronized |
| 28 | + public fun take(): ZQuery { |
| 29 | + val p = ptr |
| 30 | + ptr = 0L |
| 31 | + return ZQuery(p) |
| 32 | + } |
| 33 | + |
| 34 | + @Throws(Error::class, JniBindingError::class) |
| 35 | + public fun zQueryReplySuccess(keyExpr: Any, payload: Any, encoding: Any, timestampNtp64: Long?, attachment: Any?, express: Boolean) { |
| 36 | + synchronized(this) { |
| 37 | + val query_ptr = this.ptr |
| 38 | + if (query_ptr == 0L) throw JniBindingError("Operation on a closed native handle.") |
| 39 | + try { |
| 40 | + if (keyExpr is ZKeyExpr) synchronized(keyExpr) { |
| 41 | + if (payload is ZZBytes) synchronized(payload) { |
| 42 | + if (encoding is ZEncoding) synchronized(encoding) { |
| 43 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 44 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 45 | + } else { |
| 46 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 47 | + } |
| 48 | + } else { |
| 49 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 50 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 51 | + } else { |
| 52 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 53 | + } |
| 54 | + } |
| 55 | + } else { |
| 56 | + if (encoding is ZEncoding) synchronized(encoding) { |
| 57 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 58 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 59 | + } else { |
| 60 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 61 | + } |
| 62 | + } else { |
| 63 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 64 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 65 | + } else { |
| 66 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | + } else { |
| 71 | + if (payload is ZZBytes) synchronized(payload) { |
| 72 | + if (encoding is ZEncoding) synchronized(encoding) { |
| 73 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 74 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 75 | + } else { |
| 76 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 77 | + } |
| 78 | + } else { |
| 79 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 80 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 81 | + } else { |
| 82 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 83 | + } |
| 84 | + } |
| 85 | + } else { |
| 86 | + if (encoding is ZEncoding) synchronized(encoding) { |
| 87 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 88 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 89 | + } else { |
| 90 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 91 | + } |
| 92 | + } else { |
| 93 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 94 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 95 | + } else { |
| 96 | + JNINative.zQueryReplySuccess(query_ptr, keyExpr, payload, encoding, timestampNtp64, attachment, express) |
| 97 | + } |
| 98 | + } |
| 99 | + } |
| 100 | + } |
| 101 | + } finally { |
| 102 | + ptr = 0L |
| 103 | + } |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + @Throws(Error::class, JniBindingError::class) |
| 108 | + public fun zQueryReplyError(payload: Any, encoding: Any) { |
| 109 | + synchronized(this) { |
| 110 | + val query_ptr = this.ptr |
| 111 | + if (query_ptr == 0L) throw JniBindingError("Operation on a closed native handle.") |
| 112 | + try { |
| 113 | + if (payload is ZZBytes) synchronized(payload) { |
| 114 | + if (encoding is ZEncoding) synchronized(encoding) { |
| 115 | + JNINative.zQueryReplyError(query_ptr, payload, encoding) |
| 116 | + } else { |
| 117 | + JNINative.zQueryReplyError(query_ptr, payload, encoding) |
| 118 | + } |
| 119 | + } else { |
| 120 | + if (encoding is ZEncoding) synchronized(encoding) { |
| 121 | + JNINative.zQueryReplyError(query_ptr, payload, encoding) |
| 122 | + } else { |
| 123 | + JNINative.zQueryReplyError(query_ptr, payload, encoding) |
| 124 | + } |
| 125 | + } |
| 126 | + } finally { |
| 127 | + ptr = 0L |
| 128 | + } |
| 129 | + } |
| 130 | + } |
| 131 | + |
| 132 | + @Throws(Error::class, JniBindingError::class) |
| 133 | + public fun zQueryReplyDelete(keyExpr: Any, timestampNtp64: Long?, attachment: Any?, express: Boolean) { |
| 134 | + synchronized(this) { |
| 135 | + val query_ptr = this.ptr |
| 136 | + if (query_ptr == 0L) throw JniBindingError("Operation on a closed native handle.") |
| 137 | + try { |
| 138 | + if (keyExpr is ZKeyExpr) synchronized(keyExpr) { |
| 139 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 140 | + JNINative.zQueryReplyDelete(query_ptr, keyExpr, timestampNtp64, attachment, express) |
| 141 | + } else { |
| 142 | + JNINative.zQueryReplyDelete(query_ptr, keyExpr, timestampNtp64, attachment, express) |
| 143 | + } |
| 144 | + } else { |
| 145 | + if (attachment is ZZBytes) synchronized(attachment) { |
| 146 | + JNINative.zQueryReplyDelete(query_ptr, keyExpr, timestampNtp64, attachment, express) |
| 147 | + } else { |
| 148 | + JNINative.zQueryReplyDelete(query_ptr, keyExpr, timestampNtp64, attachment, express) |
| 149 | + } |
| 150 | + } |
| 151 | + } finally { |
| 152 | + ptr = 0L |
| 153 | + } |
| 154 | + } |
| 155 | + } |
| 156 | + |
| 157 | + public companion object { |
| 158 | + @JvmStatic |
| 159 | + external fun freePtr(ptr: Long) |
| 160 | + } |
| 161 | +} |
0 commit comments