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
java: rename an internal method
[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
57bc735
..
271990a
100644
(file)
--- a/
src/bindings/java/jmsg_as.cpp
+++ b/
src/bindings/java/jmsg_as.cpp
@@
-7,6
+7,7
@@
#include "simgrid/s4u/NetZone.hpp"
#include "simgrid/s4u/host.hpp"
#include "simgrid/s4u/NetZone.hpp"
#include "simgrid/s4u/host.hpp"
+#include "src/kernel/routing/NetZoneImpl.hpp"
#include "jmsg_as.h"
#include "jmsg_host.h"
#include "jmsg_as.h"
#include "jmsg_host.h"
@@
-63,29
+64,22
@@
JNIEXPORT jobject JNICALL Java_org_simgrid_msg_As_getName(JNIEnv * env, jobject
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;
- jobject tmp_jas;
- simgrid::s4u::NetZone* tmp_as;
- simgrid::s4u::NetZone* self_as = jnetzone_get_native(env, jas);
+ sg_netzone_t self_as = jnetzone_get_native(env, jas);
- xbt_dict_t dict = self_as->children();
- int count = xbt_dict_length(dict);
jclass cls = env->FindClass("org/simgrid/msg/As");
if (!cls)
return nullptr;
jclass cls = env->FindClass("org/simgrid/msg/As");
if (!cls)
return nullptr;
- jtable = env->NewObjectArray(static_cast<jsize>(
count
), cls, nullptr);
+ jtable = env->NewObjectArray(static_cast<jsize>(
self_as->children()->size()
), cls, nullptr);
if (!jtable) {
jxbt_throw_jni(env, "Hosts table allocation failed");
return nullptr;
}
if (!jtable) {
jxbt_throw_jni(env, "Hosts table allocation failed");
return nullptr;
}
- xbt_dict_cursor_t cursor=nullptr;
- char *key;
-
- xbt_dict_foreach(dict,cursor,key,tmp_as) {
- tmp_jas = jnetzone_new_instance(env);
+ for (auto tmp_as : *self_as->children()) {
+ jobject tmp_jas = jnetzone_new_instance(env);
if (!tmp_jas) {
jxbt_throw_jni(env, "java As instantiation failed");
return nullptr;
if (!tmp_jas) {
jxbt_throw_jni(env, "java As instantiation failed");
return nullptr;
@@
-132,11
+126,11
@@
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
simgrid::s4u::NetZone* as = jnetzone_get_native(env, jas);
jclass cls = jxbt_get_class(env, "org/simgrid/msg/Host");
- std::vector<sg_host_t> table = as->hosts();
+ std::vector<sg_host_t>
*
table = as->hosts();
if (!cls)
return nullptr;
if (!cls)
return nullptr;
- jtable = env->NewObjectArray(static_cast<jsize>(table
.
size()), cls, nullptr);
+ jtable = env->NewObjectArray(static_cast<jsize>(table
->
size()), cls, nullptr);
if (!jtable) {
jxbt_throw_jni(env, "Hosts table allocation failed");
if (!jtable) {
jxbt_throw_jni(env, "Hosts table allocation failed");
@@
-144,7
+138,7
@@
JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_As_getHosts(JNIEnv * env, jo
}
int index = 0;
}
int index = 0;
- for (auto host : table) {
+ for (auto host :
*
table) {
jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
if (!jhost) {
jname = env->NewStringUTF(host->cname());
jhost = static_cast<jobject>(host->extension(JAVA_HOST_LEVEL));
if (!jhost) {
jname = env->NewStringUTF(host->cname());