Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Replace, when possible, calls to bprintf() by calls to xbt_strdup().
[simgrid.git] / src / bindings / java / jmsg_host.h
1 /* Functions related to the java host instances.                            */
2
3 /* Copyright (c) 2007-2012. The SimGrid Team.
4  * All rights reserved.                                                     */
5
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. */
8
9 #ifndef MSG_JHOST_H
10 #define MSG_JHOST_H
11
12 #include <jni.h>
13 #include "msg/msg.h"
14
15 /**
16  * This function returns a new java host instance.
17  *
18  * @param env                   The environment of the current thread
19  *
20  * @return                              A new java host object.
21  *
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.
26  */
27 jobject jhost_new_instance(JNIEnv * env);
28
29 /**
30  * This function returns a global reference to the  java host instance 
31  * specified by the parameter jhost.
32  *
33  * @param jhost                 The original java host instance.
34  * @param env                   The environment of the current thread
35  *
36  * @return                              The global reference to the original java host 
37  *                                              instance.
38  */
39 jobject jhost_ref(JNIEnv * env, jobject jhost);
40 /**
41  * This function delete a global reference to a java host instance.
42  *
43  * @param                               The global refernce to delete.
44  * @param env                   The environment of the current thread
45  */
46 void jhost_unref(JNIEnv * env, jobject jhost);
47
48 /**
49  * This function associated a native host to a java host instance.
50  *
51  * @param jhost                 The java host instance.
52  * @param host                  The native host to bind.
53  * @param env                   The environment of the current thread
54  *
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.  
59  */
60 void jhost_bind(jobject jhost, msg_host_t host, JNIEnv * env);
61
62 /**
63  * This function returns a native host from a java host instance.
64  *
65  * @param jhost                 The java host object from which get the native host.
66  * @param env                   The environment of the current thread
67  *
68  * @return                              The function returns the native host associated to the
69  *                                              java host object.
70  *
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.  
75  */
76 msg_host_t jhost_get_native(JNIEnv * env, jobject jhost);
77
78 /**
79  * This function returns the name of a MSG host.
80  *
81  * @param jhost                 A java host object.
82  * @param env                   The environment of the current thread
83  *
84  * @return                              The name of the host.
85  */
86 const char *jhost_get_name(jobject jhost, JNIEnv * env);
87
88 /**
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.
91  *
92  * @param jhost                 The host to test the validity.
93  * @param env                   The environment of the current thread
94  *
95  * @return                              If the java host is valid the function returns true.
96  *                                              Otherwise the function returns false.
97  */
98 jboolean jhost_is_valid(jobject jhost, JNIEnv * env);
99 /*
100  * Class                org_simgrid_msg_Host
101  * Method               nativeInit
102  * Signature    ();
103  */
104 JNIEXPORT void JNICALL
105 Java_org_simgrid_msg_Host_nativeInit(JNIEnv *env, jclass cls);
106
107 /*
108  * Class                org_simgrid_msg_Host
109  * Method               getByName
110  * Signature    (Ljava/lang/String;)Lsimgrid/msg/Host;
111  */
112 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_getByName
113     (JNIEnv *, jclass, jstring);
114
115 /*
116  * Class                org_simgrid_msg_Host
117  * Method               currentHost
118  * Signature    ()Lsimgrid/msg/Host;
119  */
120 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Host_currentHost
121     (JNIEnv *, jclass);
122 /*
123  * Class                org_simgrid_msg_Host
124  * Method               getCount
125  * Signature    ()I
126  */
127 JNIEXPORT jint JNICALL Java_org_simgrid_msg_Host_getCount
128     (JNIEnv *, jclass);
129
130 /*
131  * Class                org_simgrid_msg_Host
132  * Method               getSpeed
133  * Signature    ()D
134  */
135 JNIEXPORT jdouble JNICALL Java_org_simgrid_msg_Host_getSpeed
136     (JNIEnv *, jobject);
137 /*
138  * Class                org_simgrid_msg_Host
139  * Method               getLoad
140  * Signature    ()I
141  */
142 JNIEXPORT jint JNICALL
143 Java_org_simgrid_msg_Host_getLoad(JNIEnv * env,
144                                        jobject jhost);
145 /*
146  * Class        org_simgrid_msg_Host
147  * Method       getProperty
148  * Signature    (Ljava/lang/String;)Ljava/lang/String;
149  */
150 JNIEXPORT jobject JNICALL
151 Java_org_simgrid_msg_Host_getProperty(JNIEnv *env, jobject jhost, jobject jname);
152 /*
153  * Class        org_simgrid_msg_Host
154  * Method       setProperty
155  * Signature    (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
156  */
157 JNIEXPORT void JNICALL
158 Java_org_simgrid_msg_Host_setProperty(JNIEnv *env, jobject jhost, jobject jname, jobject jvalue);
159 /*
160  * Class                org_simgrid_msg_Host
161  * Method               isAvail
162  * Signature    ()Z
163  */
164 JNIEXPORT jboolean JNICALL Java_org_simgrid_msg_Host_isAvail
165     (JNIEnv *, jobject);
166
167 /**
168  * Class org_simgrid_msg_Host
169  * Method all
170  */
171 JNIEXPORT jobjectArray JNICALL
172 Java_org_simgrid_msg_Host_all(JNIEnv *, jclass);
173
174 #endif                          /*!MSG_JHOST_H */