Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
using rcljava_common::exceptions::rcljava_throw_exception;

JNIEXPORT jlong JNICALL
Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeAllocateRCL(
Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeAllocateRCLStatusEvent(
JNIEnv * env, jclass)
{
void * p = malloc(sizeof(rmw_message_lost_status_t));
Expand All @@ -36,14 +36,14 @@ Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeAllocateRCL(
}

JNIEXPORT void JNICALL
Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeDeallocateRCL(
Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeDeallocateRCLStatusEvent(
JNIEnv *, jclass, jlong handle)
{
free(reinterpret_cast<void *>(handle));
}

JNIEXPORT void JNICALL
Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeFromRCL(
Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeFromRCLEvent(
JNIEnv * env, jobject self, jlong handle)
{
auto * p = reinterpret_cast<rmw_message_lost_status_t *>(handle);
Expand All @@ -67,7 +67,7 @@ Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeFromRCL(
}

JNIEXPORT jint JNICALL
Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeGetEventType(
Java_org_ros2_rcljava_subscription_statuses_MessageLost_nativeGetSubscriptionEventType(
JNIEnv *, jclass)
{
return RCL_SUBSCRIPTION_MESSAGE_LOST;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ public class MessageLost implements SubscriptionEventStatus {
public int totalCountChange;

public final long allocateRCLStatusEvent() {
return nativeAllocateRCL();
return nativeAllocateRCLStatusEvent();
}
public final void deallocateRCLStatusEvent(long handle) {
nativeDeallocateRCL(handle);
nativeDeallocateRCLStatusEvent(handle);
}
public final void fromRCLEvent(long handle) {
nativeFromRCL(handle);
nativeFromRCLEvent(handle);
}
public final int getSubscriptionEventType() {
return nativeGetEventType();
return nativeGetSubscriptionEventType();
}
// TODO(ivanpauno): Remove this when -source 8 can be used (method references for the win)
public static final Supplier<MessageLost> factory = new Supplier<MessageLost>() {
Expand All @@ -48,6 +48,11 @@ public MessageLost get() {
}
};

private static native long nativeAllocateRCLStatusEvent();
private static native void nativeDeallocateRCLStatusEvent(long handle);
private native void nativeFromRCLEvent(long handle);
private static native int nativeGetSubscriptionEventType();

private static final Logger logger = LoggerFactory.getLogger(MessageLost.class);
static {
try {
Expand All @@ -57,9 +62,4 @@ public MessageLost get() {
System.exit(1);
}
}

private static native long nativeAllocateRCL();
private static native void nativeDeallocateRCL(long handle);
private native void nativeFromRCL(long handle);
private static native int nativeGetEventType();
}