JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_setProperty(JNIEnv *env, jobject jhost, jobject jname, jobject jvalue) { msg_host_t host = jhost_get_native(env, jhost); if (!host) { jxbt_throw_notbound(env, "host", jhost); return; } const char *name = env->GetStringUTFChars((jstring) jname, 0); const char *value_java = env->GetStringUTFChars((jstring) jvalue, 0); char *value = xbt_strdup(value_java); MSG_host_set_property_value(host, name, value, xbt_free_f); env->ReleaseStringUTFChars((jstring) jvalue, value_java); env->ReleaseStringUTFChars((jstring) jname, name); }
/** \ingroup m_host_management * * \brief Set the user data of a #msg_host_t. * * This functions checks whether some data has already been associated to \a host or not and attach \a data to \a host if it is possible. */ msg_error_t MSG_host_set_data(msg_host_t host, void *data) { MSG_host_set_property_value(host, msg_data, data, NULL); return MSG_OK; }