dds.parResults Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of dds4j Show documentation
Show all versions of dds4j Show documentation
Wrapper around the Double Dummy Solver C++ Library.
The newest version!
// Generated by jextract
package dds;
import java.lang.invoke.*;
import java.lang.foreign.*;
import java.nio.ByteOrder;
import java.util.*;
import java.util.function.*;
import java.util.stream.*;
import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;
/**
* {@snippet lang=c :
* struct parResults {
* char parScore[2][16];
* char parContractsString[2][128];
* }
* }
*/
public class parResults {
parResults() {
// Should not be called directly
}
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
MemoryLayout.sequenceLayout(2, MemoryLayout.sequenceLayout(16, Dds.C_CHAR)).withName("parScore"),
MemoryLayout.sequenceLayout(2, MemoryLayout.sequenceLayout(128, Dds.C_CHAR)).withName("parContractsString")
).withName("parResults");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final SequenceLayout parScore$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("parScore"));
/**
* Layout for field:
* {@snippet lang=c :
* char parScore[2][16]
* }
*/
public static final SequenceLayout parScore$layout() {
return parScore$LAYOUT;
}
private static final long parScore$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* char parScore[2][16]
* }
*/
public static final long parScore$offset() {
return parScore$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* char parScore[2][16]
* }
*/
public static MemorySegment parScore(MemorySegment struct) {
return struct.asSlice(parScore$OFFSET, parScore$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* char parScore[2][16]
* }
*/
public static void parScore(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, parScore$OFFSET, parScore$LAYOUT.byteSize());
}
private static long[] parScore$DIMS = { 2, 16 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* char parScore[2][16]
* }
*/
public static long[] parScore$dimensions() {
return parScore$DIMS;
}
private static final VarHandle parScore$ELEM_HANDLE = parScore$LAYOUT.varHandle(sequenceElement(), sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* char parScore[2][16]
* }
*/
public static byte parScore(MemorySegment struct, long index0, long index1) {
return (byte)parScore$ELEM_HANDLE.get(struct, 0L, index0, index1);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* char parScore[2][16]
* }
*/
public static void parScore(MemorySegment struct, long index0, long index1, byte fieldValue) {
parScore$ELEM_HANDLE.set(struct, 0L, index0, index1, fieldValue);
}
private static final SequenceLayout parContractsString$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("parContractsString"));
/**
* Layout for field:
* {@snippet lang=c :
* char parContractsString[2][128]
* }
*/
public static final SequenceLayout parContractsString$layout() {
return parContractsString$LAYOUT;
}
private static final long parContractsString$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* char parContractsString[2][128]
* }
*/
public static final long parContractsString$offset() {
return parContractsString$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* char parContractsString[2][128]
* }
*/
public static MemorySegment parContractsString(MemorySegment struct) {
return struct.asSlice(parContractsString$OFFSET, parContractsString$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* char parContractsString[2][128]
* }
*/
public static void parContractsString(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, parContractsString$OFFSET, parContractsString$LAYOUT.byteSize());
}
private static long[] parContractsString$DIMS = { 2, 128 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* char parContractsString[2][128]
* }
*/
public static long[] parContractsString$dimensions() {
return parContractsString$DIMS;
}
private static final VarHandle parContractsString$ELEM_HANDLE = parContractsString$LAYOUT.varHandle(sequenceElement(), sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* char parContractsString[2][128]
* }
*/
public static byte parContractsString(MemorySegment struct, long index0, long index1) {
return (byte)parContractsString$ELEM_HANDLE.get(struct, 0L, index0, index1);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* char parContractsString[2][128]
* }
*/
public static void parContractsString(MemorySegment struct, long index0, long index1, byte fieldValue) {
parContractsString$ELEM_HANDLE.set(struct, 0L, index0, index1, fieldValue);
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction) (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
}