165 |
} \ |
} \ |
166 |
static void convert(JNIEnv *env, jint &in, type &out) { |
static void convert(JNIEnv *env, jint &in, type &out) { |
167 |
|
|
168 |
|
/* |
169 |
|
* Below, you see several different ways of converting |
170 |
|
* Java primitives and objects to C++ ones. |
171 |
|
* |
172 |
|
* Some important points: for most objects, we make a copy on the C++ |
173 |
|
* side which has to get deleted when the struct it is in is deleted |
174 |
|
* so we shall use types like vector<float> &c. |
175 |
|
* |
176 |
|
* However, there are several objects which we do not want to |
177 |
|
* copy but want references or pointers to, like DefaultTextRendered |
178 |
|
* or Vob::Paper::Paper. These have corresponding Java objects on |
179 |
|
* the Java side and are handled by integer ids to the objectstorer. |
180 |
|
* Say we have a Foo which uses a Bar. |
181 |
|
* The code will |
182 |
|
* 1) make the corresponding Foo *java* object contain a reference to the |
183 |
|
* Bar java object |
184 |
|
* 2) Pass the integer id of the Bar object for the objectstorer |
185 |
|
* 3) the id will be used (inside START_VOB_JNI_CONVERSION_IDDED below) |
186 |
|
* to get the object from the objectstorer. |
187 |
|
* Obviously, these must never be deleted. |
188 |
|
* |
189 |
|
* ByteVectors are intended for *large* arrays of data (screen |
190 |
|
* captures &c) so copies would be "not so nice", so we use idded objects |
191 |
|
* for them, too. |
192 |
|
*/ |
193 |
|
|
194 |
VOB_JNI_CONVERSION_ASSIGN(float, "float", jfloat) |
VOB_JNI_CONVERSION_ASSIGN(float, "float", jfloat) |
195 |
VOB_JNI_CONVERSION_ASSIGN(int, "int", jint) |
VOB_JNI_CONVERSION_ASSIGN(int, "int", jint) |