A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update copyright lines with new year.
[simgrid.git]
/
src
/
bindings
/
java
/
jmsg_as.cpp
diff --git
a/src/bindings/java/jmsg_as.cpp
b/src/bindings/java/jmsg_as.cpp
index
cd344be
..
d9fddbd
100644
(file)
--- a/
src/bindings/java/jmsg_as.cpp
+++ b/
src/bindings/java/jmsg_as.cpp
@@
-1,23
+1,21
@@
/* Java bindings of the NetZones. */
/* Java bindings of the NetZones. */
-/* Copyright (c) 2007-20
17
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-20
20
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
+#include "simgrid/kernel/routing/NetZoneImpl.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/NetZone.hpp"
#include "simgrid/s4u/Host.hpp"
#include "simgrid/s4u/NetZone.hpp"
-#include "src/kernel/routing/NetZoneImpl.hpp"
-#include "jmsg_as.h"
+#include "jmsg.hpp"
+#include "jmsg_as.hpp"
#include "jmsg_host.h"
#include "jmsg_host.h"
-#include "jxbt_utilities.h"
-#include "jmsg.h"
+#include "jxbt_utilities.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(java);
-SG_BEGIN_DECL()
-
static jmethodID jas_method_As_constructor;
static jfieldID jas_field_As_bind;
static jmethodID jas_method_As_constructor;
static jfieldID jas_field_As_bind;
@@
-57,28
+55,28
@@
JNIEXPORT void JNICALL Java_org_simgrid_msg_As_nativeInit(JNIEnv* env, jclass cl
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject jas) {
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject jas) {
- simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
- return env->NewStringUTF(as->get
C
name());
+
const
simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
+ return env->NewStringUTF(as->get
_c
name());
}
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, jobject jas) {
int index = 0;
jobjectArray jtable;
}
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, jobject jas) {
int index = 0;
jobjectArray jtable;
-
sg_netzone_t
self_as = jnetzone_get_native(env, jas);
+
const simgrid::s4u::NetZone*
self_as = jnetzone_get_native(env, jas);
jclass cls = env->FindClass("org/simgrid/msg/As");
if (not cls)
return nullptr;
jclass cls = env->FindClass("org/simgrid/msg/As");
if (not cls)
return nullptr;
- jtable = env->NewObjectArray(static_cast<jsize>(self_as->get
Children()->
size()), cls, nullptr);
+ jtable = env->NewObjectArray(static_cast<jsize>(self_as->get
_children().
size()), cls, nullptr);
if (not jtable) {
jxbt_throw_jni(env, "Hosts table allocation failed");
return nullptr;
}
if (not jtable) {
jxbt_throw_jni(env, "Hosts table allocation failed");
return nullptr;
}
- for (auto
tmp_as : *self_as->getC
hildren()) {
+ for (auto
const& tmp_as : self_as->get_c
hildren()) {
jobject tmp_jas = jnetzone_new_instance(env);
if (not tmp_jas) {
jxbt_throw_jni(env, "java As instantiation failed");
jobject tmp_jas = jnetzone_new_instance(env);
if (not tmp_jas) {
jxbt_throw_jni(env, "java As instantiation failed");
@@
-98,7
+96,7
@@
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getSons(JNIEnv * env, job
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobject jas, jobject jname) {
}
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getProperty(JNIEnv *env, jobject jas, jobject jname) {
- simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
+
const
simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
if (not as) {
jxbt_throw_notbound(env, "as", jas);
if (not as) {
jxbt_throw_notbound(env, "as", jas);
@@
-123,14
+121,13
@@
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
jobjectArray jtable;
jobject jhost;
jstring jname;
jobjectArray jtable;
jobject jhost;
jstring jname;
- simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
+
const
simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
if (not cls)
return nullptr;
jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
if (not cls)
return nullptr;
- std::vector<sg_host_t> table;
- as->getHosts(&table);
+ std::vector<simgrid::s4u::Host*> table = as->get_all_hosts();
jtable = env->NewObjectArray(static_cast<jsize>(table.size()), cls, nullptr);
jtable = env->NewObjectArray(static_cast<jsize>(table.size()), cls, nullptr);
@@
-140,14
+137,14
@@
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
}
int index = 0;
}
int index = 0;
- for (auto host : table) {
+ for (auto
const&
host : table) {
jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
if (not jhost) {
jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
if (not jhost) {
- jname = env->NewStringUTF(host->get
C
name());
+ jname = env->NewStringUTF(host->get
_c
name());
jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname);
jhost = Java_org_simgrid_msg_Host_getByName(env, cls, jname);
- env->ReleaseStringUTFChars(static_cast<jstring>(jname), host->get
C
name());
+ env->ReleaseStringUTFChars(static_cast<jstring>(jname), host->get
_c
name());
}
env->SetObjectArrayElement(jtable, index, jhost);
}
env->SetObjectArrayElement(jtable, index, jhost);
@@
-155,5
+152,3
@@
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
}
return jtable;
}
}
return jtable;
}
-
-SG_END_DECL()