Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
rename TimeoutFailureException to TimeoutException
[simgrid.git] / src / java / jmsg_task.h
1 /*
2  * $Id$
3  *
4  * Copyright 2006,2007 Martin Quinson, Malek Cherier All right 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  * This contains the declarations of the functions in relation with the java
10  * task instance.
11  */
12
13 #ifndef MSG_JTASK_H
14 #define MSG_JTASK_H
15
16 #include <jni.h>
17 #include "msg/msg.h"
18
19 /**
20  * This function returns a global reference to the  java task instance 
21  * specified by the parameter jtask.
22  *
23  * @param jtask                 The original java task instance.
24  * @param env                   The environment of the current thread.
25  *
26  * @return                              The global reference to the original java task 
27  *                                              instance.
28  */
29 jobject jtask_new_global_ref(jobject jtask, JNIEnv * env);
30
31 /**
32  * This function delete a global reference to a java task instance.
33  *
34  * @param                               The global refernce to delete.
35  * @param env                   The environment of the current thread.
36  */
37 void jtask_delete_global_ref(jobject jtask, JNIEnv * env);
38
39 /**
40  * This function associated a native task to a java task instance.
41  *
42  * @param jtask                 The java task instance.
43  * @param task                  The native task to bind.
44  * @param env                   The environment of the current thread.
45  *
46  * @exception                   If the class Task is not found the function throws 
47  *                                              the ClassNotFoundException. If the field bind of 
48  *                                              this class is not found the function throws the exception 
49  *                                              NotSuchFieldException.  
50  */
51 void jtask_bind(jobject jtask, m_task_t task, JNIEnv * env);
52
53 /**
54  * This function returns a native task from a java task instance.
55  *
56  * @param jtask                 The java task object from which get the native task.
57  * @param env                   The environment of the current thread.
58  *
59  * @return                              The function returns the native task associated to the
60  *                                              java task object.
61  *
62  * @exception                   If the class Task is not found the function throws 
63  *                                              the ClassNotFoundException. If the field bind of 
64  *                                              this class is not found the function throws the exception 
65  *                                              NotSuchFieldException.  
66  */
67 m_task_t jtask_to_native_task(jobject jtask, JNIEnv * env);
68
69 /**
70  * This function tests if a java task instance is valid.
71  * A java task object is valid if it is bind to a native 
72  * task.
73  *
74  * @param jtask                 The java task to test the validity.
75  * @param env                   The environment of the current thread.
76  *
77  * @return                              If the java task is valid the function returns true.
78  *                                              Otherwise the function returns false.
79  */
80 jboolean jtask_is_valid(jobject jtask, JNIEnv * env);
81
82 #endif /* !MSG_JTASK_H */