home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / COM / CustomMarshal / template / TemplateMarshaler.java < prev   
Encoding:
Java Source  |  2000-05-04  |  3.6 KB  |  97 lines

  1. // (C) Copyright 1995 - 1999 Microsoft Corporation.  All rights reserved.
  2. //=====================================================================
  3. //
  4. // This is a skeleton hook class that you can use as starting point for
  5. // your own hook class. Follow the TODO steps listed in the comments.
  6. // Note: You must perform step 1 in the TODO list below before this file will
  7. // compile.
  8. //
  9. //
  10. // TODO:
  11. //
  12. //    1. Replace all occurrences of the name JTYPE with a syntactically
  13. //       valid Java type (note: array types can be denoted as
  14. //       "elemtype[]", e.g. an array of integers is "int[]". This
  15. //       generates a function declaration that would be illegal in C but is
  16. //       legal in Java.)
  17. //
  18. //    2. Rename this file and change the class name ("TemplateMarshaler")
  19. //       to match.
  20. //
  21. //    3. Examine each commented method and field, and decide if this method
  22. //       is needed for your datatype. If so, uncomment.
  23. //
  24. //    4. For each method you uncomment in the hook class, you must provide
  25. //       an implementation for it in TemplateMarshaler.cpp.
  26. // 
  27. //=====================================================================
  28.  
  29. import com.ms.com.CustomLib;
  30.  
  31. public class TemplateMarshaler {
  32.  
  33.  
  34.     // TODO: If ETYPE is fixed-size, uncomment this line and replace
  35.     // the ellipses ("...") with sizeof(ETYPE) (in bytes).
  36.     // If ETYPE is variable-size, leave this line commented.
  37.     //public static int cbByValSize = ...;
  38.  
  39.  
  40.     // TODO: This field can normally be set to zero.
  41.     public static int CustomFlags = 0;
  42.  
  43.  
  44.     public static native JTYPE toJava(int ppETYPE, int flags);
  45.  
  46.     public static native void copyToExternal(JTYPE javaval,
  47.                                              int   ppETYPE,
  48.                                              int   flags);
  49.  
  50.  
  51.  
  52.     // TODO: If there is additional cleanup work associated with destroying an
  53.     // ETYPE, (e.g. releasing embedded resources), uncomment the following
  54.     // line.
  55.     //public static native void releaseByValExternal(int ppETYPE, int flags);
  56.  
  57.  
  58.  
  59.     // TODO: If the Java type is mutable and you want to support [out]
  60.     // parameters, uncomment the following lines.
  61.     //public static native void copyToJava(int ppETYPE,
  62.     //                                     JTYPE javaval,
  63.     //                                     int flags);
  64.     //public static native JType toUninitJava(int ppETYPE, int flags);
  65.  
  66.  
  67.     // TODO: If you want to allocate ETYPE objects in non-stack memory,
  68.     // uncomment the following lines:
  69.     //public static native void toExternal(JTYPE javaval,
  70.     //                                     int   flags,
  71.     //                                     int ppETYPE);
  72.     //public static native void releaseExternal(int ppETYPE,
  73.     //                                          int flags);
  74.  
  75.  
  76.     // TODO: If you want to allocate ETYPE objects in non-stack memory,
  77.     // and want to support [out] parameters, uncomment the following lines:
  78.     //public static native void toUninitExternal(JTYPE javaVal,
  79.     //                                           int   flags,
  80.     //                                           int   ppETYPE);
  81.  
  82.  
  83.  
  84.  
  85.     // FOR ADVANCED USERS ONLY: These members will rarely need to be
  86.     // overridden. They are listed here for completeness.
  87.     // public static int cbExternalSize;
  88.     // public static void relinquishJavaOwnership(JTYPE javaval, int flags);
  89.  
  90.  
  91.     // TODO: Replace the name "TemplateMarshaler" with the name of your
  92.     // DLL.
  93.     static {
  94.         System.loadLibrary("TemplateMarshaler");
  95.     }
  96. }
  97.