- public static interface SocketDescriptorInterface {
- long send_data(byte[] data, boolean resume_read);
- void disconnect_socket();
- boolean eq(SocketDescriptor other_arg);
- long hash();
- }
- private static class LDKSocketDescriptorHolder { SocketDescriptor held; }
- public static SocketDescriptor new_impl(SocketDescriptorInterface arg) {
- final LDKSocketDescriptorHolder impl_holder = new LDKSocketDescriptorHolder();
- impl_holder.held = new SocketDescriptor(new bindings.LDKSocketDescriptor() {
- @Override public long send_data(byte[] data, boolean resume_read) {
- long ret = arg.send_data(data, resume_read);
+
+ export class SocketDescriptor extends CommonBase {
+
+ bindings_instance?: bindings.LDKSocketDescriptor;
+
+ constructor(ptr?: number, arg?: bindings.LDKSocketDescriptor) {
+ if (Number.isFinite(ptr)) {
+ super(ptr);
+ this.bindings_instance = null;
+ } else {
+ // TODO: private constructor instantiation
+ super(bindings.LDKSocketDescriptor_new(arg));
+ this.ptrs_to.push(arg);
+
+ }
+ }
+
+ protected finalize() {
+ if (this.ptr != 0) {
+ bindings.SocketDescriptor_free(this.ptr);
+ }
+ super.finalize();
+ }
+
+ static new_impl(arg: SocketDescriptorInterface): SocketDescriptor {
+ const impl_holder: LDKSocketDescriptorHolder = new LDKSocketDescriptorHolder();
+ let structImplementation = <bindings.LDKSocketDescriptor>{
+ // todo: in-line interface filling
+ send_data (data: Uint8Array, resume_read: boolean): number {
+ number ret = arg.send_data(data, resume_read);