Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move some functions from MsgNative to Task, to make one less call
[simgrid.git] / src / jmsg_task.h
1 /* Functions related to the java task instances.                            */
2
3 /* Copyright (c) 2007, 2009, 2010. 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_JTASK_H
10 #define MSG_JTASK_H
11
12 #include <jni.h>
13 #include "msg/msg.h"
14
15 /**
16  * This function returns a global reference to the  java task instance 
17  * specified by the parameter jtask.
18  *
19  * @param jtask                 The original java task instance.
20  * @param env                   The environment of the current thread.
21  *
22  * @return                              The global reference to the original java task 
23  *                                              instance.
24  */
25 jobject jtask_new_global_ref(jobject jtask, JNIEnv * env);
26
27 /**
28  * This function delete a global reference to a java task instance.
29  *
30  * @param                               The global refernce to delete.
31  * @param env                   The environment of the current thread.
32  */
33 void jtask_delete_global_ref(jobject jtask, JNIEnv * env);
34
35 /**
36  * This function associated a native task to a java task instance.
37  *
38  * @param jtask                 The java task instance.
39  * @param task                  The native task to bind.
40  * @param env                   The environment of the current thread.
41  *
42  * @exception                   If the class Task is not found the function throws 
43  *                                              the ClassNotFoundException. If the field bind of 
44  *                                              this class is not found the function throws the exception 
45  *                                              NotSuchFieldException.  
46  */
47 void jtask_bind(jobject jtask, m_task_t task, JNIEnv * env);
48
49 /**
50  * This function returns a native task from a java task instance.
51  *
52  * @param jtask                 The java task object from which get the native task.
53  * @param env                   The environment of the current thread.
54  *
55  * @return                              The function returns the native task associated to the
56  *                                              java task object.
57  *
58  * @exception                   If the class Task is not found the function throws 
59  *                                              the ClassNotFoundException. If the field bind of 
60  *                                              this class is not found the function throws the exception 
61  *                                              NotSuchFieldException.  
62  */
63 m_task_t jtask_to_native_task(jobject jtask, JNIEnv * env);
64
65 /**
66  * This function tests if a java task instance is valid.
67  * A java task object is valid if it is bind to a native 
68  * task.
69  *
70  * @param jtask                 The java task to test the validity.
71  * @param env                   The environment of the current thread.
72  *
73  * @return                              If the java task is valid the function returns true.
74  *                                              Otherwise the function returns false.
75  */
76 jboolean jtask_is_valid(jobject jtask, JNIEnv * env);
77 /*
78  * Class                org_simgrid_msg_Task
79  * Method               create
80  */
81 JNIEXPORT void JNICALL
82 Java_org_simgrid_msg_Task_create
83                 (JNIEnv * env, jobject jtask, jstring jname, jdouble jcomputeDuration, jdouble jmessageSize);
84 /*
85  * Class                org_simgrid_msg_Task
86  * Method               parallelCreate
87  */
88 JNIEXPORT void JNICALL
89 Java_org_simgrid_msg_Task_parallelCreate
90                 (JNIEnv *, jobject,
91      jstring, jobjectArray,
92      jdoubleArray,
93      jdoubleArray);
94 /*
95  * Class                org_simgrid_msg_Task
96  * Method               destroy
97  * Signature    (Lsimgrid/msg/Task;)V
98  */
99 JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_destroy
100     (JNIEnv *, jobject);
101 /*
102  * Class                org_simgrid_msg_Task
103  * Method               getName
104  * Signature    ()Ljava/lang/String;
105  */
106 JNIEXPORT jstring JNICALL Java_org_simgrid_msg_Task_getName
107     (JNIEnv *, jobject);
108
109 /*
110  * Class                org_simgrid_msg_Task
111  * Method               nativeInit
112  * Signature    ();
113  */
114 JNIEXPORT void JNICALL
115 Java_org_simgrid_msg_Task_nativeInit(JNIEnv *env, jclass cls);
116 /**
117  * Class                org_simgrid_msg_Task
118  * Method               irecv
119  * Signature    (Ljava/lang/String;)Lorg/simgrid/msg/Comm;
120  */
121 JNIEXPORT jobject JNICALL
122 Java_org_simgrid_msg_Task_irecv(JNIEnv * env, jclass cls, jstring jmailbox);
123 /**
124  * Class                org_simgrid_msg_Task
125  * Method               isend
126  * Signature    (Lorg/simgrid/msg/Task;Ljava/lang/String;)Lorg/simgrid/msg/Comm;
127  */
128 JNIEXPORT jobject JNICALL
129 Java_org_simgrid_msg_Task_isend(JNIEnv *env, jobject jtask, jstring jmailbox);
130
131 #endif                          /* !MSG_JTASK_H */