FACT++  1.0
JNIEXPORT void JNICALL Java_dim_ObjectDescriptor_copyFromObject ( JNIEnv *  env,
jclass  nativeClass,
jlong  nativeDataAddress,
jobject  theObject,
jlong  desc 
)

Definition at line 2620 of file dim_jni.c.

References DBGe, dim_Dbg_DESCRIPTORS, objectDescriptor_struct::entries, objectDescriptor_struct::entry, f_boolean, f_byte, f_char, f_double, f_float, f_int, f_long, f_short, objectDescriptorEntry_struct::fieldID, i, objectDescriptor_struct::objectClass, objectDescriptorEntry_struct::offset, and objectDescriptorEntry_struct::type.

Referenced by Java_dim_ObjectDescriptor_copyIntoObject().

2621 {
2622  int i;
2624 
2625  objectDescriptor_type* descriptor = (objectDescriptor_type*) desc;
2626  jclass objectClass = descriptor->objectClass;
2627 
2628  DBGe(dim_Dbg_DESCRIPTORS) printf("DimJNI: Native.copyFromObject %08x\n", (int)desc);
2629 
2630  if(nativeClass){}
2631  // test if object can be cast to object class
2632  if((*env)->IsInstanceOf(env, theObject, objectClass) != JNI_TRUE)
2633  {
2634  // throw exception
2635  jclass exceptionClass = (*env)->FindClass(env, "java/lang/IllegalArgumentException");
2636  (*env)->ThrowNew(env, exceptionClass, " (Sorry...)");
2637  return;
2638  }
2639 
2640  // loop over descriptor entries
2641  entry = descriptor->entry;
2642  for (i=0; i<descriptor->entries; i++)
2643  {
2644  switch (entry->type)
2645  {
2646  case f_boolean:
2647  *(jboolean*) (nativeDataAddress+entry->offset) = (*env)->GetBooleanField(env, theObject, entry->fieldID);
2648  break;
2649  case f_byte:
2650  *(jbyte*) (nativeDataAddress+entry->offset) = (*env)->GetByteField(env, theObject, entry->fieldID);
2651  break;
2652  case f_char:
2653  *(jchar*) (nativeDataAddress+entry->offset) = (*env)->GetCharField(env, theObject, entry->fieldID);
2654  break;
2655  case f_short:
2656  *(jshort*) (nativeDataAddress+entry->offset) = (*env)->GetShortField(env, theObject, entry->fieldID);
2657  break;
2658  case f_int:
2659  *(jint*) (nativeDataAddress+entry->offset) = (*env)->GetIntField(env, theObject, entry->fieldID);
2660  break;
2661  case f_long:
2662  *(jlong*) (nativeDataAddress+entry->offset) = (*env)->GetLongField(env, theObject, entry->fieldID);
2663  break;
2664  case f_float:
2665  *(jfloat*) (nativeDataAddress+entry->offset) = (*env)->GetFloatField(env, theObject, entry->fieldID);
2666  break;
2667  case f_double:
2668  *(jdouble*) (nativeDataAddress+entry->offset) = (*env)->GetDoubleField(env, theObject, entry->fieldID);
2669  break;
2670 // case a_boolean:
2671 // (*env)->GetBooleanArrayRegion(env, array, 0, length, (void*) nativeDataAddress);
2672 // break;
2673 // case c_boolean:
2674 // *(jbyte*) (nativeDataAddress+entry->offset) = (*env)->GetField(env, theObject, entry->fieldID);
2675 // (*env)->SetBooleanArrayRegion(env, entry->array, entry->arrayOffset, entry->length, (void*) (nativeDataAddress+entry->offset));
2676 // //TODO :: complete this list, including recursive call to this function for objects
2677 // break;
2678  default:
2679  break;
2680  }
2681  //TODO :: ?? if ((*env)->ExceptionOccurred(env)) (*env)->ExceptionDescribe(env); // clear any possible exception, if we do not do this, all further methods will fail!!
2682  entry++;
2683  }
2684  return;
2685 }
#define dim_Dbg_DESCRIPTORS
Definition: dim_jni.h:60
int i
Definition: db_dim_client.c:21
#define DBGe(test)
Definition: dim_jni.c:64
if(extraDns) new Dns
objectDescriptorEntry_type * entry
Definition: dim_jni.c:2372

+ Here is the caller graph for this function: