1 /* Functions related to the java host instances. */
3 /* Copyright (c) 2007-2014. The SimGrid Team.
4 * All rights reserved. */
6 /* This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package. */
16 * This function returns a new java host instance.
18 * @param env The environment of the current thread
20 * @return A new java host object.
22 * @exception If the class Host is not found the function throws
23 * the ClassNotFoundException. If the constructor of
24 * this class is not found the function throws the exception
25 * NotSuchMethodException.
27 jobject jhost_new_instance(JNIEnv * env);
30 * This function returns a global reference to the java host instance
31 * specified by the parameter jhost.
33 * @param jhost The original java host instance.
34 * @param env The environment of the current thread
36 * @return The global reference to the original java host
39 jobject jhost_ref(JNIEnv * env, jobject jhost);
41 * This function delete a global reference to a java host instance.
43 * @param The global refernce to delete.
44 * @param env The environment of the current thread
46 void jhost_unref(JNIEnv * env, jobject jhost);
49 * This function associated a native host to a java host instance.
51 * @param jhost The java host instance.
52 * @param host The native host to bind.
53 * @param env The environment of the current thread
55 * @exception If the class Host is not found the function throws
56 * the ClassNotFoundException. If the field bind of
57 * this class is not found the function throws the exception
58 * NotSuchFieldException.
60 void jhost_bind(jobject jhost, msg_host_t host, JNIEnv * env);
63 * This function returns a native host from a java host instance.
65 * @param jhost The java host object from which get the native host.
66 * @param env The environment of the current thread
68 * @return The function returns the native host associated to the
71 * @exception If the class Host is not found the function throws
72 * the ClassNotFoundException. If the field bind of
73 * this class is not found the function throws the exception
74 * NotSuchFieldException.
76 msg_host_t jhost_get_native(JNIEnv * env, jobject jhost);
79 * This function returns the name of a MSG host.
81 * @param jhost A java host object.
82 * @param env The environment of the current thread
84 * @return The name of the host.
86 const char *jhost_get_name(jobject jhost, JNIEnv * env);
89 * This function tests if a java host instance is valid.
90 * A java host object is valid if it is bind to a native host.
92 * @param jhost The host to test the validity.
93 * @param env The environment of the current thread
95 * @return If the java host is valid the function returns true.
96 * Otherwise the function returns false.
98 jboolean jhost_is_valid(jobject jhost, JNIEnv * env);
100 * Class org_simgrid_msg_Host
104 JNIEXPORT void JNICALL
105 Java_org_simgrid_msg_Host_nativeInit(JNIEnv *env, jclass cls);
108 * Class org_simgrid_msg_Host
110 * Signature (Ljava/lang/String;)Lsimgrid/msg/Host;
112 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName
113 (JNIEnv *, jclass, jstring);
116 * This function start the host if it is off
118 * @param jhost The host to test the validity.
119 * @param env The environment of the current thread
122 JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_on(JNIEnv *env, jobject jhost);
125 * This function stop the host if it is on
127 * @param jhost The host to test the validity.
128 * @param env The environment of the current thread
131 JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_off(JNIEnv *env, jobject jhost);
134 * Class org_simgrid_msg_Host
136 * Signature ()Lsimgrid/msg/Host;
138 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost
141 * Class org_simgrid_msg_Host
145 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Host_getCount
149 * Class org_simgrid_msg_Host
153 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getSpeed
156 * Class org_simgrid_msg_Host
157 * Method getCoreNumber
160 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCoreNumber
163 * Class org_simgrid_msg_Host
167 JNIEXPORT jint JNICALL
168 Java_org_simgrid_msg_Host_getLoad(JNIEnv * env,
171 * Class org_simgrid_msg_Host
173 * Signature (Ljava/lang/String;)Ljava/lang/String;
175 JNIEXPORT jobject JNICALL
176 Java_org_simgrid_msg_Host_getProperty(JNIEnv *env, jobject jhost, jobject jname);
178 * Class org_simgrid_msg_Host
180 * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
182 JNIEXPORT void JNICALL
183 Java_org_simgrid_msg_Host_setProperty(JNIEnv *env, jobject jhost, jobject jname, jobject jvalue);
185 * Class org_simgrid_msg_Host
189 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Host_isAvail
193 * Class org_simgrid_msg_Host
196 JNIEXPORT jobjectArray JNICALL
197 Java_org_simgrid_msg_Host_all(JNIEnv *, jclass);
199 JNIEXPORT void JNICALL
200 Java_org_simgrid_msg_Host_setAsyncMailbox(JNIEnv * env, jclass cls_arg, jobject jname);
204 #endif /*!MSG_JHOST_H */