Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
14f7fbc911d1c3c26e24eb6cc4f7ba30dda30c3d
[simgrid.git] / src / bindings / java / jmsg_storage.h
1 /* Functions related to the java storage API.                            */
2
3 /* Copyright (c) 2012-2015. 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_JSTORAGE_H
10 #define MSG_JSTORAGE_H
11 #include <jni.h>
12 #include "simgrid/msg.h"
13
14 SG_BEGIN_DECL()
15
16 /**
17  * This function returns a new java storage instance.
18  *
19  * @param env   The environment of the current thread
20  *
21  * @return      A new java storage object.
22  *
23  * @exception   If the class Storage is not found the function throws the ClassNotFoundException. If the constructor of
24  *              this class is not found the function throws the exception NotSuchMethodException.
25  */
26 jobject jstorage_new_instance(JNIEnv * env);
27
28 /**
29  * This function associated a native storage to a java storage instance.
30  *
31  * @param jstorage The java storage instance.
32  * @param storage  The native storage to bind.
33  * @param env      The environment of the current thread
34  *
35  * @exception      If the class Storage is not found the function throws the ClassNotFoundException. If the field bind
36  *                 of this class is not found the function throws the exception NotSuchFieldException.
37  */
38 void jstorage_bind(jobject jstorage, msg_storage_t storage, JNIEnv * env);
39
40 /**
41  * This function returns a native storage from a java storage instance.
42  *
43  * @param jstorage  The java storage object from which get the native storage.
44  * @param env       The environment of the current thread
45  *
46  * @return          The function returns the native storage associated to the java storage object.
47  *
48  * @exception       If the class Storage is not found the function throws the ClassNotFoundException. If the field bind
49  *                  of this class is not found the function throws the exception NotSuchFieldException.
50  */
51 msg_storage_t jstorage_get_native(JNIEnv * env, jobject jstorage);
52
53 /**
54  * Class      org_simgrid_msg_Storage
55  * Method      nativeInit
56  * Signature  ()V
57  */
58 JNIEXPORT void JNICALL Java_org_simgrid_msg_Storage_nativeInit(JNIEnv *env, jclass cls);
59
60 /**
61  * This function returns a global reference to the  java storage instance specified by the parameter jstorage.
62  *
63  * @param jstorage   The original java storage instance.
64  * @param env        The environment of the current thread
65  *
66  * @return           The global reference to the original java storage instance.
67  */
68 jobject jstorage_ref(JNIEnv * env, jobject jstorage);
69
70 /**
71  * This function delete a global reference to a java storage instance.
72  *
73  * @param        The global reference to delete.
74  * @param env      The environment of the current thread
75  */
76 void jstorage_unref(JNIEnv * env, jobject jstorage);
77
78 /**
79  * This function returns the name of a MSG storage.
80  *
81  * @param jstorage      A java storage object.
82  * @param env      The environment of the current thread
83  *
84  * @return        The name of the storage.
85  */
86 const char *jstorage_get_name(jobject jstorage, JNIEnv * env);
87
88 /*
89  * Class    org_simgrid_msg_Storage
90  * Method    getByName
91  * Signature  (Ljava/lang/String;)Lsimgrid/msg/Storage;
92  */
93 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getByName(JNIEnv *env, jclass cls, jstring jname);
94
95 /*
96  * Class    org_simgrid_msg_Storage
97  * Method    getSize
98  * Signature  ()D
99  */
100 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getSize(JNIEnv *env, jobject jstorage);
101
102 /*
103  * Class    org_simgrid_msg_Storage
104  * Method    getFreeSize
105  * Signature  ()D
106  */
107 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getFreeSize(JNIEnv *env, jobject jstorage);
108
109 /*
110  * Class    org_simgrid_msg_Storage
111  * Method    getUsedSize
112  * Signature  ()D
113  */
114 JNIEXPORT jlong JNICALL Java_org_simgrid_msg_Storage_getUsedSize(JNIEnv *env, jobject jstorage);
115
116 /*
117  * Class        org_simgrid_msg_Storage
118  * Method       getProperty
119  * Signature    (Ljava/lang/String;)Ljava/lang/String;
120  */
121 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getProperty(JNIEnv *env, jobject jstorage, jobject jname);
122
123 /*
124  * Class        org_simgrid_msg_Storage
125  * Method       setProperty
126  * Signature    (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
127  */
128 JNIEXPORT void JNICALL
129 Java_org_simgrid_msg_Storage_setProperty(JNIEnv *env, jobject jstorage, jobject jname, jobject jvalue);
130
131 /*
132  * Class        org_simgrid_msg_Storage
133  * Method       getHost
134  * Signature    (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
135  */
136 JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Storage_getHost(JNIEnv * env,jobject jstorage);
137
138 /**
139  * Class org_simgrid_msg_Storage
140  * Method all
141  */
142 JNIEXPORT jobjectArray JNICALL Java_org_simgrid_msg_Storage_all(JNIEnv *env, jclass cls);
143
144 SG_END_DECL()
145 #endif                          /*!MSG_JSTORAGE_H */