1 /* Functions related to the java host instances. */
3 /* Copyright (c) 2007-2015. 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. */
13 #include "simgrid/msg.h"
18 * This function returns a new java host instance.
20 * @param env The environment of the current thread
22 * @return A new java host object.
24 * @exception If the class Host is not found the function throws the ClassNotFoundException. If the constructor of
25 * this class is not found the function throws the exception NotSuchMethodException.
27 jobject jhost_new_instance(JNIEnv * env);
30 * This function returns a global reference to the java host instance specified by the parameter jhost.
32 * @param jhost The original java host instance.
33 * @param env The environment of the current thread
35 * @return The global reference to the original java host instance.
37 jobject jhost_ref(JNIEnv * env, jobject jhost);
40 * This function delete a global reference to a java host instance.
42 * @param The global refernce to delete.
43 * @param env The environment of the current thread
45 void jhost_unref(JNIEnv * env, jobject jhost);
48 * This function associated a native host to a java host instance.
50 * @param jhost The java host instance.
51 * @param host The native host to bind.
52 * @param env The environment of the current thread
54 * @exception If the class Host is not found the function throws the ClassNotFoundException. If the field bind of
55 * this class is not found the function throws the exception NotSuchFieldException.
57 void jhost_bind(jobject jhost, msg_host_t host, JNIEnv * env);
60 * This function returns a native host from a java host instance.
62 * @param jhost The java host object from which get the native host.
63 * @param env The environment of the current thread
65 * @return The function returns the native host associated to the java host object.
67 * @exception If the class Host is not found the function throws the ClassNotFoundException. If the field bind of
68 * this class is not found the function throws the exception NotSuchFieldException.
70 msg_host_t jhost_get_native(JNIEnv * env, jobject jhost);
73 * This function returns the name of a MSG host.
75 * @param jhost A java host object.
76 * @param env The environment of the current thread
78 * @return The name of the host.
80 const char *jhost_get_name(jobject jhost, JNIEnv * env);
83 * This function tests if a java host instance is valid.
84 * A java host object is valid if it is bind to a native host.
86 * @param jhost The host to test the validity.
87 * @param env The environment of the current thread
89 * @return If the java host is valid the function returns true. Otherwise the function returns false.
91 jboolean jhost_is_valid(jobject jhost, JNIEnv * env);
94 * Class org_simgrid_msg_Host
98 JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_nativeInit(JNIEnv *env, jclass cls);
101 * Class org_simgrid_msg_Host
103 * Signature (Ljava/lang/String;)Lsimgrid/msg/Host;
105 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName (JNIEnv *env, jclass cls, jstring jname);
108 * This function start the host if it is off
110 * @param jhost The host to test the validity.
111 * @param env The environment of the current thread
113 JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_on(JNIEnv *env, jobject jhost);
116 * This function stop the host if it is on
118 * @param jhost The host to test the validity.
119 * @param env The environment of the current thread
121 JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_off(JNIEnv *env, jobject jhost);
124 * Class org_simgrid_msg_Host
126 * Signature ()Lsimgrid/msg/Host;
128 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost (JNIEnv *env, jclass cls);
131 * Class org_simgrid_msg_Host
135 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Host_getCount (JNIEnv *env, jclass cls);
138 * Class org_simgrid_msg_Host
142 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getSpeed (JNIEnv *env, jobject jhost);
145 * Class org_simgrid_msg_Host
146 * Method getCoreNumber
149 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getCoreNumber (JNIEnv *env, jobject jhost);
152 * Class org_simgrid_msg_Host
154 * Signature (Ljava/lang/String;)Ljava/lang/String;
156 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getProperty(JNIEnv *env, jobject jhost, jobject jname);
159 * Class org_simgrid_msg_Host
161 * Signature (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
163 JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_setProperty(JNIEnv *env, jobject jhost, jobject jname, jobject jvalue);
166 * Class org_simgrid_msg_Host
170 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Host_isOn (JNIEnv *env, jobject jhost);
173 * Class org_simgrid_msg_Host
174 * Method getMountedStorage
175 * Signature: ()[Lorg/simgrid/msg/Storage;
177 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getMountedStorage(JNIEnv * env, jobject jhost);
180 * Class org_simgrid_msg_Host
181 * Method getAttachedStorageList
183 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getAttachedStorage(JNIEnv * env, jobject jhost);
186 * Class org_simgrid_msg_Host
187 * Method getStorageContent
189 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_getStorageContent(JNIEnv * env, jobject jhost);
192 * Class org_simgrid_msg_Host
195 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Host_all(JNIEnv *env, jclass cls);
197 JNIEXPORT void JNICALL Java_org_simgrid_msg_Host_setAsyncMailbox(JNIEnv * env, jclass cls_arg, jobject jname);
199 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getConsumedEnergy (JNIEnv *env, jobject jhost);
202 #endif /*!MSG_JHOST_H */