Changeset 4760


Ignore:
Timestamp:
01/29/09 16:35:21 (11 years ago)
Author:
curtis
Message:

Progress on Bio-Formats Jace C++ wrapper.

Location:
trunk/components/bio-formats-jace
Files:
9 added
1 deleted
46 edited

Legend:

Unmodified
Added
Removed
  • trunk/components/bio-formats-jace/CMakeLists.txt

    r4701 r4760  
    1111### determine configuration ### 
    1212 
    13 message("Configuration:") 
     13find_package(JNI) 
    1414 
    15 #find_package(Java) 
    16 #message("  java          : ${JAVA_RUNTIME}") 
    17 #message("  javac         : ${JAVA_COMPILE}") 
    18 #message("  jar           : ${JAVA_ARCHIVE}") 
    19  
    20 find_package(JNI) 
    21 message("  jawt lib      : ${JAVA_AWT_LIBRARY}") 
    22 message("  jvm lib       : ${JAVA_JVM_LIBRARY}") 
    23 message("  jni.h         : ${JAVA_INCLUDE_PATH}") 
    24 message("  jni_md.h      : ${JAVA_INCLUDE_PATH2}") 
    25 message("  jawt.h        : ${JAVA_AWT_INCLUDE_PATH}") 
     15set(Boost_USE_STATIC_LIBS OFF) 
     16set(Boost_USE_MULTITHREAD ON) 
     17find_package(Boost COMPONENTS thread) 
    2618 
    2719include_directories(jace/include proxies/include 
    28   ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) 
     20  ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${Boost_INCLUDE_DIR}) 
    2921 
    3022### build Jace C++ library ### 
     
    3426### build Bio-Formats Jace C++ bindings (bfjace) ### 
    3527 
     28message("-- Bio-Formats Jace source files:") 
    3629file(GLOB_RECURSE BFJACE_SRC proxies/source/*.cpp) 
    3730message("  bfjace source : ${BFJACE_SRC}") 
     31 
     32message("") 
    3833 
    3934add_library(bfjace SHARED ${BFJACE_SRC}) 
    4035 
    4136set_target_properties(bfjace PROPERTIES 
    42   COMPILE_FLAGS "-Wall -fpermissive" 
    43   LINK_FLAGS "-mthread") 
     37  COMPILE_FLAGS "-pthread -Wall -fpermissive" 
     38  LINK_FLAGS "-pthread") 
    4439 
    4540target_link_libraries(bfjace jace) 
     
    4944add_executable(showinf source/showinf.cpp) 
    5045 
    51 target_link_libraries(showinf bfjace jace ${JAVA_JVM_LIBRARY}) 
     46target_link_libraries(showinf bfjace jace 
     47  ${JAVA_JVM_LIBRARY} ${Boost_LIBRARIES}) 
    5248 
    5349### TEMP - build some Jace examples for testing ### 
    5450 
    5551add_executable(example1 source/example1.cpp) 
    56 target_link_libraries(example1 bfjace jace ${JAVA_JVM_LIBRARY}) 
     52 
     53target_link_libraries(example1 bfjace jace 
     54  ${JAVA_JVM_LIBRARY} ${Boost_LIBRARIES}) 
    5755 
    5856add_executable(array_example source/array_example.cpp) 
    59 target_link_libraries(array_example bfjace jace ${JAVA_JVM_LIBRARY}) 
     57 
     58target_link_libraries(array_example bfjace jace 
     59  ${JAVA_JVM_LIBRARY} ${Boost_LIBRARIES}) 
  • trunk/components/bio-formats-jace/build.xml

    r4704 r4760  
    3838    description="generate Jace proxies from C++ source code"> 
    3939    <delete dir="proxies"/> 
     40    <mkdir dir="proxies/include"/> 
     41    <mkdir dir="proxies/source"/> 
    4042    <java classname="jace.autoproxy.AutoProxy"> 
    4143      <arg path="include"/> 
  • trunk/components/bio-formats-jace/jace/CMakeLists.txt

    r4701 r4760  
    1010project(jace) 
    1111 
     12#message("") 
     13 
     14#find_package(Java) 
     15#message("-- Java Runtime:") 
     16#message("java             : ${JAVA_RUNTIME}") 
     17#message("javac            : ${JAVA_COMPILE}") 
     18#message("jar              : ${JAVA_ARCHIVE}") 
     19 
     20message("") 
     21 
    1222find_package(JNI) 
     23message("-- Java Native Interface:") 
     24message("jawt lib         : ${JAVA_AWT_LIBRARY}") 
     25message("jvm lib          : ${JAVA_JVM_LIBRARY}") 
     26message("jni.h            : ${JAVA_INCLUDE_PATH}") 
     27message("jni_md.h         : ${JAVA_INCLUDE_PATH2}") 
     28message("jawt.h           : ${JAVA_AWT_INCLUDE_PATH}") 
     29 
     30message("") 
     31 
     32set(Boost_USE_STATIC_LIBS OFF) 
     33set(Boost_USE_MULTITHREAD ON) 
     34find_package(Boost COMPONENTS thread) 
     35message("-- Boost:") 
     36message("boost/thread.hpp : ${Boost_INCLUDE_DIR}") 
     37message("boost libs       : ${Boost_LIBRARIES}") 
     38 
     39message("") 
    1340 
    1441file(GLOB_RECURSE JACE_SRC source/*.cpp) 
    15 message("  jace source   : ${JACE_SRC}") 
     42message("-- Jace source files:") 
     43message("jace source      : ${JACE_SRC}") 
    1644 
    17 include_directories(include ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}) 
     45message("") 
     46 
     47include_directories(include 
     48  ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${Boost_INCLUDE_DIR}) 
    1849 
    1950add_library(jace SHARED ${JACE_SRC}) 
    2051 
    2152set_target_properties(jace PROPERTIES 
    22   COMPILE_FLAGS "-Wall -fpermissive" 
    23   LINK_FLAGS "-mthread") 
     53  COMPILE_FLAGS "-pthread -Wall -fpermissive" 
     54  LINK_FLAGS "-pthread") 
  • trunk/components/bio-formats-jace/jace/include/jace/ElementProxy.h

    r4696 r4760  
    7070 * 
    7171 */ 
    72 template <class ElementType> class ElementProxy : public ElementType, public virtual ::jace::proxy::JObject { 
     72template <class ElementType> class ElementProxy : public virtual ::jace::proxy::JObject, public ElementType { 
    7373 
    7474 
     
    133133    ::jace::helper::deleteGlobalRef( env, parent ); 
    134134  } 
    135   catch ( std::exception& e ) { 
    136     #ifdef JACE_UNUSED_LOCAL_VAR 
    137       e; // shut up the compiler warning 
     135  catch ( JNIException& ) { 
    138136      // It's possible that we're trying to attach when 
    139137      // the JVM has already been destroyed 
    140     #endif 
    141138  } 
    142139} 
  • trunk/components/bio-formats-jace/jace/include/jace/ElementProxy.tsp

    r4696 r4760  
    1010 
    1111template <> 
    12 ElementProxy< ::jace::proxy::types::JBoolean>::ElementProxy( jarray array, jvalue element, int index ); 
     12JACE_API ElementProxy< ::jace::proxy::types::JBoolean>::ElementProxy( jarray array, jvalue element, int index ); 
    1313 
    1414template <> 
    15 ::jace::proxy::types::JBoolean& ElementProxy< ::jace::proxy::types::JBoolean>::operator=( const ::jace::proxy::types::JBoolean& type ); 
     15JACE_API ::jace::proxy::types::JBoolean& ElementProxy< ::jace::proxy::types::JBoolean>::operator=( const ::jace::proxy::types::JBoolean& type ); 
    1616 
    1717template <> 
    18 ElementProxy< ::jace::proxy::types::JByte>::ElementProxy( jarray array, jvalue element, int index ); 
     18JACE_API ElementProxy< ::jace::proxy::types::JByte>::ElementProxy( jarray array, jvalue element, int index ); 
    1919 
    2020template <> 
    21 ::jace::proxy::types::JByte& ElementProxy< ::jace::proxy::types::JByte>::operator=( const ::jace::proxy::types::JByte& type ); 
     21JACE_API ::jace::proxy::types::JByte& ElementProxy< ::jace::proxy::types::JByte>::operator=( const ::jace::proxy::types::JByte& type ); 
    2222 
    2323template <> 
    24 ElementProxy< ::jace::proxy::types::JChar>::ElementProxy( jarray array, jvalue element, int index ); 
     24JACE_API ElementProxy< ::jace::proxy::types::JChar>::ElementProxy( jarray array, jvalue element, int index ); 
    2525 
    2626template <> 
    27 ::jace::proxy::types::JChar& ElementProxy< ::jace::proxy::types::JChar>::operator=( const ::jace::proxy::types::JChar& type ); 
     27JACE_API ::jace::proxy::types::JChar& ElementProxy< ::jace::proxy::types::JChar>::operator=( const ::jace::proxy::types::JChar& type ); 
    2828 
    2929template <> 
    30 ElementProxy< ::jace::proxy::types::JDouble>::ElementProxy( jarray array, jvalue element, int index ); 
     30JACE_API ElementProxy< ::jace::proxy::types::JDouble>::ElementProxy( jarray array, jvalue element, int index ); 
    3131 
    3232template <> 
    33 ::jace::proxy::types::JDouble& ElementProxy< ::jace::proxy::types::JDouble>::operator=( const ::jace::proxy::types::JDouble& type ); 
     33JACE_API ::jace::proxy::types::JDouble& ElementProxy< ::jace::proxy::types::JDouble>::operator=( const ::jace::proxy::types::JDouble& type ); 
    3434 
    3535template <> 
    36 ElementProxy< ::jace::proxy::types::JFloat>::ElementProxy( jarray array, jvalue element, int index ); 
     36JACE_API ElementProxy< ::jace::proxy::types::JFloat>::ElementProxy( jarray array, jvalue element, int index ); 
    3737 
    3838template <> 
    39 ::jace::proxy::types::JFloat& ElementProxy< ::jace::proxy::types::JFloat>::operator=( const ::jace::proxy::types::JFloat& type ); 
     39JACE_API ::jace::proxy::types::JFloat& ElementProxy< ::jace::proxy::types::JFloat>::operator=( const ::jace::proxy::types::JFloat& type ); 
    4040 
    4141template <> 
    42 ElementProxy< ::jace::proxy::types::JInt>::ElementProxy( jarray array, jvalue element, int index ); 
     42JACE_API ElementProxy< ::jace::proxy::types::JInt>::ElementProxy( jarray array, jvalue element, int index ); 
    4343 
    4444template <> 
    45 ::jace::proxy::types::JInt& ElementProxy< ::jace::proxy::types::JInt>::operator=( const ::jace::proxy::types::JInt& type ); 
     45JACE_API ::jace::proxy::types::JInt& ElementProxy< ::jace::proxy::types::JInt>::operator=( const ::jace::proxy::types::JInt& type ); 
    4646 
    4747template <> 
    48 ElementProxy< ::jace::proxy::types::JLong>::ElementProxy( jarray array, jvalue element, int index ); 
     48JACE_API ElementProxy< ::jace::proxy::types::JLong>::ElementProxy( jarray array, jvalue element, int index ); 
    4949 
    5050template <> 
    51 ::jace::proxy::types::JLong& ElementProxy< ::jace::proxy::types::JLong>::operator=( const ::jace::proxy::types::JLong& type ); 
     51JACE_API ::jace::proxy::types::JLong& ElementProxy< ::jace::proxy::types::JLong>::operator=( const ::jace::proxy::types::JLong& type ); 
    5252 
    5353template <> 
    54 ElementProxy< ::jace::proxy::types::JShort>::ElementProxy( jarray array, jvalue element, int index ); 
     54JACE_API ElementProxy< ::jace::proxy::types::JShort>::ElementProxy( jarray array, jvalue element, int index ); 
    5555 
    5656template <> 
    57 ::jace::proxy::types::JShort& ElementProxy< ::jace::proxy::types::JShort>::operator=( const ::jace::proxy::types::JShort& type ); 
     57JACE_API ::jace::proxy::types::JShort& ElementProxy< ::jace::proxy::types::JShort>::operator=( const ::jace::proxy::types::JShort& type ); 
    5858 
    5959END_NAMESPACE( jace ) 
  • trunk/components/bio-formats-jace/jace/include/jace/JArray.h

    r4696 r4760  
    544544} 
    545545 
     546protected: 
     547 
     548/** 
     549 * Creates a new JArray that does not yet refer 
     550 * to any java array. 
     551 * 
     552 * This constructor is provided for subclasses which 
     553 * need to do their own initialization. 
     554 * 
     555 * @param noOp - A dummy argument that signifies that 
     556 * this constructor should not do any work. 
     557 * 
     558 * All subclasses of JArray should provide this constructor 
     559 * for their own subclasses. 
     560 */ 
     561JACE_API JArray( const NoOp& noOp ); 
     562 
    546563private: 
    547564 
  • trunk/components/bio-formats-jace/jace/include/jace/JArray.tsp

    r4696 r4760  
    1010 
    1111template <> 
    12 JArray< ::jace::proxy::types::JBoolean>::JArray( int size ); 
     12JACE_API JArray< ::jace::proxy::types::JBoolean>::JArray( int size ); 
    1313 
    1414template <> 
    15 ElementProxy< ::jace::proxy::types::JBoolean> JArray< ::jace::proxy::types::JBoolean>::operator[]( const int& index ); 
     15JACE_API ElementProxy< ::jace::proxy::types::JBoolean> JArray< ::jace::proxy::types::JBoolean>::operator[]( const int& index ); 
    1616 
    1717template <> 
    18 const ElementProxy< ::jace::proxy::types::JBoolean> JArray< ::jace::proxy::types::JBoolean>::operator[]( const int& index ) const; 
     18JACE_API const ElementProxy< ::jace::proxy::types::JBoolean> JArray< ::jace::proxy::types::JBoolean>::operator[]( const int& index ) const; 
    1919 
    2020template <> 
    21 JArray< ::jace::proxy::types::JByte>::JArray( int size ); 
     21JACE_API JArray< ::jace::proxy::types::JByte>::JArray( int size ); 
    2222 
    2323template <> 
    24 ElementProxy< ::jace::proxy::types::JByte> JArray< ::jace::proxy::types::JByte>::operator[]( const int& index ); 
     24JACE_API ElementProxy< ::jace::proxy::types::JByte> JArray< ::jace::proxy::types::JByte>::operator[]( const int& index ); 
    2525 
    2626template <> 
    27 const ElementProxy< ::jace::proxy::types::JByte> JArray< ::jace::proxy::types::JByte>::operator[]( const int& index ) const; 
     27JACE_API const ElementProxy< ::jace::proxy::types::JByte> JArray< ::jace::proxy::types::JByte>::operator[]( const int& index ) const; 
    2828 
    2929template <> 
    30 JArray< ::jace::proxy::types::JChar>::JArray( int size ); 
     30JACE_API JArray< ::jace::proxy::types::JChar>::JArray( int size ); 
    3131 
    3232template <> 
    33 ElementProxy< ::jace::proxy::types::JChar> JArray< ::jace::proxy::types::JChar>::operator[]( const int& index ); 
     33JACE_API ElementProxy< ::jace::proxy::types::JChar> JArray< ::jace::proxy::types::JChar>::operator[]( const int& index ); 
    3434 
    3535template <> 
    36 const ElementProxy< ::jace::proxy::types::JChar> JArray< ::jace::proxy::types::JChar>::operator[]( const int& index ) const; 
     36JACE_API const ElementProxy< ::jace::proxy::types::JChar> JArray< ::jace::proxy::types::JChar>::operator[]( const int& index ) const; 
    3737 
    3838template <> 
    39 JArray< ::jace::proxy::types::JDouble>::JArray( int size ); 
     39JACE_API JArray< ::jace::proxy::types::JDouble>::JArray( int size ); 
    4040 
    4141template <> 
    42 ElementProxy< ::jace::proxy::types::JDouble> JArray< ::jace::proxy::types::JDouble>::operator[]( const int& index ); 
     42JACE_API ElementProxy< ::jace::proxy::types::JDouble> JArray< ::jace::proxy::types::JDouble>::operator[]( const int& index ); 
    4343 
    4444template <> 
    45 const ElementProxy< ::jace::proxy::types::JDouble> JArray< ::jace::proxy::types::JDouble>::operator[]( const int& index ) const; 
     45JACE_API const ElementProxy< ::jace::proxy::types::JDouble> JArray< ::jace::proxy::types::JDouble>::operator[]( const int& index ) const; 
    4646 
    4747template <> 
    48 JArray< ::jace::proxy::types::JFloat>::JArray( int size ); 
     48JACE_API JArray< ::jace::proxy::types::JFloat>::JArray( int size ); 
    4949 
    5050template <> 
    51 ElementProxy< ::jace::proxy::types::JFloat> JArray< ::jace::proxy::types::JFloat>::operator[]( const int& index ); 
     51JACE_API ElementProxy< ::jace::proxy::types::JFloat> JArray< ::jace::proxy::types::JFloat>::operator[]( const int& index ); 
    5252 
    5353template <> 
    54 const ElementProxy< ::jace::proxy::types::JFloat> JArray< ::jace::proxy::types::JFloat>::operator[]( const int& index ) const; 
     54JACE_API const ElementProxy< ::jace::proxy::types::JFloat> JArray< ::jace::proxy::types::JFloat>::operator[]( const int& index ) const; 
    5555 
    5656template <> 
    57 JArray< ::jace::proxy::types::JInt>::JArray( int size ); 
     57JACE_API JArray< ::jace::proxy::types::JInt>::JArray( int size ); 
    5858 
    5959template <> 
    60 ElementProxy< ::jace::proxy::types::JInt> JArray< ::jace::proxy::types::JInt>::operator[]( const int& index ); 
     60JACE_API ElementProxy< ::jace::proxy::types::JInt> JArray< ::jace::proxy::types::JInt>::operator[]( const int& index ); 
    6161 
    6262template <> 
    63 const ElementProxy< ::jace::proxy::types::JInt> JArray< ::jace::proxy::types::JInt>::operator[]( const int& index ) const; 
     63JACE_API const ElementProxy< ::jace::proxy::types::JInt> JArray< ::jace::proxy::types::JInt>::operator[]( const int& index ) const; 
    6464 
    6565template <> 
    66 JArray< ::jace::proxy::types::JLong>::JArray( int size ); 
     66JACE_API JArray< ::jace::proxy::types::JLong>::JArray( int size ); 
    6767 
    6868template <> 
    69 ElementProxy< ::jace::proxy::types::JLong> JArray< ::jace::proxy::types::JLong>::operator[]( const int& index ); 
     69JACE_API ElementProxy< ::jace::proxy::types::JLong> JArray< ::jace::proxy::types::JLong>::operator[]( const int& index ); 
    7070 
    7171template <> 
    72 const ElementProxy< ::jace::proxy::types::JLong> JArray< ::jace::proxy::types::JLong>::operator[]( const int& index ) const; 
     72JACE_API const ElementProxy< ::jace::proxy::types::JLong> JArray< ::jace::proxy::types::JLong>::operator[]( const int& index ) const; 
    7373 
    7474template <> 
    75 JArray< ::jace::proxy::types::JShort>::JArray( int size ); 
     75JACE_API JArray< ::jace::proxy::types::JShort>::JArray( int size ); 
    7676 
    7777template <> 
    78 ElementProxy< ::jace::proxy::types::JShort> JArray< ::jace::proxy::types::JShort>::operator[]( const int& index ); 
     78JACE_API ElementProxy< ::jace::proxy::types::JShort> JArray< ::jace::proxy::types::JShort>::operator[]( const int& index ); 
    7979 
    8080template <> 
    81 const ElementProxy< ::jace::proxy::types::JShort> JArray< ::jace::proxy::types::JShort>::operator[]( const int& index ) const; 
     81JACE_API const ElementProxy< ::jace::proxy::types::JShort> JArray< ::jace::proxy::types::JShort>::operator[]( const int& index ) const; 
    8282 
    8383END_NAMESPACE( jace ) 
  • trunk/components/bio-formats-jace/jace/include/jace/JClassImpl.h

    r4696 r4760  
    5151 * 
    5252 */ 
    53 // JClassImpl( const std::string& name, const std::string& nameAsType ); 
    5453JACE_API JClassImpl( const std::string name, const std::string nameAsType ); 
    5554 
  • trunk/components/bio-formats-jace/jace/include/jace/JFactory.h

    r4696 r4760  
    4949 */ 
    5050#if 0 
    51   virtual auto_ptr<JValue> create( jvalue val ) = 0; 
     51  JACE_API virtual auto_ptr<JValue> create( jvalue val ) = 0; 
    5252#endif 
    5353 
  • trunk/components/bio-formats-jace/jace/include/jace/JField.tsp

    r4696 r4760  
    1010 
    1111template <> 
    12 JFieldProxy< ::jace::proxy::types::JBoolean> JField< ::jace::proxy::types::JBoolean>::get( jace::proxy::JObject& object ); 
     12JACE_API JFieldProxy< ::jace::proxy::types::JBoolean> JField< ::jace::proxy::types::JBoolean>::get( jace::proxy::JObject& object ); 
    1313 
    1414template <> 
    15 JFieldProxy< ::jace::proxy::types::JBoolean> JField< ::jace::proxy::types::JBoolean>::get( const JClass* jClass ); 
     15JACE_API JFieldProxy< ::jace::proxy::types::JBoolean> JField< ::jace::proxy::types::JBoolean>::get( const JClass* jClass ); 
    1616 
    1717template <> 
    18 JFieldProxy< ::jace::proxy::types::JByte> JField< ::jace::proxy::types::JByte>::get( jace::proxy::JObject& object ); 
     18JACE_API JFieldProxy< ::jace::proxy::types::JByte> JField< ::jace::proxy::types::JByte>::get( jace::proxy::JObject& object ); 
    1919 
    2020template <> 
    21 JFieldProxy< ::jace::proxy::types::JByte> JField< ::jace::proxy::types::JByte>::get( const JClass* jClass ); 
     21JACE_API JFieldProxy< ::jace::proxy::types::JByte> JField< ::jace::proxy::types::JByte>::get( const JClass* jClass ); 
    2222 
    2323template <> 
    24 JFieldProxy< ::jace::proxy::types::JChar> JField< ::jace::proxy::types::JChar>::get( jace::proxy::JObject& object ); 
     24JACE_API JFieldProxy< ::jace::proxy::types::JChar> JField< ::jace::proxy::types::JChar>::get( jace::proxy::JObject& object ); 
    2525 
    2626template <> 
    27 JFieldProxy< ::jace::proxy::types::JChar> JField< ::jace::proxy::types::JChar>::get( const JClass* jClass ); 
     27JACE_API JFieldProxy< ::jace::proxy::types::JChar> JField< ::jace::proxy::types::JChar>::get( const JClass* jClass ); 
    2828 
    2929template <> 
    30 JFieldProxy< ::jace::proxy::types::JShort> JField< ::jace::proxy::types::JShort>::get( jace::proxy::JObject& object ); 
     30JACE_API JFieldProxy< ::jace::proxy::types::JShort> JField< ::jace::proxy::types::JShort>::get( jace::proxy::JObject& object ); 
    3131 
    3232template <> 
    33 JFieldProxy< ::jace::proxy::types::JShort> JField< ::jace::proxy::types::JShort>::get( const JClass* jClass ); 
     33JACE_API JFieldProxy< ::jace::proxy::types::JShort> JField< ::jace::proxy::types::JShort>::get( const JClass* jClass ); 
    3434 
    3535template <> 
    36 JFieldProxy< ::jace::proxy::types::JInt> JField< ::jace::proxy::types::JInt>::get( jace::proxy::JObject& object ); 
     36JACE_API JFieldProxy< ::jace::proxy::types::JInt> JField< ::jace::proxy::types::JInt>::get( jace::proxy::JObject& object ); 
    3737 
    3838template <> 
    39 JFieldProxy< ::jace::proxy::types::JInt> JField< ::jace::proxy::types::JInt>::get( const JClass* jClass ); 
     39JACE_API JFieldProxy< ::jace::proxy::types::JInt> JField< ::jace::proxy::types::JInt>::get( const JClass* jClass ); 
    4040 
    4141template <> 
    42 JFieldProxy< ::jace::proxy::types::JLong> JField< ::jace::proxy::types::JLong>::get( jace::proxy::JObject& object ); 
     42JACE_API JFieldProxy< ::jace::proxy::types::JLong> JField< ::jace::proxy::types::JLong>::get( jace::proxy::JObject& object ); 
    4343 
    4444template <> 
    45 JFieldProxy< ::jace::proxy::types::JLong> JField< ::jace::proxy::types::JLong>::get( const JClass* jClass ); 
     45JACE_API JFieldProxy< ::jace::proxy::types::JLong> JField< ::jace::proxy::types::JLong>::get( const JClass* jClass ); 
    4646 
    4747template <> 
    48 JFieldProxy< ::jace::proxy::types::JFloat> JField< ::jace::proxy::types::JFloat>::get( jace::proxy::JObject& object ); 
     48JACE_API JFieldProxy< ::jace::proxy::types::JFloat> JField< ::jace::proxy::types::JFloat>::get( jace::proxy::JObject& object ); 
    4949 
    5050template <> 
    51 JFieldProxy< ::jace::proxy::types::JFloat> JField< ::jace::proxy::types::JFloat>::get( const JClass* jClass ); 
     51JACE_API JFieldProxy< ::jace::proxy::types::JFloat> JField< ::jace::proxy::types::JFloat>::get( const JClass* jClass ); 
    5252 
    5353template <> 
    54 JFieldProxy< ::jace::proxy::types::JDouble> JField< ::jace::proxy::types::JDouble>::get( jace::proxy::JObject& object ); 
     54JACE_API JFieldProxy< ::jace::proxy::types::JDouble> JField< ::jace::proxy::types::JDouble>::get( jace::proxy::JObject& object ); 
    5555 
    5656template <> 
    57 JFieldProxy< ::jace::proxy::types::JDouble> JField< ::jace::proxy::types::JDouble>::get( const JClass* jClass ); 
     57JACE_API JFieldProxy< ::jace::proxy::types::JDouble> JField< ::jace::proxy::types::JDouble>::get( const JClass* jClass ); 
    5858 
    5959END_NAMESPACE( jace ) 
  • trunk/components/bio-formats-jace/jace/include/jace/JFieldHelper.h

    r4696 r4760  
    3737 
    3838  private: 
     39        /** 
     40         * Prevent copying. 
     41         */ 
     42        JFieldHelper& operator=(JFieldHelper&); 
    3943 
    4044  jfieldID mFieldID; 
  • trunk/components/bio-formats-jace/jace/include/jace/JFieldProxy.h

    r4696 r4760  
    1313#ifndef JACE_JNI_HELPER_H 
    1414#include "jace/JNIHelper.h" 
    15 #endif 
    16  
    17 #ifndef JACE_JOBJECT_H 
    18 #include "jace/proxy/JObject.h" 
    1915#endif 
    2016 
     
    9389 */ 
    9490JFieldProxy( jfieldID fieldID_, jvalue value, jobject parent_ ) : 
    95   FieldType( value ), FieldType::JObject( FieldType::JObject::NO_OP ), fieldID( fieldID_ ) { 
     91  FieldType( value ), fieldID( fieldID_ ) { 
    9692 
    9793  JNIEnv* env = ::jace::helper::attach(); 
     
    116112 */ 
    117113JFieldProxy( jfieldID fieldID_, jvalue value, jclass parentClass_ ) : 
    118   FieldType( value ), FieldType::JObject( FieldType::JObject::NO_OP ), fieldID( fieldID_ ) { 
     114  FieldType( value ), fieldID( fieldID_ ) { 
    119115 
    120116  parent = 0; 
     
    132128 */ 
    133129JFieldProxy( const JFieldProxy& object ) :  
    134   FieldType( object.getJavaJniValue() ), FieldType::JObject( FieldType::JObject::NO_OP ) { 
     130  FieldType( object.getJavaJniValue() ) { 
    135131  JNIEnv* env = ::jace::helper::attach(); 
    136132  if ( object.parent ) { 
     
    142138 
    143139  if ( object.parentClass ) { 
    144     parentClass = ::jace::helper::newGlobalRef( env, object.parentClass );  
     140    parentClass = static_cast<jclass>( ::jace::helper::newGlobalRef( env, object.parentClass ));  
    145141  } 
    146142  else { 
     
    157153      ::jace::helper::deleteGlobalRef( env, parent ); 
    158154    } 
    159     catch ( std::exception& e ) { 
    160       #ifdef JACE_UNUSED_LOCAL_VAR 
    161         e; // shut up the compiler 
    162       #endif 
     155    catch ( std::exception& ) { 
    163156    } 
    164157  } 
     
    169162      ::jace::helper::deleteGlobalRef( env, parentClass ); 
    170163    } 
    171     catch ( std::exception& e ) { 
    172       #ifdef JACE_UNUSED_LOCAL_VAR 
    173         e; // shut up the compiler 
    174       #endif 
     164    catch ( std::exception& ) { 
    175165    } 
    176166  } 
     
    185175 
    186176  if ( parent ) { 
    187     setJavaJniObject( JFieldProxyHelper::assign( field, parent, fieldID, FieldType::staticGetJavaJniClass() ) ); 
    188   } 
    189   else { 
    190     setJavaJniObject( JFieldProxyHelper::assign( field, parentClass, fieldID, FieldType::staticGetJavaJniClass() ) ); 
     177    setJavaJniObject( JFieldProxyHelper::assign( field, parent, fieldID ) ); 
     178  } 
     179  else { 
     180    setJavaJniObject( JFieldProxyHelper::assign( field, parentClass, fieldID ) ); 
    191181  } 
    192182 
  • trunk/components/bio-formats-jace/jace/include/jace/JFieldProxy.tsp

    r4696 r4760  
    1010 
    1111template <> 
    12 JFieldProxy< ::jace::proxy::types::JBoolean>::JFieldProxy< ::jace::proxy::types::JBoolean>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
     12JACE_API JFieldProxy< ::jace::proxy::types::JBoolean>::JFieldProxy< ::jace::proxy::types::JBoolean>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
    1313 
    1414template <> 
    15 JFieldProxy< ::jace::proxy::types::JBoolean>::JFieldProxy< ::jace::proxy::types::JBoolean>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
     15JACE_API JFieldProxy< ::jace::proxy::types::JBoolean>::JFieldProxy< ::jace::proxy::types::JBoolean>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
    1616 
    1717template <> 
    18 jace::proxy::types::JBoolean& JFieldProxy< ::jace::proxy::types::JBoolean>::operator=( const ::jace::proxy::types::JBoolean& type ); 
     18JACE_API jace::proxy::types::JBoolean& JFieldProxy< ::jace::proxy::types::JBoolean>::operator=( const ::jace::proxy::types::JBoolean& type ); 
    1919 
    2020template <> 
    21 JFieldProxy< ::jace::proxy::types::JByte>::JFieldProxy< ::jace::proxy::types::JByte>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
     21JACE_API JFieldProxy< ::jace::proxy::types::JByte>::JFieldProxy< ::jace::proxy::types::JByte>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
    2222 
    2323template <> 
    24 JFieldProxy< ::jace::proxy::types::JByte>::JFieldProxy< ::jace::proxy::types::JByte>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
     24JACE_API JFieldProxy< ::jace::proxy::types::JByte>::JFieldProxy< ::jace::proxy::types::JByte>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
    2525 
    2626template <> 
    27 jace::proxy::types::JByte& JFieldProxy< ::jace::proxy::types::JByte>::operator=( const ::jace::proxy::types::JByte& type ); 
     27JACE_API jace::proxy::types::JByte& JFieldProxy< ::jace::proxy::types::JByte>::operator=( const ::jace::proxy::types::JByte& type ); 
    2828 
    2929template <> 
    30 JFieldProxy< ::jace::proxy::types::JChar>::JFieldProxy< ::jace::proxy::types::JChar>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
     30JACE_API JFieldProxy< ::jace::proxy::types::JChar>::JFieldProxy< ::jace::proxy::types::JChar>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
    3131 
    3232template <> 
    33 JFieldProxy< ::jace::proxy::types::JChar>::JFieldProxy< ::jace::proxy::types::JChar>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
     33JACE_API JFieldProxy< ::jace::proxy::types::JChar>::JFieldProxy< ::jace::proxy::types::JChar>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
    3434 
    3535template <> 
    36 jace::proxy::types::JChar& JFieldProxy< ::jace::proxy::types::JChar>::operator=( const ::jace::proxy::types::JChar& type ); 
     36JACE_API jace::proxy::types::JChar& JFieldProxy< ::jace::proxy::types::JChar>::operator=( const ::jace::proxy::types::JChar& type ); 
    3737 
    3838template <> 
    39 JFieldProxy< ::jace::proxy::types::JShort>::JFieldProxy< ::jace::proxy::types::JShort>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
     39JACE_API JFieldProxy< ::jace::proxy::types::JShort>::JFieldProxy< ::jace::proxy::types::JShort>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
    4040 
    4141template <> 
    42 JFieldProxy< ::jace::proxy::types::JShort>::JFieldProxy< ::jace::proxy::types::JShort>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
     42JACE_API JFieldProxy< ::jace::proxy::types::JShort>::JFieldProxy< ::jace::proxy::types::JShort>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
    4343 
    4444template <> 
    45 jace::proxy::types::JShort& JFieldProxy< ::jace::proxy::types::JShort>::operator=( const ::jace::proxy::types::JShort& type ); 
     45JACE_API jace::proxy::types::JShort& JFieldProxy< ::jace::proxy::types::JShort>::operator=( const ::jace::proxy::types::JShort& type ); 
    4646 
    4747template <> 
    48 JFieldProxy< ::jace::proxy::types::JInt>::JFieldProxy< ::jace::proxy::types::JInt>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
     48JACE_API JFieldProxy< ::jace::proxy::types::JInt>::JFieldProxy< ::jace::proxy::types::JInt>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
    4949 
    5050template <> 
    51 JFieldProxy< ::jace::proxy::types::JInt>::JFieldProxy< ::jace::proxy::types::JInt>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
     51JACE_API JFieldProxy< ::jace::proxy::types::JInt>::JFieldProxy< ::jace::proxy::types::JInt>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
    5252 
    5353template <> 
    54 jace::proxy::types::JInt& JFieldProxy< ::jace::proxy::types::JInt>::operator=( const ::jace::proxy::types::JInt& type ); 
     54JACE_API jace::proxy::types::JInt& JFieldProxy< ::jace::proxy::types::JInt>::operator=( const ::jace::proxy::types::JInt& type ); 
    5555 
    5656template <> 
    57 JFieldProxy< ::jace::proxy::types::JLong>::JFieldProxy< ::jace::proxy::types::JLong>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
     57JACE_API JFieldProxy< ::jace::proxy::types::JLong>::JFieldProxy< ::jace::proxy::types::JLong>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
    5858 
    5959template <> 
    60 JFieldProxy< ::jace::proxy::types::JLong>::JFieldProxy< ::jace::proxy::types::JLong>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
     60JACE_API JFieldProxy< ::jace::proxy::types::JLong>::JFieldProxy< ::jace::proxy::types::JLong>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
    6161 
    6262template <> 
    63 jace::proxy::types::JLong& JFieldProxy< ::jace::proxy::types::JLong>::operator=( const ::jace::proxy::types::JLong& type ); 
     63JACE_API jace::proxy::types::JLong& JFieldProxy< ::jace::proxy::types::JLong>::operator=( const ::jace::proxy::types::JLong& type ); 
    6464 
    6565template <> 
    66 JFieldProxy< ::jace::proxy::types::JFloat>::JFieldProxy< ::jace::proxy::types::JFloat>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
     66JACE_API JFieldProxy< ::jace::proxy::types::JFloat>::JFieldProxy< ::jace::proxy::types::JFloat>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
    6767 
    6868template <> 
    69 JFieldProxy< ::jace::proxy::types::JFloat>::JFieldProxy< ::jace::proxy::types::JFloat>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
     69JACE_API JFieldProxy< ::jace::proxy::types::JFloat>::JFieldProxy< ::jace::proxy::types::JFloat>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
    7070 
    7171template <> 
    72 jace::proxy::types::JFloat& JFieldProxy< ::jace::proxy::types::JFloat>::operator=( const ::jace::proxy::types::JFloat& type ); 
     72JACE_API jace::proxy::types::JFloat& JFieldProxy< ::jace::proxy::types::JFloat>::operator=( const ::jace::proxy::types::JFloat& type ); 
    7373 
    7474template <> 
    75 JFieldProxy< ::jace::proxy::types::JDouble>::JFieldProxy< ::jace::proxy::types::JDouble>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
     75JACE_API JFieldProxy< ::jace::proxy::types::JDouble>::JFieldProxy< ::jace::proxy::types::JDouble>( jfieldID fieldID_, jvalue value, jobject parent_ ); 
    7676 
    7777template <> 
    78 JFieldProxy< ::jace::proxy::types::JDouble>::JFieldProxy< ::jace::proxy::types::JDouble>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
     78JACE_API JFieldProxy< ::jace::proxy::types::JDouble>::JFieldProxy< ::jace::proxy::types::JDouble>( jfieldID fieldID_, jvalue value, jclass parent_ ); 
    7979 
    8080template <> 
    81 jace::proxy::types::JDouble& JFieldProxy< ::jace::proxy::types::JDouble>::operator=( const ::jace::proxy::types::JDouble& type ); 
     81JACE_API jace::proxy::types::JDouble& JFieldProxy< ::jace::proxy::types::JDouble>::operator=( const ::jace::proxy::types::JDouble& type ); 
    8282 
    8383END_NAMESPACE( jace ) 
  • trunk/components/bio-formats-jace/jace/include/jace/JFieldProxyHelper.h

    r4696 r4760  
    2323BEGIN_NAMESPACE_2( jace, JFieldProxyHelper ) 
    2424 
    25 JACE_API jobject assign( const jace::proxy::JObject& field, jobject parent, jfieldID fieldID, const jace::JClass* classType ); 
    26 JACE_API jobject assign( const jace::proxy::JObject& field, jclass parentClass, jfieldID fieldID, const jace::JClass* classType ); 
     25JACE_API jobject assign( const jace::proxy::JObject& field, jobject parent, jfieldID fieldID ); 
     26JACE_API jobject assign( const jace::proxy::JObject& field, jclass parentClass, jfieldID fieldID ); 
    2727 
    2828END_NAMESPACE_2( jace, JFieldProxyHelper ) 
  • trunk/components/bio-formats-jace/jace/include/jace/JMethod.h

    r4696 r4760  
    8080BEGIN_NAMESPACE( jace ) 
    8181 
     82 
     83/** 
     84 * Transforms a JArguments to a vector of jvalue's. 
     85 */ 
     86JACE_API std::vector<jvalue> toVector( const JArguments& arguments ); 
    8287 
    8388/** 
     
    8893 */ 
    8994template <class ResultType> class JMethod { 
    90  
    91  
    9295public: 
    93  
    94  
    95 /** 
    96  * Creates a new JMethod representing the method with the 
    97  * given name, belonging to the given class. 
    98  * 
    99  */ 
    100 JMethod( const std::string& name ) : mName( name ), mMethodID( 0 ) { 
    101 } 
    102  
    103 /** 
    104  * Invokes the method with the given arguments. 
    105  * The method is invoked on the supplied object. 
    106  * 
    107  * @throws JNIException if an error occurs while trying to invoke the method. 
    108  * @throws a matching C++ proxy, if a java exception is thrown by the method. 
    109  * 
    110  */ 
    111 ResultType invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ) { 
    112  
    113   #ifdef JACE_CHECK_NULLS 
    114     if ( object.isNull() ) { 
    115       throw JNIException( "[JMethod.invoke] Can not invoke an instance method on a null object." ); 
    116     } 
    117   #endif 
    118  
    119   /* Get the methodID for the method matching the given arguments. 
     96  /** 
     97   * Creates a new JMethod representing the method with the 
     98   * given name, belonging to the given class. 
     99   * 
    120100   */ 
    121   jmethodID methodID = getMethodID( object.getJavaJniClass(), arguments ); 
    122  
    123   /* Call the method. 
    124    */ 
    125   JNIEnv* env = helper::attach(); 
    126   jobject resultRef; 
    127  
    128         if ( arguments.asList().size() > 0 ) 
    129                 resultRef = env->CallObjectMethodA( object.getJavaJniObject(), methodID, &toVector( arguments )[ 0 ] ); 
    130         else 
    131                 resultRef = env->CallObjectMethod( object.getJavaJniObject(), methodID ); 
    132  
    133   /* Catch any java exception that occured during the method call, 
    134    * and throw it as a C++ exception. 
    135    */ 
    136   helper::catchAndThrow(); 
    137  
    138   ResultType result( resultRef ); 
    139   helper::deleteLocalRef( env, resultRef ); 
    140  
    141   return result; 
    142 } 
    143  
    144  
    145 /** 
    146  * Invokes the method with the given arguments. 
    147  * The method is invoked statically, on the supplied class. 
    148  * 
    149  * @throws JNIException if an error occurs while trying to invoke the method. 
    150  * @throws a matching C++ proxy, if a java exception is thrown by the method. 
    151  * 
    152  */ 
    153 ResultType invoke( const JClass* jClass, const JArguments& arguments ) { 
    154  
    155   /* Get the methodID for the method matching the given arguments. 
    156    */ 
    157   jmethodID methodID = getMethodID( jClass, arguments, true ); 
    158  
    159   /* Call the method. 
    160    */ 
    161   JNIEnv* env = helper::attach(); 
    162   jobject resultRef; 
    163  
    164         if ( arguments.asList().size() > 0 ) 
    165                 resultRef = env->CallStaticObjectMethodA( jClass->getClass(), methodID, &toVector( arguments )[ 0 ] ); 
    166         else 
    167                 resultRef = env->CallStaticObjectMethod( jClass->getClass(), methodID ); 
    168  
    169   /* Catch any java exception that occured during the method call, 
    170    * and throw it as a C++ exception. 
    171    */ 
    172   helper::catchAndThrow(); 
    173  
    174   ResultType result( resultRef ); 
    175   helper::deleteLocalRef( env, resultRef ); 
    176  
    177   return result; 
    178 } 
    179  
    180  
    181 // private: 
    182  
    183 /** 
    184  * Returns the jmethodID matching the signature for the given arguments. 
    185  * 
    186  */ 
    187 jmethodID getMethodID( const JClass* jClass, const JArguments& arguments, bool isStatic = false ) { 
    188  
    189   /* We cache the jmethodID locally, so if we've already found it, 
    190    * we don't need to go looking for it again. 
    191    */ 
    192   if ( mMethodID ) { 
    193     return mMethodID; 
    194   } 
    195  
    196   /* If we don't already have the jmethodID, we need to determine 
    197    * the signature of this method. 
    198    */ 
    199   JSignature signature( *ResultType::staticGetJavaJniClass() ); 
    200   typedef std::list< ::jace::proxy::JValue* > ValueList; 
    201   ValueList args = arguments.asList(); 
    202  
    203   ValueList::iterator i = args.begin(); 
    204   ValueList::iterator end = args.end(); 
    205  
    206   for ( ; i != end; ++i ) { 
    207     ::jace::proxy::JValue* value = *i; 
    208     signature << *value->getJavaJniClass(); 
    209   } 
    210  
    211   std::string methodSignature = signature.toString(); 
    212  
    213   /* Now that we have the signature for the method, we could look 
    214    * in a global cache for the jmethodID corresponding to this method, 
    215    * but for now, we'll always find it. 
    216    */ 
    217   JNIEnv* env = helper::attach(); 
    218  
    219   if ( isStatic ) { 
    220     mMethodID = env->GetStaticMethodID( jClass->getClass(), mName.c_str(), methodSignature.c_str() ); 
    221   } 
    222   else { 
    223     mMethodID = env->GetMethodID( jClass->getClass(), mName.c_str(), methodSignature.c_str() ); 
    224   } 
    225  
    226   if ( mMethodID == 0 ) { 
    227     std::string msg = "JMethod::getMethodID\n" \ 
    228                  "Unable to find method <" + mName + "> with signature <" + methodSignature + ">"; 
    229                 try 
    230                 { 
    231                         helper::catchAndThrow(); 
    232                 } 
    233                 catch (JNIException e) 
    234                 { 
    235                         msg.append("\ncaused by:\n"); 
    236                         msg.append(e.what()); 
    237                 } 
    238     throw JNIException( msg ); 
    239   } 
    240  
    241 //  cout << "JMethod::getMethodID() - Found the method:" << endl; 
    242 //  cout << "  <" << mName << "> with signature <" << methodSignature << "> for " << jClass->getName() << endl; 
    243  
    244   return mMethodID; 
    245 } 
    246  
    247  
    248 std::string mName; 
    249 jmethodID mMethodID; 
     101  JMethod( const std::string& name ) : mName( name ), mMethodID( 0 ) {} 
     102 
     103        /** 
     104         * Invokes the method with the given arguments. 
     105         * The method is invoked on the supplied object. 
     106         * 
     107         * @throws JNIException if an error occurs while trying to invoke the method. 
     108         * @throws a matching C++ proxy, if a java exception is thrown by the method. 
     109         * 
     110         */ 
     111        ResultType invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ) { 
     112 
     113#ifdef JACE_CHECK_NULLS 
     114                if ( object.isNull() ) { 
     115                        throw JNIException( "[JMethod.invoke] Can not invoke an instance method on a null object." ); 
     116                } 
     117#endif 
     118 
     119                // Get the methodID for the method matching the given arguments. 
     120                jmethodID methodID = getMethodID( object.getJavaJniClass(), arguments ); 
     121 
     122                // Call the method. 
     123                JNIEnv* env = helper::attach(); 
     124                jobject resultRef; 
     125 
     126                if ( arguments.asList().size() > 0 ) 
     127                        resultRef = env->CallObjectMethodA( object.getJavaJniObject(), methodID, &toVector( arguments )[ 0 ] ); 
     128                else 
     129                        resultRef = env->CallObjectMethod( object.getJavaJniObject(), methodID ); 
     130 
     131                // Catch any java exception that occured during the method call, and throw it as a C++ exception. 
     132                helper::catchAndThrow(); 
     133 
     134                ResultType result( resultRef ); 
     135                helper::deleteLocalRef( env, resultRef ); 
     136 
     137                return result; 
     138        } 
     139 
     140 
     141        /** 
     142         * Invokes the method with the given arguments. 
     143         * The method is invoked statically, on the supplied class. 
     144         * 
     145         * @throws JNIException if an error occurs while trying to invoke the method. 
     146         * @throws a matching C++ proxy, if a java exception is thrown by the method. 
     147         * 
     148         */ 
     149        ResultType invoke( const JClass* jClass, const JArguments& arguments ) { 
     150 
     151                // Get the methodID for the method matching the given arguments. 
     152                jmethodID methodID = getMethodID( jClass, arguments, true ); 
     153 
     154                /* Call the method. 
     155                */ 
     156                JNIEnv* env = helper::attach(); 
     157                jobject resultRef; 
     158 
     159                if ( arguments.asList().size() > 0 ) 
     160                        resultRef = env->CallStaticObjectMethodA( jClass->getClass(), methodID, &toVector( arguments )[ 0 ] ); 
     161                else 
     162                        resultRef = env->CallStaticObjectMethod( jClass->getClass(), methodID ); 
     163 
     164                // Catch any java exception that occured during the method call, and throw it as a C++ exception. 
     165                helper::catchAndThrow(); 
     166 
     167                ResultType result( resultRef ); 
     168                helper::deleteLocalRef( env, resultRef ); 
     169 
     170                return result; 
     171        } 
     172 
     173 
     174        // private: 
     175 
     176        /** 
     177         * Returns the jmethodID matching the signature for the given arguments. 
     178         * 
     179         */ 
     180        jmethodID getMethodID( const JClass* jClass, const JArguments& arguments, bool isStatic = false ) { 
     181 
     182                // We cache the jmethodID locally, so if we've already found it, we don't need to go looking for it again. 
     183                if ( mMethodID ) { 
     184                        return mMethodID; 
     185                } 
     186 
     187                // If we don't already have the jmethodID, we need to determine the signature of this method. 
     188                JSignature signature( *ResultType::staticGetJavaJniClass() ); 
     189                typedef std::list< ::jace::proxy::JValue* > ValueList; 
     190                ValueList args = arguments.asList(); 
     191 
     192                ValueList::iterator i = args.begin(); 
     193                ValueList::iterator end = args.end(); 
     194 
     195                for ( ; i != end; ++i ) { 
     196                        ::jace::proxy::JValue* value = *i; 
     197                        signature << *value->getJavaJniClass(); 
     198                } 
     199 
     200                std::string methodSignature = signature.toString(); 
     201 
     202                // Now that we have the signature for the method, we could look in a global cache for the 
     203                // jmethodID corresponding to this method, but for now, we'll always find it. 
     204                JNIEnv* env = helper::attach(); 
     205 
     206                if ( isStatic ) { 
     207                        mMethodID = env->GetStaticMethodID( jClass->getClass(), mName.c_str(), methodSignature.c_str() ); 
     208                } 
     209                else { 
     210                        mMethodID = env->GetMethodID( jClass->getClass(), mName.c_str(), methodSignature.c_str() ); 
     211                } 
     212 
     213                if ( mMethodID == 0 ) { 
     214                        std::string msg = "JMethod::getMethodID\n" \ 
     215                                "Unable to find method <" + mName + "> with signature <" + methodSignature + ">"; 
     216                        try 
     217                        { 
     218                                helper::catchAndThrow(); 
     219                        } 
     220                        catch (JNIException e) 
     221                        { 
     222                                msg.append("\ncaused by:\n"); 
     223                                msg.append(e.what()); 
     224                        } 
     225                        throw JNIException( msg ); 
     226                } 
     227 
     228                //  cout << "JMethod::getMethodID() - Found the method:" << endl; 
     229                //  cout << "  <" << mName << "> with signature <" << methodSignature << "> for " << jClass->getName() << endl; 
     230 
     231                return mMethodID; 
     232        } 
     233 
     234 
     235        std::string mName; 
     236        jmethodID mMethodID; 
    250237 
    251238}; 
    252  
    253 /** 
    254  * Transforms a JArguments to a vector of jvalue's. 
    255  */ 
    256 JACE_API std::vector<jvalue> toVector( const JArguments& arguments ); 
    257  
    258239 
    259240END_NAMESPACE( jace ) 
  • trunk/components/bio-formats-jace/jace/include/jace/JMethod.tsp

    r4696 r4760  
    1010 
    1111template <> 
    12 ::jace::proxy::types::JBoolean JMethod< ::jace::proxy::types::JBoolean>::invoke( const JClass* jClass, const JArguments& arguments ); 
     12JACE_API ::jace::proxy::types::JBoolean JMethod< ::jace::proxy::types::JBoolean>::invoke( const JClass* jClass, const JArguments& arguments ); 
    1313 
    1414template <> 
    15 ::jace::proxy::types::JBoolean JMethod< ::jace::proxy::types::JBoolean>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     15JACE_API ::jace::proxy::types::JBoolean JMethod< ::jace::proxy::types::JBoolean>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    1616 
    1717template <> 
    18 ::jace::proxy::types::JByte JMethod< ::jace::proxy::types::JByte>::invoke( const JClass* jClass, const JArguments& arguments ); 
     18JACE_API ::jace::proxy::types::JByte JMethod< ::jace::proxy::types::JByte>::invoke( const JClass* jClass, const JArguments& arguments ); 
    1919 
    2020template <> 
    21 ::jace::proxy::types::JByte JMethod< ::jace::proxy::types::JByte>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     21JACE_API ::jace::proxy::types::JByte JMethod< ::jace::proxy::types::JByte>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    2222 
    2323template <> 
    24 ::jace::proxy::types::JChar JMethod< ::jace::proxy::types::JChar>::invoke( const JClass* jClass, const JArguments& arguments ); 
     24JACE_API ::jace::proxy::types::JChar JMethod< ::jace::proxy::types::JChar>::invoke( const JClass* jClass, const JArguments& arguments ); 
    2525 
    2626template <> 
    27 ::jace::proxy::types::JChar JMethod< ::jace::proxy::types::JChar>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     27JACE_API ::jace::proxy::types::JChar JMethod< ::jace::proxy::types::JChar>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    2828 
    2929template <> 
    30 ::jace::proxy::types::JDouble JMethod< ::jace::proxy::types::JDouble>::invoke( const JClass* jClass, const JArguments& arguments ); 
     30JACE_API ::jace::proxy::types::JDouble JMethod< ::jace::proxy::types::JDouble>::invoke( const JClass* jClass, const JArguments& arguments ); 
    3131 
    3232template <> 
    33 ::jace::proxy::types::JDouble JMethod< ::jace::proxy::types::JDouble>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     33JACE_API ::jace::proxy::types::JDouble JMethod< ::jace::proxy::types::JDouble>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    3434 
    3535template <> 
    36 ::jace::proxy::types::JFloat JMethod< ::jace::proxy::types::JFloat>::invoke( const JClass* jClass, const JArguments& arguments ); 
     36JACE_API ::jace::proxy::types::JFloat JMethod< ::jace::proxy::types::JFloat>::invoke( const JClass* jClass, const JArguments& arguments ); 
    3737 
    3838template <> 
    39 ::jace::proxy::types::JFloat JMethod< ::jace::proxy::types::JFloat>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     39JACE_API ::jace::proxy::types::JFloat JMethod< ::jace::proxy::types::JFloat>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    4040 
    4141template <> 
    42 ::jace::proxy::types::JInt JMethod< ::jace::proxy::types::JInt>::invoke( const JClass* jClass, const JArguments& arguments ); 
     42JACE_API ::jace::proxy::types::JInt JMethod< ::jace::proxy::types::JInt>::invoke( const JClass* jClass, const JArguments& arguments ); 
    4343 
    4444template <> 
    45 ::jace::proxy::types::JInt JMethod< ::jace::proxy::types::JInt>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     45JACE_API ::jace::proxy::types::JInt JMethod< ::jace::proxy::types::JInt>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    4646 
    4747template <> 
    48 ::jace::proxy::types::JLong JMethod< ::jace::proxy::types::JLong>::invoke( const JClass* jClass, const JArguments& arguments ); 
     48JACE_API ::jace::proxy::types::JLong JMethod< ::jace::proxy::types::JLong>::invoke( const JClass* jClass, const JArguments& arguments ); 
    4949 
    5050template <> 
    51 ::jace::proxy::types::JLong JMethod< ::jace::proxy::types::JLong>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     51JACE_API ::jace::proxy::types::JLong JMethod< ::jace::proxy::types::JLong>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    5252 
    5353template <> 
    54 ::jace::proxy::types::JShort JMethod< ::jace::proxy::types::JShort>::invoke( const JClass* jClass, const JArguments& arguments ); 
     54JACE_API ::jace::proxy::types::JShort JMethod< ::jace::proxy::types::JShort>::invoke( const JClass* jClass, const JArguments& arguments ); 
    5555 
    5656template <> 
    57 ::jace::proxy::types::JShort JMethod< ::jace::proxy::types::JShort>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     57JACE_API ::jace::proxy::types::JShort JMethod< ::jace::proxy::types::JShort>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    5858 
    5959template <> 
    60 ::jace::proxy::types::JVoid JMethod< ::jace::proxy::types::JVoid>::invoke( const JClass* jClass, const JArguments& arguments ); 
     60JACE_API ::jace::proxy::types::JVoid JMethod< ::jace::proxy::types::JVoid>::invoke( const JClass* jClass, const JArguments& arguments ); 
    6161 
    6262template <> 
    63 ::jace::proxy::types::JVoid JMethod< ::jace::proxy::types::JVoid>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
     63JACE_API ::jace::proxy::types::JVoid JMethod< ::jace::proxy::types::JVoid>::invoke( const ::jace::proxy::JObject& object, const JArguments& arguments ); 
    6464 
    6565 
  • trunk/components/bio-formats-jace/jace/include/jace/JNIHelper.h

    r4696 r4760  
    7474 
    7575/** 
     76 * Registers the ShutdownHook using Runtime.addShutdownHook(). 
     77 * 
     78 * @param env the JNI environment 
     79 */ 
     80JACE_API void registerShutdownHook( JNIEnv* env ); 
     81 
     82/** 
    7683 * Returns the current java virtual machine. 
    7784 * 
     
    8491 
    8592/** 
    86  * Callback that initializes process-local variables. Should be called at most once per process. 
    87  * This is invoked automatically when Jace is built as a dynamic library but must be invoked manually 
    88  * if static linking is used. 
    89  * 
    90  */ 
    91 JACE_API void onProcessCreation() throw ( ::jace::JNIException ); 
    92  
    93 /** 
    94  * Callback that initializes thread-local variables. Should be called at most once per thread. 
    95  * This is invoked automatically when Jace is built as a dynamic library but must be invoked manually 
    96  * if static linking is used. 
    97  * 
    98  */ 
    99 JACE_API void onThreadCreation() throw ( ::jace::JNIException ); 
    100  
    101 /** 
    102  * Callback that frees thread-local variables. Should be called at most once per thread. 
    103  * This is invoked automatically when Jace is built as a dynamic library but must be invoked manually 
    104  * if static linking is used. 
    105  * 
    106  */ 
    107 JACE_API void onThreadDestruction() throw ( ::jace::JNIException ); 
    108  
    109 /** 
    110  * Callback that frees process-local variables. Should be called at most once per process. 
    111  * This is invoked automatically when Jace is built as a dynamic library but must be invoked manually 
    112  * if static linking is used. 
    113  * 
    114  */ 
    115 JACE_API void onProcessDestruction() throw ( ::jace::JNIException ); 
    116  
    117 /** 
    118  * Attaches the current thread to the virtual machine  
    119  * and returns the appropriate JNIEnv for the thread.  
    120  * 
    121  * @throws JNIException if an error occurs while trying to 
    122  * attach the current thread. 
    123  * 
    124  * @see AttachCurrentThread. 
     93 * Attaches the current thread to the virtual machine and returns the appropriate  
     94 * JNIEnv for the thread. If the thread is already attached, this method method  
     95 * does nothing. 
     96 * 
     97 * This method is equivilent to attach(0, 0, false). 
     98 * 
     99 * @throws JNIException if an error occurs while trying to attach the current thread. 
     100 * @see AttachCurrentThread 
     101 * @see attach(const jobject, const char*, const bool) 
    125102 */ 
    126103JACE_API JNIEnv* attach() throw ( ::jace::JNIException ); 
     104 
     105 
     106/** 
     107 * Attaches the current thread to the virtual machine 
     108 * and returns the appropriate JNIEnv for the thread. 
     109 * If the thread is already attached, this method method does nothing. 
     110 * 
     111 * @param threadGroup the ThreadGroup associated with the thread, or null 
     112 * @param name the thread name, or null 
     113 * @param daemon true if the thread should be attached as a daemon thread 
     114 * @throws JNIException if an error occurs while trying to attach the current thread. 
     115 * @see AttachCurrentThread 
     116 * @see AttachCurrentThreadAsDaemon 
     117 */ 
     118JACE_API JNIEnv* attach(const jobject threadGroup, const char* name, const bool daemon) throw ( ::jace::JNIException ); 
    127119 
    128120 
  • trunk/components/bio-formats-jace/jace/include/jace/OptionList.h

    r4696 r4760  
    4444   * 
    4545   */ 
    46   JACE_API virtual std::string stringValue() = 0; 
     46  JACE_API virtual const std::string stringValue() const = 0; 
    4747 
    4848  /** 
     
    6868 */ 
    6969class OptionList { 
    70  
    71   public: 
    72  
     70public: 
    7371  typedef ::jace::counted_ptr<Option> OptionPtr; 
    7472 
    7573  /** 
    76    * An OptionList iterator. 
    77    * 
    78    */ 
    79   class iterator {   
    80  
    81     public: 
    82  
    83     JACE_API iterator( std::vector<OptionPtr>::iterator it_ ); 
    84     JACE_API iterator operator++(); 
    85     JACE_API iterator operator++( int i ); 
    86     JACE_API iterator operator--(); 
    87     JACE_API iterator operator--( int i ); 
    88     JACE_API OptionPtr operator*(); 
    89     JACE_API bool operator!=( const iterator& it_ ); 
    90  
    91  
    92     private: 
    93     std::vector<OptionPtr>::iterator it; 
    94   }; 
    95  
    96   /** 
    9774   * Creates a new empty OptionList. 
    9875   * 
     
    11693   * 
    11794   */ 
    118   JACE_API iterator begin() const; 
     95        JACE_API std::vector<OptionPtr>::const_iterator begin() const; 
    11996  
    12097  /** 
     
    12299   * 
    123100   */ 
    124   JACE_API iterator end() const; 
     101  JACE_API std::vector<OptionPtr>::const_iterator end() const; 
    125102 
    126103  /** 
     
    139116  JACE_API void destroyJniOptions( JavaVMOption* jniOptions ) const; 
    140117 
    141  
    142   private: 
    143   mutable std::vector<OptionPtr> options; 
     118private: 
     119        /** 
     120         * Prevent assignment. 
     121         */ 
     122        OptionList& operator=( const OptionList& other); 
     123 
     124  std::vector<OptionPtr> options; 
    144125}; 
    145126 
     
    151132 */ 
    152133class SystemProperty : public Option { 
    153  
    154   public: 
    155  
     134public: 
    156135  /** 
    157136   * Creates a new SystemProperty with the specified name and value. 
     
    159138   */ 
    160139  JACE_API SystemProperty( const std::string& name_, const std::string& value_ ); 
     140 
     141        /** 
     142         * Copy constructor. 
     143         */ 
     144        JACE_API SystemProperty( const SystemProperty& other); 
    161145   
    162   /** 
     146        /** 
    163147   * Returns the name of the SystemProperty. 
    164148   * 
    165149   */ 
    166   JACE_API virtual std::string name(); 
     150  JACE_API virtual const std::string name(); 
    167151   
    168152  /** 
     
    170154   * 
    171155   */ 
    172   JACE_API virtual std::string value(); 
    173  
    174   JACE_API virtual std::string stringValue(); 
    175   JACE_API virtual void* extraInfo(); 
    176   JACE_API virtual Option* clone() const; 
    177  
    178   private: 
    179  
    180   std::string mName; 
    181   std::string mValue; 
     156  JACE_API virtual const std::string value(); 
     157 
     158  JACE_API virtual const std::string stringValue() const; 
     159  JACE_API virtual void* extraInfo(); 
     160  JACE_API virtual Option* clone() const; 
     161 
     162private: 
     163        /** 
     164         * Prevent assignment. 
     165         */ 
     166        SystemProperty& operator=( const SystemProperty& other); 
     167 
     168  const std::string mName; 
     169  const std::string mValue; 
    182170}; 
    183171 
     
    188176 
    189177  class Version : public SystemProperty { 
    190     public: JACE_API Version( const std::string& value ) : SystemProperty( "java.version", value ) {} 
     178    public: Version( const std::string& value ) : SystemProperty( "java.version", value ) {} 
    191179  }; 
    192180 
    193181  class Vendor : public SystemProperty { 
    194     public: JACE_API Vendor( std::string value ) : SystemProperty( "java.vendor", value ) {} 
     182    public: Vendor( const std::string& value ) : SystemProperty( "java.vendor", value ) {} 
    195183  }; 
    196184 
    197185  class VendorUrl : public SystemProperty { 
    198     public: JACE_API VendorUrl( const std::string& value ) : SystemProperty( "java.vendor.url", value ) {} 
     186    public: VendorUrl( const std::string& value ) : SystemProperty( "java.vendor.url", value ) {} 
    199187  }; 
    200188 
    201189  class Home : public SystemProperty { 
    202     public: JACE_API Home( const std::string& value ) : SystemProperty( "java.home", value ) {} 
     190    public: Home( const std::string& value ) : SystemProperty( "java.home", value ) {} 
    203191  }; 
    204192 
    205193  class VmSpecificationVersion : public SystemProperty { 
    206     public: JACE_API VmSpecificationVersion( const std::string& value ) : SystemProperty( "java.vm.specification.version", value ) {} 
     194    public: VmSpecificationVersion( const std::string& value ) : SystemProperty( "java.vm.specification.version", value ) {} 
    207195  }; 
    208196 
    209197  class VmSpecificationVendor : public SystemProperty { 
    210     public: JACE_API VmSpecificationVendor( const std::string& value ) : SystemProperty( "java.vm.specification.vendor", value ) {} 
     198    public: VmSpecificationVendor( const std::string& value ) : SystemProperty( "java.vm.specification.vendor", value ) {} 
    211199  }; 
    212200 
    213201  class VmSpecificationName : public SystemProperty { 
    214     public: JACE_API VmSpecificationName( const std::string& value ) : SystemProperty( "java.vm.specification.name", value ) {} 
     202    public: VmSpecificationName( const std::string& value ) : SystemProperty( "java.vm.specification.name", value ) {} 
    215203  }; 
    216204 
    217205  class VmVersion : public SystemProperty { 
    218     public: JACE_API VmVersion( const std::string& value ) : SystemProperty( "java.vm.version", value ) {} 
     206    public: VmVersion( const std::string& value ) : SystemProperty( "java.vm.version", value ) {} 
    219207  }; 
    220208 
    221209  class VmVendor : public SystemProperty { 
    222     public: JACE_API VmVendor( const std::string& value ) : SystemProperty( "java.vm.vendor", value ) {} 
     210    public: VmVendor( const std::string& value ) : SystemProperty( "java.vm.vendor", value ) {} 
    223211  }; 
    224212 
    225213  class VmName : public SystemProperty { 
    226     public: JACE_API VmName( const std::string& value ) : SystemProperty( "java.vm.name", value ) {} 
     214    public: VmName( const std::string& value ) : SystemProperty( "java.vm.name", value ) {} 
    227215  }; 
    228216 
    229217  class SpecificationVersion : public SystemProperty { 
    230     public: JACE_API SpecificationVersion( const std::string& value ) : SystemProperty( "java.specification.version", value ) {} 
     218    public: SpecificationVersion( const std::string& value ) : SystemProperty( "java.specification.version", value ) {} 
    231219  }; 
    232220 
    233221  class SpecificationVendor : public SystemProperty { 
    234     public: JACE_API SpecificationVendor( const std::string& value ) : SystemProperty( "java.specification.vendor", value ) {} 
     222    public: SpecificationVendor( const std::string& value ) : SystemProperty( "java.specification.vendor", value ) {} 
    235223  }; 
    236224 
    237225  class SpecificationName : public SystemProperty { 
    238     public: JACE_API SpecificationName( const std::string& value ) : SystemProperty( "java.specification.name", value ) {} 
     226    public: SpecificationName( const std::string& value ) : SystemProperty( "java.specification.name", value ) {} 
    239227  }; 
    240228 
    241229  class ClassVersion : public SystemProperty { 
    242     public: JACE_API ClassVersion( const std::string& value ) : SystemProperty( "java.class.version", value ) {} 
     230    public: ClassVersion( const std::string& value ) : SystemProperty( "java.class.version", value ) {} 
    243231  }; 
    244232 
    245233  class ClassPath : public SystemProperty { 
    246     public: JACE_API ClassPath( const std::string& value ) : SystemProperty( "java.class.path", value ) {} 
     234    public: ClassPath( const std::string& value ) : SystemProperty( "java.class.path", value ) {} 
    247235  }; 
    248236 
    249237  class LibraryPath : public SystemProperty { 
    250     public: JACE_API LibraryPath( const std::string& value ) : SystemProperty( "java.library.path", value ) {} 
     238    public: LibraryPath( const std::string& value ) : SystemProperty( "java.library.path", value ) {} 
    251239  }; 
    252240 
    253241  class IoTmpDir : public SystemProperty { 
    254     public: JACE_API IoTmpDir( const std::string& value ) : SystemProperty( "java.io.tmpdir", value ) {} 
     242    public: IoTmpDir( const std::string& value ) : SystemProperty( "java.io.tmpdir", value ) {} 
    255243  }; 
    256244 
    257245  class Compiler : public SystemProperty { 
    258     public: JACE_API Compiler( const std::string& value ) : SystemProperty( "java.compiler", value ) {} 
     246    public: Compiler( const std::string& value ) : SystemProperty( "java.compiler", value ) {} 
    259247  }; 
    260248 
    261249  class ExtDirs : public SystemProperty { 
    262     public: JACE_API ExtDirs( const std::string& value ) : SystemProperty( "java.ext.dirs", value ) {} 
     250    public: ExtDirs( const std::string& value ) : SystemProperty( "java.ext.dirs", value ) {} 
    263251  }; 
    264252 
    265253  class OsName : public SystemProperty { 
    266     public: JACE_API OsName( const std::string& value ) : SystemProperty( "java.os.name", value ) {} 
     254    public: OsName( const std::string& value ) : SystemProperty( "java.os.name", value ) {} 
    267255  }; 
    268256 
    269257  class OsArch : public SystemProperty { 
    270     public: JACE_API OsArch( const std::string& value ) : SystemProperty( "java.os.arch", value ) {} 
     258    public: OsArch( const std::string& value ) : SystemProperty( "java.os.arch", value ) {} 
    271259  }; 
    272260 
    273261  class OsVersion : public SystemProperty { 
    274     public: JACE_API OsVersion( const std::string& value ) : SystemProperty( "java.os.version", value ) {} 
     262    public: OsVersion( const std::string& value ) : SystemProperty( "java.os.version", value ) {} 
    275263  }; 
    276264 
    277265  class FileSeparator : public SystemProperty { 
    278     public: JACE_API FileSeparator( const std::string& value ) : SystemProperty( "file.separator", value ) {} 
     266    public: FileSeparator( const std::string& value ) : SystemProperty( "file.separator", value ) {} 
    279267  }; 
    280268 
    281269  class PathSeparator : public SystemProperty { 
    282     public: JACE_API PathSeparator( const std::string& value ) : SystemProperty( "path.separator", value ) {} 
     270    public: PathSeparator( const std::string& value ) : SystemProperty( "path.separator", value ) {} 
    283271  }; 
    284272 
    285273  class LineSeparator : public SystemProperty { 
    286     public: JACE_API LineSeparator( const std::string& value ) : SystemProperty( "line.separator", value ) {} 
     274    public: LineSeparator( const std::string& value ) : SystemProperty( "line.separator", value ) {} 
    287275  }; 
    288276 
    289277  class UserName : public SystemProperty { 
    290     public: JACE_API UserName( const std::string& value ) : SystemProperty( "user.name", value ) {} 
     278    public: UserName( const std::string& value ) : SystemProperty( "user.name", value ) {} 
    291279  }; 
    292280 
    293281  class UserHome : public SystemProperty { 
    294     public: JACE_API UserHome( const std::string& value ) : SystemProperty( "user.home", value ) {} 
     282    public: UserHome( const std::string& value ) : SystemProperty( "user.home", value ) {} 
    295283  }; 
    296284 
    297285  class UserDir : public SystemProperty { 
    298     public: JACE_API UserDir( const std::string& value ) : SystemProperty( "user.dir", value ) {} 
     286    public: UserDir( const std::string& value ) : SystemProperty( "user.dir", value ) {} 
    299287  }; 
    300288 
     
    308296 */ 
    309297class Verbose : public Option { 
    310  
    311   public: 
    312  
    313   /** 
    314    * Output for garbage collection 
    315    */ 
    316   JACE_API static std::string Gc; 
    317  
    318   /** 
    319    * Output for JNI 
    320    */ 
    321   JACE_API static std::string Jni; 
    322  
    323   /** 
    324    * Output for class loading 
    325    */ 
    326   JACE_API static std::string Class; 
     298public: 
     299        /** 
     300         * The component that should output verbosely. 
     301         */ 
     302        JACE_API enum ComponentType { 
     303                /** 
     304                 * The garbage collector. 
     305                 */ 
     306                GC, 
     307                /** 
     308                 * The Java Native Interface. 
     309                 */ 
     310                JNI, 
     311                /** 
     312                 * The ClassLoader. 
     313                 */ 
     314                CLASS 
     315        }; 
     316 
     317        /** 
     318         * Creates a new Verbose option. 
     319         * 
     320         * @param component the component type 
     321         */ 
     322  JACE_API Verbose( ComponentType component ); 
     323 
     324        /** 
     325         * Creates a new Verbose option. 
     326         * 
     327         * @param begin the first component type 
     328         * @param end the last component type 
     329         */ 
     330  JACE_API Verbose( std::vector<ComponentType>::const_iterator begin, std::vector<ComponentType>::const_iterator end ); 
     331 
     332        /** 
     333         * Copy constructor. 
     334         */ 
     335        JACE_API Verbose( const Verbose& other ); 
    327336   
    328   JACE_API Verbose( const std::string& option ); 
    329  
    330   JACE_API Verbose( const std::string& o1, const std::string& o2 ); 
    331  
    332   JACE_API Verbose( const std::string& o1, const std::string& o2, const std::string& o3 ); 
    333  
    334   JACE_API Verbose( std::vector<std::string>::iterator begin, std::vector<std::string>::iterator end ); 
    335  
    336   JACE_API std::string stringValue(); 
    337   JACE_API virtual void* extraInfo(); 
    338   JACE_API virtual Option* clone() const; 
    339  
    340   private: 
    341   
    342   mutable std::vector<std::string> options; 
     337  JACE_API virtual const std::string stringValue() const; 
     338  JACE_API virtual void* extraInfo(); 
     339  JACE_API virtual Option* clone() const; 
     340 
     341private: 
     342        /** 
     343         * Prevent assignment. 
     344         */ 
     345        Verbose& operator=( const Verbose& other); 
     346        /** 
     347         * Converts a ComponentType to a string. 
     348         * 
     349         * @param component the component type 
     350         */ 
     351        std::string toString(ComponentType component) const; 
     352        /** 
     353         * Returns a vector containing a single value. 
     354         * 
     355         * @param component the value 
     356         */ 
     357        static std::vector<ComponentType> createVector( ComponentType& component ); 
     358        /** 
     359         * Returns a vector containing a collection of values 
     360         * 
     361         * @param begin the first element 
     362         * @param end the last element 
     363         */ 
     364        static std::vector<ComponentType> createVector( std::vector<ComponentType>::const_iterator begin,  
     365                std::vector<ComponentType>::const_iterator end ); 
     366 
     367  const std::vector<ComponentType> options; 
     368}; 
     369 
     370 
     371/** 
     372 * A specific type of Option that tells the virtual machine to load 
     373 * a Java instrumentation agent. 
     374 * 
     375 */ 
     376class JavaAgent : public Option { 
     377public: 
     378        /** 
     379         * Creates a new JavaAgent. 
     380         * 
     381         * @param path the path to the JavaAgent 
     382         */ 
     383  JACE_API JavaAgent( const std::string& path ); 
     384 
     385        /** 
     386         * Creates a new JavaAgent. 
     387         * 
     388         * @param path the path to the JavaAgent 
     389         * @param options the agent options 
     390         */ 
     391        JACE_API JavaAgent( const std::string& path, const std::string& options ); 
     392 
     393        /** 
     394         * Copy constructor. 
     395         */ 
     396        JACE_API JavaAgent( const JavaAgent& other); 
     397   
     398        /** 
     399   * Returns the path of the Java agent. 
     400   * 
     401   */ 
     402  JACE_API virtual const std::string path(); 
     403 
     404        /** 
     405   * Returns the Java agent options. 
     406   * 
     407   */ 
     408  JACE_API virtual const std::string options(); 
     409  JACE_API virtual const std::string stringValue() const; 
     410  JACE_API virtual void* extraInfo(); 
     411  JACE_API virtual Option* clone() const; 
     412 
     413private: 
     414        /** 
     415         * Prevent assignment. 
     416         */ 
     417        JavaAgent& operator=( const JavaAgent& other); 
     418        /** 
     419         * Removes the leading and trailing whitespace from a string. 
     420         * 
     421         * @param text the input string 
     422         * @return the output string 
     423         */ 
     424        std::string trim( const std::string& text ); 
     425 
     426        const std::string mPath; 
     427  const std::string mOptions; 
    343428}; 
    344429 
     
    353438 */ 
    354439class CustomOption : public Option { 
     440public: 
     441  JACE_API CustomOption( const std::string& value_ ); 
     442 
     443        /** 
     444         * Copy constructor. 
     445         */ 
     446        JACE_API CustomOption( const CustomOption& other); 
     447   
     448        JACE_API virtual const std::string stringValue() const; 
     449  JACE_API virtual void* extraInfo(); 
     450  JACE_API virtual Option* clone() const; 
     451 
     452private:  
     453        /** 
     454         * Prevent assignment. 
     455         */ 
     456        CustomOption& operator=( const CustomOption& other); 
     457 
     458  const std::string value; 
     459}; 
     460 
     461 
     462/** 
     463 * A virtual machine option that lets you hook into a specific function. 
     464 * 
     465 */ 
     466class Hook : public Option { 
     467}; 
     468 
     469 
     470/** 
     471 * Lets you hook into the vfprintf() function. 
     472 * 
     473 */ 
     474class VfprintfHook : public Hook { 
    355475 
    356476  public: 
    357477 
    358   JACE_API CustomOption( const std::string& value_ ); 
    359  
    360   JACE_API virtual std::string stringValue(); 
    361   JACE_API virtual void* extraInfo(); 
    362   JACE_API virtual Option* clone() const; 
    363  
    364   private:  
    365   std::string value; 
    366 }; 
    367  
    368  
    369 /** 
    370  * A virtual machine option that lets you hook into a specific function. 
    371  * 
    372  */ 
    373 class Hook : public Option { 
    374 }; 
    375  
    376  
    377 /** 
    378  * Lets you hook into the vfprintf() function. 
    379  * 
    380  */ 
    381 class VfprintfHook : public Hook { 
    382  
    383   public: 
    384  
    385478  typedef int ( *vfprintf_t )( FILE* fp, const char* format, va_list arg ); 
    386479 
    387480  JACE_API VfprintfHook( vfprintf_t hook_ ); 
    388481 
    389   JACE_API virtual std::string stringValue(); 
     482  JACE_API virtual const std::string stringValue() const; 
    390483  JACE_API virtual void* extraInfo(); 
    391484  JACE_API virtual Option* clone() const; 
     
    407500  JACE_API ExitHook( exit_t hook_ ); 
    408501 
    409   JACE_API virtual std::string stringValue(); 
     502  JACE_API virtual const std::string stringValue() const; 
    410503  JACE_API virtual void* extraInfo(); 
    411504  JACE_API virtual Option* clone() const; 
     
    429522  JACE_API AbortHook( abort_t hook_ ); 
    430523 
    431   JACE_API virtual std::string stringValue(); 
     524  JACE_API virtual const std::string stringValue() const; 
    432525  JACE_API virtual void* extraInfo(); 
    433526  JACE_API virtual Option* clone() const; 
  • trunk/components/bio-formats-jace/jace/include/jace/Peer.h

    r4696 r4760  
    8282   * 
    8383   */   
    84   jobject getGlobalRef(); 
     84  JACE_API jobject getGlobalRef(); 
    8585 
    8686  /** 
     
    8989   * 
    9090   */ 
    91   void releaseGlobalRef( jobject ref ); 
     91  JACE_API void releaseGlobalRef( jobject ref ); 
    9292  
    9393  private: 
  • trunk/components/bio-formats-jace/jace/include/jace/UnixVmLoader.h

    r4696 r4760  
    4848   * 
    4949   */ 
    50   UnixVmLoader( std::string path_, jint jniVersion ); 
     50  JACE_API UnixVmLoader( std::string path_, jint jniVersion ); 
    5151 
    52   void loadVm() throw ( ::jace::JNIException ); 
    53   void unloadVm(); 
    54   jint createJavaVM( JavaVM **pvm, void **env, void *args ); 
    55   jint getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ); 
    56   ::jace::VmLoader* clone() const; 
    57   jint version(); 
     52  JACE_API void loadVm() throw ( ::jace::JNIException ); 
     53  JACE_API void unloadVm(); 
     54  JACE_API jint createJavaVM( JavaVM **pvm, void **env, void *args ); 
     55  JACE_API jint getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ); 
     56  JACE_API ::jace::VmLoader* clone() const; 
     57  JACE_API jint version(); 
    5858 
    5959  private: 
  • trunk/components/bio-formats-jace/jace/include/jace/VmLoader.h

    r4696 r4760  
    8585  JACE_API virtual jint getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ) = 0; 
    8686 
    87   JACE_API virtual ~VmLoader() { 
     87  virtual ~VmLoader() { 
    8888  } 
    8989 
  • trunk/components/bio-formats-jace/jace/include/jace/Win32VmLoader.h

    r4696 r4760  
    109109        JACE_API void loadVm() throw ( ::jace::JNIException ); 
    110110  JACE_API void unloadVm(); 
    111   ::jace::VmLoader* clone() const; 
    112   virtual jint version(); 
    113   jint getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ); 
    114   jint createJavaVM( JavaVM **pvm, void **env, void *args ); 
     111  JACE_API ::jace::VmLoader* clone() const; 
     112  JACE_API virtual jint version(); 
     113  JACE_API jint getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ); 
     114  JACE_API jint createJavaVM( JavaVM **pvm, void **env, void *args ); 
    115115 
    116116  private: 
  • trunk/components/bio-formats-jace/jace/include/jace/WrapperVmLoader.h

    r4696 r4760  
    4343   */ 
    4444  JACE_API WrapperVmLoader( JNIEnv* env ); 
     45 
     46        JACE_API void loadVm() throw ( ::jace::JNIException ); 
     47  JACE_API void unloadVm(); 
     48  JACE_API ::jace::VmLoader* clone() const; 
     49  JACE_API virtual jint version(); 
     50  JACE_API jint getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ); 
     51  JACE_API jint createJavaVM( JavaVM **pvm, void **env, void *args ); 
     52 
     53        private: 
    4554        /** 
    4655   * Wraps a preexisting JavaVM* object. 
    4756   * 
    48    * @param javaVM - The JavaVM* object to wrap 
    49    * 
    5057   * @throws JNIException if an error occurs while trying to look up the VM. 
    5158   */ 
    52   JACE_API WrapperVmLoader( JavaVM* javaVM ); 
     59  JACE_API WrapperVmLoader(); 
    5360 
    54         JACE_API void loadVm() throw ( ::jace::JNIException ); 
    55   JACE_API void unloadVm(); 
    56   ::jace::VmLoader* clone() const; 
    57   virtual jint version(); 
    58   jint getCreatedJavaVMs( JavaVM **vmBuf, jsize bufLen, jsize *nVMs ); 
    59   jint createJavaVM( JavaVM **pvm, void **env, void *args ); 
    60  
    61         private: 
    62  
    63         JavaVM* javaVM; 
    6461        jint jniVersion; 
    6562}; 
  • trunk/components/bio-formats-jace/jace/include/jace/counted_ptr.h

    r4696 r4760  
    5858  typedef size_t size_type; 
    5959 
    60 public: 
    6160  explicit counted_ptr(X* p=0) : ptr(p) 
    6261  { 
     
    9897  size_type *count; 
    9998 
    100 protected: 
    10199  void release() 
    102100  { 
     
    138136  typedef size_t size_type; 
    139137 
    140 public: 
    141138  explicit counted_array_ptr(X* p = NULL) : ptr(p) 
    142139  { 
  • trunk/components/bio-formats-jace/jace/include/jace/javacast.tsp

    r4696 r4760  
    1818 * 
    1919 */ 
    20 template <> inline jobject java_cast<jobject>( const ::jace::proxy::JObject& obj ); 
     20template <> inline 
     21JACE_API jobject java_cast<jobject>( const ::jace::proxy::JObject& obj ); 
    2122 
    2223END_NAMESPACE( jace ) 
  • trunk/components/bio-formats-jace/jace/include/jace/os_dep.h

    r4696 r4760  
    7070  #pragma warning( once : 4518 ) 
    7171 
     72  /** 
     73   * Turn off warnings about "conditional expression is constant" such as "while(true)". 
     74   * 
     75   */ 
     76  #pragma warning( disable : 4127 ) 
     77 
     78  /** 
     79   * Turn off warning to avoid a compiler bug triggered by the use of multiple inheritance. 
     80   * @see http://groups.google.com/group/microsoft.public.vsnet.general/browse_thread/thread/1ec41da52896031d 
     81   * 
     82   */ 
     83  #pragma warning( disable : 4673 ) 
     84 
    7285        /** 
    7386         * Disable warning about non-safe C/C++ functions. 
     
    112125 
    113126  /** 
    114    * Visual C++ gives warnings on some unused local variables 
    115    * that no other compilers give warnings on. 
    116    * 
    117    */ 
    118   #define JACE_UNUSED_LOCAL_VAR 
    119  
    120   /** 
    121127   * VC++ 7.0 doesn't support exception specifications correctly, so it generates hundreds 
    122128   * of warnings. 
     
    126132    #pragma warning( disable : 4290 ) 
    127133  #endif 
     134 
     135        /** 
     136         * VC++ 9.0 supports the new streaming library; though, I'm not sure which version of VC++ 
     137         * it was introduced at. 
     138         */ 
     139        #if _MSC_VER >= 1500 
     140                #define SUPPORTS_SSTREAM 
     141        #endif 
    128142 
    129143/** 
     
    157171  #define SUPPORTS_SSTREAM 
    158172 
    159   /** 
    160    * CTR - GNU GCC supports pthreads, right? :-) 
    161    */ 
    162         #define SUPPORTS_PTHREADS 
    163  
    164173  #define NO_IMPLICIT_TYPENAME 
    165174 
     
    177186        #define JACE_TEMPLATE_EXTERN 
    178187        #define SUPPORTS_SSTREAM 
    179         #define SUPPORTS_PTHREADS 
    180188 
    181189#endif 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/JObject.h

    r4696 r4760  
    160160class NoOp { 
    161161  public: 
    162   JACE_API NoOp() {} 
     162  NoOp() {} 
    163163}; 
    164164 
     
    177177class CopyConstructorSpecifier { 
    178178  public: 
    179   JACE_API CopyConstructorSpecifier() {} 
     179  CopyConstructorSpecifier() {} 
    180180}; 
    181181 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/JValue.h

    r4696 r4760  
    5858 * 
    5959 */ 
    60 class JACE_API JValue { 
     60class JValue { 
    6161 
    6262public: 
     
    6666 * 
    6767 */ 
    68 JValue(); 
     68JACE_API JValue(); 
    6969 
    7070 
     
    7373 * 
    7474 */ 
    75 virtual ~JValue(); 
     75JACE_API virtual ~JValue(); 
    7676 
    7777 
     
    8080 * 
    8181 */ 
    82 jvalue getJavaJniValue(); 
     82JACE_API jvalue getJavaJniValue(); 
    8383 
    8484 
     
    9393 * 
    9494 */ 
    95 jvalue getJavaJniValue() const; 
     95JACE_API jvalue getJavaJniValue() const; 
    9696 
    9797 
     
    102102 * 
    103103 */ 
    104 virtual const ::jace::JClass* getJavaJniClass() const = 0; 
     104JACE_API virtual const ::jace::JClass* getJavaJniClass() const = 0; 
    105105 
    106106 
     
    120120 * 
    121121 */ 
    122 virtual void setJavaJniValue( jvalue value ) throw ( ::jace::JNIException ); 
     122JACE_API virtual void setJavaJniValue( jvalue value ) throw ( ::jace::JNIException ); 
    123123 
    124124 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JBoolean.h

    r4696 r4760  
    3737 * 
    3838 */ 
    39 class JACE_API JBoolean : public ::jace::proxy::JValue { 
     39class JBoolean : public ::jace::proxy::JValue { 
    4040 
    4141 
     
    4747 * 
    4848 */ 
    49 JBoolean( jvalue value ); 
     49JACE_API JBoolean( jvalue value ); 
    5050 
    5151 
     
    5454 * 
    5555 */ 
    56 JBoolean( jboolean value ); 
     56JACE_API JBoolean( jboolean value ); 
    5757 
    5858 
     
    6161 * 
    6262 */ 
    63 virtual ~JBoolean(); 
     63JACE_API virtual ~JBoolean(); 
    6464 
    6565 
     
    6868 * 
    6969 */ 
    70 operator jboolean() const; 
     70JACE_API operator jboolean() const; 
    7171 
    7272/** 
     
    7474 * 
    7575 */ 
    76 jboolean getBoolean() const; 
     76JACE_API jboolean getBoolean() const; 
    7777 
    7878 
     
    8181 * 
    8282 */ 
    83 bool operator==( const JBoolean& boolean_ ) const; 
     83JACE_API bool operator==( const JBoolean& boolean_ ) const; 
    8484 
    8585 
     
    8888 * 
    8989 */ 
    90 bool operator!=( const JBoolean& boolean_ ) const; 
     90JACE_API bool operator!=( const JBoolean& boolean_ ) const; 
    9191 
    9292 
     
    9595 * 
    9696 */ 
    97 bool operator==( jboolean val ) const; 
     97JACE_API bool operator==( jboolean val ) const; 
    9898 
    9999 
     
    102102 * 
    103103 */ 
    104 bool operator!=( jboolean val ) const; 
     104JACE_API bool operator!=( jboolean val ) const; 
    105105 
    106106 
     
    109109 * 
    110110 */ 
    111 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     111JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    112112 
    113113 
     
    116116 * 
    117117 */ 
    118 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     118JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
    119119 
    120120}; 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JByte.h

    r4696 r4760  
    3636 * 
    3737 */ 
    38 class JACE_API JByte : public ::jace::proxy::JValue { 
     38class JByte : public ::jace::proxy::JValue { 
    3939 
    4040 
     
    4646 * 
    4747 */ 
    48 JByte( jvalue value ); 
     48JACE_API JByte( jvalue value ); 
    4949 
    5050 
     
    5353 * 
    5454 */ 
    55 JByte( jbyte byte ); 
     55JACE_API JByte( jbyte byte ); 
    5656 
    5757 
     
    6060 * 
    6161 */ 
    62 virtual ~JByte(); 
     62JACE_API virtual ~JByte(); 
    6363 
    6464 
     
    6767 * 
    6868 */ 
    69 operator jbyte() const; 
     69JACE_API operator jbyte() const; 
    7070 
    7171 
     
    7474 * 
    7575 */ 
    76 jbyte getByte() const; 
     76JACE_API jbyte getByte() const; 
    7777 
    7878 
     
    8181 * 
    8282 */ 
    83 bool operator==( const JByte& byte_ ) const; 
     83JACE_API bool operator==( const JByte& byte_ ) const; 
    8484 
    8585 
     
    8888 * 
    8989 */ 
    90 bool operator!=( const JByte& byte_ ) const; 
     90JACE_API bool operator!=( const JByte& byte_ ) const; 
    9191 
    9292 
     
    9595 * 
    9696 */ 
    97 bool operator==( jbyte val ) const; 
     97JACE_API bool operator==( jbyte val ) const; 
    9898 
    9999 
     
    102102 * 
    103103 */ 
    104 bool operator!=( jbyte val ) const; 
     104JACE_API bool operator!=( jbyte val ) const; 
    105105 
    106106 
     
    109109 * 
    110110 */ 
    111 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     111JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    112112 
    113113 
     
    116116 * 
    117117 */ 
    118 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     118JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
    119119 
    120120}; 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JChar.h

    r4696 r4760  
    3838 * 
    3939 */ 
    40 class JACE_API JChar : public JValue { 
     40class JChar : public JValue { 
    4141 
    4242 
     
    4848 * 
    4949 */ 
    50 JChar( jvalue value ); 
     50JACE_API JChar( jvalue value ); 
    5151 
    5252 
     
    5555 * 
    5656 */ 
    57 JChar( jchar char_ ); 
     57JACE_API JChar( jchar char_ ); 
    5858 
    5959 
     
    6262 * 
    6363 */ 
    64 virtual ~JChar(); 
     64JACE_API virtual ~JChar(); 
    6565 
    6666 
     
    6969 * 
    7070 */ 
    71 operator jchar() const; 
     71JACE_API operator jchar() const; 
    7272 
    7373/** 
     
    7575 * 
    7676 */ 
    77 jchar getChar() const; 
     77JACE_API jchar getChar() const; 
    7878 
    7979 
     
    8282 * 
    8383 */ 
    84 bool operator==( const JChar& char_ ) const; 
     84JACE_API bool operator==( const JChar& char_ ) const; 
    8585 
    8686 
     
    8989 * 
    9090 */ 
    91 bool operator!=( const JChar& char_ ) const; 
     91JACE_API bool operator!=( const JChar& char_ ) const; 
    9292 
    9393 
     
    9696 * 
    9797 */ 
    98 bool operator==( jchar val ) const; 
     98JACE_API bool operator==( jchar val ) const; 
    9999 
    100100 
     
    103103 * 
    104104 */ 
    105 bool operator!=( jchar val ) const; 
     105JACE_API bool operator!=( jchar val ) const; 
    106106 
    107107 
     
    110110 * 
    111111 */ 
    112 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     112JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    113113 
    114114 
     
    117117 * 
    118118 */ 
    119 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     119JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
    120120 
    121121/** 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JDouble.h

    r4696 r4760  
    3636 * 
    3737 */ 
    38 class JACE_API JDouble : public JValue { 
     38class JDouble : public JValue { 
    3939 
    4040 
     
    4646 * 
    4747 */ 
    48 JDouble( jvalue value ); 
     48JACE_API JDouble( jvalue value ); 
    4949 
    5050 
     
    5353 * 
    5454 */ 
    55 JDouble( jdouble value ); 
     55JACE_API JDouble( jdouble value ); 
    5656 
    5757 
     
    6060 * 
    6161 */ 
    62 virtual ~JDouble(); 
     62JACE_API virtual ~JDouble(); 
    6363 
    6464/** 
     
    6666 * 
    6767 */ 
    68 operator jdouble() const; 
     68JACE_API operator jdouble() const; 
    6969 
    7070 
     
    7373 * 
    7474 */ 
    75 jdouble getDouble() const; 
     75JACE_API jdouble getDouble() const; 
    7676 
    7777 
     
    8080 * 
    8181 */ 
    82 bool operator==( const JDouble& value ) const; 
     82JACE_API bool operator==( const JDouble& value ) const; 
    8383 
    8484 
     
    8787 * 
    8888 */ 
    89 bool operator!=( const JDouble& value ) const; 
     89JACE_API bool operator!=( const JDouble& value ) const; 
    9090 
    9191 
     
    9494 * 
    9595 */ 
    96 bool operator==( jdouble value ) const; 
     96JACE_API bool operator==( jdouble value ) const; 
    9797 
    9898 
     
    101101 * 
    102102 */ 
    103 bool operator!=( jdouble value ) const; 
     103JACE_API bool operator!=( jdouble value ) const; 
    104104 
    105105 
     
    108108 * 
    109109 */ 
    110 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     110JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    111111 
    112112 
     
    115115 * 
    116116 */ 
    117 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     117JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
    118118 
    119119}; 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JFloat.h

    r4696 r4760  
    3636 * 
    3737 */ 
    38 class JACE_API JFloat : public JValue { 
     38class JFloat : public JValue { 
    3939 
    4040 
     
    4646 * 
    4747 */ 
    48 JFloat( jvalue value ); 
     48JACE_API JFloat( jvalue value ); 
    4949 
    5050 
     
    5353 * 
    5454 */ 
    55 JFloat( jfloat value ); 
     55JACE_API JFloat( jfloat value ); 
    5656 
    5757 
     
    6060 * 
    6161 */ 
    62 virtual ~JFloat(); 
     62JACE_API virtual ~JFloat(); 
    6363 
    6464 
     
    6767 * 
    6868 */ 
    69 operator jfloat() const; 
     69JACE_API operator jfloat() const; 
    7070 
    7171/** 
     
    7373 * 
    7474 */ 
    75 jfloat getFloat() const; 
     75JACE_API jfloat getFloat() const; 
    7676 
    7777 
     
    8080 * 
    8181 */ 
    82 bool operator==( const JFloat& value ) const; 
     82JACE_API bool operator==( const JFloat& value ) const; 
    8383 
    8484 
     
    8787 * 
    8888 */ 
    89 bool operator!=( const JFloat& value ) const; 
     89JACE_API bool operator!=( const JFloat& value ) const; 
    9090 
    9191 
     
    9494 * 
    9595 */ 
    96 bool operator==( jfloat value ) const; 
     96JACE_API bool operator==( jfloat value ) const; 
    9797 
    9898 
     
    101101 * 
    102102 */ 
    103 bool operator!=( jfloat value ) const; 
     103JACE_API bool operator!=( jfloat value ) const; 
    104104 
    105105 
     
    108108 * 
    109109 */ 
    110 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     110JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    111111 
    112112 
     
    115115 * 
    116116 */ 
    117 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     117JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
    118118 
    119119}; 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JInt.h

    r4696 r4760  
    4242 * 
    4343 */ 
    44 class JACE_API JInt : public JValue { 
     44class JInt : public JValue { 
    4545 
    4646public: 
     
    5050 * 
    5151 */ 
    52 JInt( jvalue value ); 
     52JACE_API JInt( jvalue value ); 
    5353 
    5454 
     
    5757 * 
    5858 */ 
    59 JInt( const jint int_ ); 
     59JACE_API JInt( const jint int_ ); 
    6060 
    6161 
     
    6464 * 
    6565 */ 
    66 JInt( const ::jace::proxy::types::JByte& byte_ ); 
     66JACE_API JInt( const ::jace::proxy::types::JByte& byte_ ); 
    6767 
    6868 
     
    7171 * 
    7272 */ 
    73 virtual ~JInt(); 
     73JACE_API virtual ~JInt(); 
    7474 
    7575 
     
    7878 * 
    7979 */ 
    80 operator jint(); 
     80JACE_API operator jint(); 
    8181 
    8282 
     
    8585 * 
    8686 */ 
    87 jint getInt() const; 
    88  
    89  
    90 friend std::ostream& operator<<( std::ostream& stream, const JInt& val ); 
    91  
    92 /** 
    93  * Compares this JInt to another. 
    94  * 
    95  */ 
    96 bool operator==( const JInt& int_ ) const; 
     87JACE_API jint getInt() const; 
    9788 
    9889 
     
    10192 * 
    10293 */ 
    103 bool operator!=( const JInt& int_ ) const; 
     94JACE_API bool operator==( const JInt& int_ ) const; 
     95 
     96 
     97/** 
     98 * Compares this JInt to another. 
     99 * 
     100 */ 
     101JACE_API bool operator!=( const JInt& int_ ) const; 
    104102 
    105103 
     
    108106 * 
    109107 */ 
    110 bool operator==( jint val ) const; 
     108JACE_API bool operator==( jint val ) const; 
    111109 
    112110 
     
    115113 * 
    116114 */ 
    117 bool operator!=( jint val ) const; 
     115JACE_API bool operator!=( jint val ) const; 
    118116 
    119117 
     
    122120 * 
    123121 */ 
    124 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     122JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    125123 
    126124/** 
     
    130128 * 
    131129 */ 
    132 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     130JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     131 
     132friend std::ostream& operator<<( std::ostream& stream, const JInt& val ); 
    133133 
    134134}; 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JLong.h

    r4696 r4760  
    4040 * 
    4141 */ 
    42 class JACE_API JLong : public JValue { 
     42class JLong : public JValue { 
    4343 
    4444public: 
     
    4848 * 
    4949 */ 
    50 JLong( jvalue value ); 
     50JACE_API JLong( jvalue value ); 
    5151 
    5252 
     
    5555 * 
    5656 */ 
    57 JLong( jlong long_ ); 
     57JACE_API JLong( jlong long_ ); 
    5858 
    5959 
     
    6262 * 
    6363 */ 
    64 JLong( const ::jace::proxy::types::JInt& int_ ); 
     64JACE_API JLong( const ::jace::proxy::types::JInt& int_ ); 
    6565 
    6666 
     
    6969 * 
    7070 */ 
    71 virtual ~JLong(); 
     71JACE_API virtual ~JLong(); 
    7272 
    7373 
     
    7676 * 
    7777 */ 
    78 operator jlong() const; 
     78JACE_API operator jlong() const; 
    7979 
    8080 
     
    8383 * 
    8484 */ 
    85 jlong getLong() const; 
     85JACE_API jlong getLong() const; 
    8686 
    8787 
     
    9090 * 
    9191 */ 
    92 bool operator==( const JLong& long_ ) const; 
     92JACE_API bool operator==( const JLong& long_ ) const; 
    9393 
    9494 
     
    9797 * 
    9898 */ 
    99 bool operator!=( const JLong& long_ ) const; 
     99JACE_API bool operator!=( const JLong& long_ ) const; 
    100100 
    101101 
     
    104104 * 
    105105 */ 
    106 bool operator==( jlong val ) const; 
     106JACE_API bool operator==( jlong val ) const; 
    107107 
    108108 
     
    111111 * 
    112112 */ 
    113 bool operator!=( jlong val ) const; 
     113JACE_API bool operator!=( jlong val ) const; 
    114114 
    115115 
     
    118118 * 
    119119 */ 
    120 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     120JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    121121 
    122122/** 
     
    126126 * 
    127127 */ 
    128 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     128JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
    129129 
    130130}; 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JShort.h

    r4696 r4760  
    3636 * 
    3737 */ 
    38 class JACE_API JShort : public JValue { 
     38class JShort : public JValue { 
    3939 
    4040 
     
    4646 * 
    4747 */ 
    48 JShort( jvalue value ); 
     48JACE_API JShort( jvalue value ); 
    4949 
    5050 
     
    5353 * 
    5454 */ 
    55 JShort( jshort value ); 
     55JACE_API JShort( jshort value ); 
    5656 
    5757 
     
    6060 * 
    6161 */ 
    62 virtual ~JShort(); 
     62JACE_API virtual ~JShort(); 
    6363 
    6464 
     
    6767 * 
    6868 */ 
    69 operator jshort() const; 
     69JACE_API operator jshort() const; 
    7070 
    7171 
     
    7474 * 
    7575 */ 
    76 jshort getShort() const; 
     76JACE_API jshort getShort() const; 
    7777 
    7878 
     
    8181 * 
    8282 */ 
    83 bool operator==( const JShort& value ) const; 
     83JACE_API bool operator==( const JShort& value ) const; 
    8484 
    8585 
     
    8888 * 
    8989 */ 
    90 bool operator!=( const JShort& value ) const; 
     90JACE_API bool operator!=( const JShort& value ) const; 
    9191 
    9292 
     
    9595 * 
    9696 */ 
    97 bool operator==( jshort value ) const; 
     97JACE_API bool operator==( jshort value ) const; 
    9898 
    9999 
     
    102102 * 
    103103 */ 
    104 bool operator!=( jshort value ) const; 
     104JACE_API bool operator!=( jshort value ) const; 
    105105 
    106106 
     
    109109 * 
    110110 */ 
    111 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     111JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    112112 
    113113 
     
    116116 * 
    117117 */ 
    118 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     118JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
    119119 
    120120}; 
  • trunk/components/bio-formats-jace/jace/include/jace/proxy/types/JVoid.h

    r4696 r4760  
    3636 * 
    3737 */ 
    38 class JACE_API JVoid : public JValue { 
     38class JVoid : public JValue { 
    3939 
    4040 
     
    4747 * 
    4848 */ 
    49 virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
     49JACE_API virtual const ::jace::JClass* getJavaJniClass() const throw ( ::jace::JNIException ); 
    5050 
    5151 
     
    5656 * 
    5757 */ 
    58 static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
     58JACE_API static const ::jace::JClass* staticGetJavaJniClass() throw ( ::jace::JNIException ); 
    5959 
    6060}; 
  • trunk/components/bio-formats-jace/jace/source/jace/JFieldProxyHelper.cpp

    r4696 r4760  
    1212 
    1313 
    14 jobject assign( const JObject& field, jobject parent, jfieldID fieldID, const JClass* classType ) { 
     14jobject assign( const JObject& field, jobject parent, jfieldID fieldID ) { 
    1515 
    1616  JNIEnv* env = helper::attach(); 
     
    2222 
    2323 
    24 jobject assign( const JObject& field, jclass parentClass, jfieldID fieldID, const JClass* classType ) { 
     24jobject assign( const JObject& field, jclass parentClass, jfieldID fieldID ) { 
    2525 
    2626  JNIEnv* env = helper::attach(); 
  • trunk/components/bio-formats-jace/jace/source/jace/JNIHelper.cpp

    r4696 r4760  
    3636using std::cout; 
    3737using std::endl; 
    38  
    39 #if !defined(SUPPORTS_PTHREADS) && !defined(_WIN32) 
    40         #error Platform does not support pthreads or win32 thread-local storage 
    41 #endif 
    4238 
    4339#ifdef SUPPORTS_SSTREAM 
     
    6258using std::string; 
    6359 
    64 #ifdef SUPPORTS_PTHREADS 
    65 #include <pthread.h> 
    66 #include <errno.h> 
    67 #elif _WIN32 
    68  
    69 #ifndef VC_EXTRALEAN 
    70 #define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers 
    71 #endif 
    72  
    73 #include <windows.h> 
    74  
    75 #endif 
     60#pragma warning(push) 
     61#pragma warning(disable: 4103 4244 4512) 
     62#include <boost/thread/mutex.hpp> 
     63#include <boost/thread/tss.hpp> 
     64using boost::mutex; 
     65#pragma warning(pop) 
    7666 
    7767BEGIN_NAMESPACE_2( jace, helper ) 
    7868 
    79  
    80 namespace { 
    8169 
    8270// A reference to the java virtual machine. 
     
    10896// 
    10997// 
    110 volatile bool globalHasShutdown = false; 
     98bool globalHasShutdown = false; 
     99/** 
     100 * Ensures that the JVM does not shut down while it is being used. 
     101 */ 
     102boost::mutex shutdownMutex; 
    111103 
    112104// The map of all of the java class factories. 
     
    121113// A quick hack to get a string representation for any value 
    122114// This should probably go into some framework utility class 
    123 // 
    124115#ifdef SUPPORTS_SSTREAM 
    125116 
     
    140131#endif 
    141132 
    142 #ifdef SUPPORTS_PTHREADS 
    143         pthread_key_t CLASSLOADER_KEY = 0; 
    144 #elif _WIN32 
    145         DWORD CLASSLOADER_KEY = 0; 
    146 #endif 
    147  
    148 } // namespace { 
    149  
     133void classLoaderDestructor( jobject* value ) { 
     134 
     135        // Invoked by setClassLoader() or when the thread exits 
     136        if ( value == 0 ) 
     137                return; 
     138        mutex::scoped_lock lock(shutdownMutex); 
     139        if ( hasShutdown() ) 
     140                return; 
     141 
     142        // Read the thread state 
     143        JavaVM* jvm = getJavaVM(); 
     144        ::jace::VmLoader* loader = getVmLoader(); 
     145        JNIEnv* env; 
     146        bool isDetached = jvm->GetEnv( (void**) &env, loader->version() ) == JNI_EDETACHED; 
     147        assert(!isDetached); 
     148 
     149        env = helper::attach(); 
     150        helper::deleteGlobalRef( env, *value ); 
     151        delete[] value; 
     152 
     153        // Restore the thread state 
     154        if (isDetached) 
     155                jace::helper::detach(); 
     156} 
     157 
     158boost::thread_specific_ptr<jobject> threadClassLoader(classLoaderDestructor); 
    150159 
    151160std::string asString( JNIEnv* env, jstring str ) { 
     
    170179} 
    171180 
     181 
    172182void createVm( const VmLoader& loader, 
    173183               const OptionList& options, 
    174184               bool ignoreUnrecognized ) { 
    175185 
    176   globalLoader = auto_ptr<VmLoader>( loader.clone() ); 
     186  setVmLoader( loader ); 
    177187  globalLoader->loadVm(); 
    178188 
     
    197207    throw JNIException( msg ); 
    198208  } 
    199  
    200   jclass runtimeClass = env->FindClass( "java/lang/Runtime" ); 
    201   if ( ! runtimeClass ) { 
    202     string msg = "Assert failed: Unable to find the class, java.lang.Runtime."; 
    203     throw JNIException( msg ); 
    204   } 
    205  
    206   jmethodID runtimeGetRuntime = env->GetStaticMethodID( runtimeClass, "getRuntime", "()Ljava/lang/Runtime;" ); 
    207   if ( ! runtimeGetRuntime ) { 
    208                 deleteLocalRef( env, runtimeClass ); 
    209     string msg = "Assert failed: Unable to find the method, Runtime.getRuntime()."; 
    210     throw JNIException( msg ); 
    211   } 
    212  
    213         jobject runtimeObject = env->CallStaticObjectMethod( runtimeClass, runtimeGetRuntime ); 
    214         if ( ! runtimeObject )  { 
    215                 deleteLocalRef( env, runtimeClass ); 
    216     string msg = "Unable to invoke Runtime.getRuntime()"; 
     209        registerShutdownHook( env ); 
     210} 
     211 
     212 
     213void registerShutdownHook( JNIEnv *env ) { 
     214  jclass hookClass = env->FindClass( "jace/util/ShutdownHook" ); 
     215  if ( ! hookClass ) { 
     216    string msg = "Assert failed: Unable to find the class, jace.util.ShutdownHook."; 
     217    throw JNIException( msg ); 
     218  } 
     219 
     220  jmethodID hookGetInstance = env->GetStaticMethodID( hookClass, "getInstance", "()Ljace/util/ShutdownHook;" ); 
     221  if ( ! hookGetInstance ) { 
     222                deleteLocalRef( env, hookClass ); 
     223    string msg = "Assert failed: Unable to find the method, ShutdownHook.getInstance()."; 
     224    throw JNIException( msg ); 
     225  } 
     226 
     227        jobject hookObject = env->CallStaticObjectMethod( hookClass, hookGetInstance ); 
     228        if ( ! hookObject )     { 
     229                deleteLocalRef( env, hookClass ); 
     230    string msg = "Unable to invoke ShutdownHook.getInstance()"; 
    217231                try 
    218232                { 
     
    227241        } 
    228242 
    229   jmethodID runtimeAddShutdownHook = env->GetMethodID( runtimeClass, "addShutdownHook", "(Ljava/lang/Thread;)V" ); 
    230   if ( ! runtimeAddShutdownHook ) { 
    231                 deleteLocalRef( env, runtimeObject ); 
    232                 deleteLocalRef( env, runtimeClass ); 
    233     string msg = "Assert failed: Unable to find the method, Runtime.addShutdownHook()."; 
    234     throw JNIException( msg ); 
    235   } 
    236  
    237   jclass shutdownHookClass = env->FindClass( "jace/util/ShutdownHook" ); 
    238   if ( ! shutdownHookClass ) { 
    239                 deleteLocalRef( env, runtimeObject ); 
    240                 deleteLocalRef( env, runtimeClass ); 
    241     string msg = "Assert failed: Unable to find the class, jace.util.ShutdownHook. Did you forget to include " 
    242                         "jace-runtime.jar in your classpath at runtime?"; 
    243     throw JNIException( msg ); 
    244   } 
    245  
    246   jmethodID shutdownHookGetInstance = env->GetStaticMethodID( shutdownHookClass, "getInstance", "()Ljace/util/ShutdownHook;" ); 
    247   if ( ! shutdownHookGetInstance ) { 
    248                 deleteLocalRef( env, runtimeObject ); 
    249                 deleteLocalRef( env, runtimeClass ); 
    250                 deleteLocalRef( env, shutdownHookClass ); 
    251     string msg = "Assert failed: Unable to find the method, jace.util.ShutdownHook.getInstance()"; 
    252     throw JNIException( msg ); 
    253   } 
    254  
    255         jobject shutdownHookObject = env->CallStaticObjectMethod( shutdownHookClass, shutdownHookGetInstance ); 
    256         if ( ! shutdownHookObject ) { 
    257                 deleteLocalRef( env, runtimeObject ); 
    258                 deleteLocalRef( env, runtimeClass ); 
    259                 deleteLocalRef( env, shutdownHookClass ); 
    260     string msg = "Unable to invoke jace.util.ShutdownHook.getInstance()"; 
    261                 try 
    262                 { 
    263                         helper::catchAndThrow(); 
    264                 } 
    265                 catch (JNIException& e) 
    266                 { 
    267                         msg.append("\ncaused by:\n"); 
    268                         msg.append(e.what()); 
    269                 } 
    270     throw JNIException( msg ); 
    271         } 
    272  
    273         env->CallStaticObjectMethodA( runtimeClass, runtimeAddShutdownHook, (jvalue*) &shutdownHookObject ); 
     243  jmethodID hookRegisterIfNecessary = env->GetMethodID( hookClass, "registerIfNecessary", "()V" ); 
     244  if ( ! hookRegisterIfNecessary ) { 
     245                deleteLocalRef( env, hookObject ); 
     246                deleteLocalRef( env, hookClass ); 
     247    string msg = "Assert failed: Unable to find the method, ShutdownHook.registerIfNecessary()."; 
     248    throw JNIException( msg ); 
     249  } 
     250 
     251        env->CallObjectMethodA( hookObject, hookRegisterIfNecessary, 0 ); 
    274252        try 
    275253        { 
     
    278256        catch (JNIException& e) 
    279257        { 
    280                 string msg = "Exception thrown invoking Runtime.addShutdownHook(shutdownHook)"; 
     258                string msg = "Exception thrown invoking ShutdownHook.registerIfNecessary()"; 
    281259                msg.append("\ncaused by:\n"); 
    282260                msg.append(e.what()); 
    283261                throw JNIException( msg ); 
    284262        } 
    285         deleteLocalRef( env, runtimeObject ); 
    286         deleteLocalRef( env, runtimeClass ); 
    287         deleteLocalRef( env, shutdownHookClass ); 
    288 } 
     263        deleteLocalRef( env, hookObject ); 
     264        deleteLocalRef( env, hookClass ); 
     265} 
     266 
    289267 
    290268/** 
    291269 * Invoked by jace.util.ShutdownHook on VM shutdown. 
    292270 */ 
    293 extern "C" JNIEXPORT void JNICALL Java_jace_util_ShutdownHook_signalVMShutdown(JNIEnv* env, jobject obj) 
     271extern "C" JNIEXPORT void JNICALL Java_jace_util_ShutdownHook_signalVMShutdown( JNIEnv*, jclass ) 
    294272{ 
     273        mutex::scoped_lock lock(shutdownMutex); 
    295274        globalHasShutdown = true; 
    296275} 
     
    334313 
    335314void shutdown() { 
     315        mutex::scoped_lock lock(shutdownMutex); 
    336316  globalHasShutdown = true; 
    337317 
     
    343323 
    344324/** 
     325 * Attaches the current thread to the virtual machine and returns the appropriate  
     326 * JNIEnv for the thread. If the thread is already attached, this method method  
     327 * does nothing. 
     328 * 
     329 * This method is equivilent to attach(0, 0, false). 
     330 * 
     331 * @throws JNIException if an error occurs while trying to attach the current thread. 
     332 * @see AttachCurrentThread 
     333 * @see attach(const jobject, const char*, const bool) 
     334 */ 
     335JNIEnv* attach() throw ( JNIException ) { 
     336 
     337        return attach(0, 0, false); 
     338} 
     339 
     340 
     341/** 
    345342 * Attaches the current thread to the virtual machine 
    346343 * and returns the appropriate JNIEnv for the thread. 
    347  * 
    348  */ 
    349 JNIEnv* attach() throw ( JNIException ) { 
    350  
    351   if ( globalHasShutdown ) { 
     344 * If the thread is already attached, this method method does nothing. 
     345 * 
     346 * @param threadGroup the ThreadGroup associated with the thread, or null 
     347 * @param name the thread name, or null 
     348 * @param daemon true if the thread should be attached as a daemon thread 
     349 * @throws JNIException if an error occurs while trying to attach the current thread. 
     350 * @see AttachCurrentThread 
     351 * @see AttachCurrentThreadAsDaemon 
     352 */ 
     353JNIEnv* attach(const jobject threadGroup, const char* name, const bool daemon) throw ( JNIException ) { 
     354 
     355        mutex::scoped_lock lock(shutdownMutex); 
     356  if ( hasShutdown() ) { 
    352357    throw JNIException( "The VM has already been shutdown." ); 
    353358  } 
    354359 
    355360  JNIEnv* env; 
    356  
    357   jint result = getJavaVM()->AttachCurrentThread( reinterpret_cast<void**>( &env ), 0 ); 
     361        JavaVMAttachArgs args = {0}; 
     362        args.version = globalLoader->version(); 
     363        args.group = threadGroup; 
     364        if (name != 0) 
     365                strcpy(args.name, name); 
     366  jint result; 
     367        if (!daemon) 
     368                result = getJavaVM()->AttachCurrentThread( reinterpret_cast<void**>( &env ), &args ); 
     369        else 
     370                result = getJavaVM()->AttachCurrentThreadAsDaemon( reinterpret_cast<void**>( &env ), &args ); 
    358371 
    359372  if ( result != 0 ) { 
     
    418431void deleteLocalRef( JNIEnv* env, jobject localRef ) { 
    419432 
     433        mutex::scoped_lock lock(shutdownMutex); 
    420434  if ( hasShutdown() ) { 
    421435    return; 
     
    441455void deleteGlobalRef( JNIEnv* env, jobject globalRef ) { 
    442456 
     457        mutex::scoped_lock lock(shutdownMutex); 
    443458  if ( hasShutdown() ) { 
    444459    return; 
     
    592607    } 
    593608 
    594     /* Ask the factory to throw the exception. 
    595      */ 
     609    // Ask the factory to throw the exception. 
    596610    // cout << "helper::catchAndThrow() - Throwing the exception " << endl; 
    597611    // print( jexception ); 
     
    659673} 
    660674 
    661 namespace { 
    662  
    663         void classLoaderDestructor( void* value ) { 
    664  
    665 #ifdef SUPPORTS_PTHREADS 
    666                 // GILI: To my understanding, pthreads will call the destructor even if the slot contains NULL. 
    667                 //       The win32 code will not. 
    668                 if ( value == 0 ) 
    669                         return; 
    670 #endif 
    671                 JNIEnv* env = helper::attach(); 
    672                 jobject reference = static_cast<jobject> ( value ); 
    673                 helper::deleteGlobalRef( env, reference ); 
     675/** 
     676 * Returns the ClassLoader being used by the current thread. 
     677 * 
     678 */ 
     679jobject getClassLoader() { 
     680        jobject* value = threadClassLoader.get(); 
     681        if (value == 0) 
     682                return 0; 
     683        return value[0]; 
     684} 
     685 
     686void setClassLoader(jobject classLoader) { 
     687 
     688        JNIEnv* env = attach(); 
     689 
     690        // boost::thread_specific_ptr can only store a pointer to jobject, but someone needs to keep 
     691        // the underlying jobject alive so we use a dynamically-allocated array. 
     692        jobject* ptr = new jobject[1]; 
     693        if ( classLoader != 0 ) 
     694                ptr[0] = newGlobalRef( env, classLoader ); 
     695        else 
     696                ptr[0] = 0; 
     697        try 
     698        { 
     699                threadClassLoader.reset(ptr); 
    674700        } 
    675 } 
    676  
    677 /** 
    678  * Returns the ClassLoader being used by the current thread. 
    679  * 
    680  */ 
    681 jobject getClassLoader() { 
    682  
    683 #ifdef SUPPORTS_PTHREADS 
    684         return static_cast<jobject> ( pthread_getspecific( CLASSLOADER_KEY ) ); 
    685 #elif _WIN32 
    686         return static_cast<jobject> ( TlsGetValue( CLASSLOADER_KEY ) ); 
    687 #endif 
    688 } 
    689  
    690  
    691 /** 
    692  * Callback that initializes process-local variables. Should be called at most once per process. 
    693  * This is invoked automatically when Jace is built as a dynamic library but must be invoked manually 
    694  * if static linking is used. 
    695  * 
    696  */ 
    697 void onProcessCreation() throw ( ::jace::JNIException ) { 
    698  
    699 #ifdef SUPPORTS_PTHREADS 
    700         int rc = pthread_key_create( &CLASSLOADER_KEY, classLoaderDestructor ); 
    701         switch ( rc ) 
    702         { 
    703                 case 0: 
    704                         break; 
    705                 case ENOMEM: 
    706                 case EAGAIN: { 
    707                         std::string msg = "Out of memory"; 
    708                         throw JNIException( msg ); 
    709                 } 
    710                 default: { 
    711                         std::string msg = "JNIHelper::setClassLoader()\n" 
    712                                 "phread_key_create() returned " + toString( rc ) + "."; 
    713                         throw JNIException( msg ); 
    714                 } 
    715         } 
    716 #elif _WIN32 
    717         CLASSLOADER_KEY = TlsAlloc(); 
    718         if ( CLASSLOADER_KEY == TLS_OUT_OF_INDEXES ) { 
    719                 std::string msg = "JNIHelper::setClassLoader()\n" 
    720                         "TlsAlloc() returned " + toString( GetLastError() ) + "."; 
    721                 throw JNIException( msg ); 
    722         } 
    723 #endif 
    724 } 
    725  
    726 /** 
    727  * Callback that initializes thread-local variables. Should be called at most once per thread. 
    728  * This is invoked automatically when Jace is built as a dynamic library but must be invoked manually 
    729  * if static linking is used. 
    730  * 
    731  */ 
    732 void onThreadCreation() throw ( ::jace::JNIException ) { 
    733 } 
    734  
    735 /** 
    736  * Callback that frees thread-local variables. Should be called at most once per thread. 
    737  * This is invoked automatically when Jace is built as a dynamic library but must be invoked manually 
    738  * if static linking is used. 
    739  * 
    740  */ 
    741 void onThreadDestruction() throw ( ::jace::JNIException ) { 
    742  
    743 #ifdef _WIN32 
    744         if ( hasShutdown() ) 
    745                 return; 
    746         JavaVM* jvm = getJavaVM(); 
    747         ::jace::VmLoader* loader = getVmLoader(); 
    748         jobject value = getClassLoader(); 
    749         JNIEnv* env; 
    750  
    751         // We must ensure that the thread is detached when we leave this function. 
    752         bool mustDetachJVM = value != 0 || jvm->GetEnv( (void**) &env, loader->version() ) != JNI_EDETACHED; 
    753         if ( mustDetachJVM ) { 
    754                 if ( value != 0 ) { 
    755                         setClassLoader( 0 ); 
    756                 } 
    757                 jace::helper::detach(); 
    758         } 
    759 #endif 
    760 } 
    761  
    762 /** 
    763  * Callback that frees process-local variables. Should be called at most once per process. 
    764  * This is invoked automatically when Jace is built as a dynamic library but must be invoked manually 
    765  * if static linking is used. 
    766  * 
    767  */ 
    768 void onProcessDestruction() throw ( ::jace::JNIException ) { 
    769  
    770 #ifdef SUPPORTS_PTHREADS 
    771         int rc = pthread_key_delete( CLASSLOADER_KEY ); 
    772         if ( rc != 0 ) { 
    773                 std::string msg = "JNIHelper::setClassLoader()\n" 
    774                         "thread_key_delete() returned " + toString( rc ) + "."; 
    775                 throw JNIException( msg ); 
    776         } 
    777 #elif _WIN32 
    778         BOOL rc = TlsFree( CLASSLOADER_KEY ); 
    779         if ( !rc ) { 
    780                 std::string msg = "JNIHelper::setClassLoader()\n" 
    781                         "TlsFree() returned " + toString( GetLastError() ) + "."; 
    782                 throw JNIException( msg ); 
    783         } 
    784 #endif 
    785 } 
    786  
    787  
    788 void setClassLoader(jobject classLoader) { 
    789  
    790         JNIEnv* env = attach(); 
    791   jobject oldRef = getClassLoader(); 
    792  
    793 #ifdef SUPPORTS_PTHREADS 
    794         int rc; 
    795 #elif _WIN32 
    796         BOOL rc; 
    797 #endif 
    798  
    799         // Set the new value 
    800         if ( classLoader != 0 ) { 
    801                 classLoader = static_cast<jobject> ( newGlobalRef( env, classLoader ) ); 
    802         } 
    803 #ifdef SUPPORTS_PTHREADS 
    804         rc = pthread_setspecific( CLASSLOADER_KEY, classLoader ); 
    805         if ( rc != 0 ) { 
    806                 std::string msg = "JNIHelper::setClassLoader()\n" 
    807                         "pthread_setspecific() returned " + toString( rc ) + "."; 
    808                 throw JNIException( msg ); 
    809         } 
    810 #elif _WIN32 
    811         rc = TlsSetValue( CLASSLOADER_KEY, classLoader ); 
    812         if ( !rc ) { 
    813                 std::string msg = "JNIHelper::setClassLoader()\n" 
    814                         "TlsSetValue() returned " + toString( GetLastError() ) + "."; 
    815                 throw JNIException( msg ); 
    816         } 
    817 #endif 
    818  
    819         // Delete the old value if necessary 
    820         if ( oldRef != 0 ) { 
    821                 classLoaderDestructor( oldRef ); 
     701        catch ( boost::thread_resource_error& e) { 
     702                throw JNIException( e.what() ); 
    822703        } 
    823704} 
  • trunk/components/bio-formats-jace/jace/source/jace/OptionList.cpp

    r4696 r4760  
    55using ::jace::SystemProperty; 
    66using ::jace::Verbose; 
     7using ::jace::JavaAgent; 
    78using ::jace::CustomOption; 
    89using ::jace::Hook; 
     
    1819#include <vector> 
    1920using std::vector; 
    20 typedef std::vector<OptionList::OptionPtr> OptionPtr; 
    2121 
    2222#ifdef JACE_BROKEN_USING_DECLARATION 
     
    3131using std::back_inserter; 
    3232 
    33 std::string Verbose::Gc( "gc" ); 
    34 std::string Verbose::Jni( "jni" ); 
    35 std::string Verbose::Class( "class" ); 
    36  
    3733OptionList::OptionList() : options() { 
    3834} 
     
    4743} 
    4844 
    49 OptionList::iterator OptionList::begin() const { 
    50   return iterator( options.begin() ); 
     45std::vector<OptionList::OptionPtr>::const_iterator OptionList::begin() const { 
     46  return options.begin(); 
    5147} 
    5248  
    53 OptionList::iterator OptionList::end() const { 
    54   return iterator( options.end() ); 
     49std::vector<OptionList::OptionPtr>::const_iterator OptionList::end() const { 
     50  return options.end(); 
    5551} 
    5652 
     
    6460} 
    6561 
    66 OptionList::iterator::iterator( vector<OptionPtr>::iterator it_ ) { it = it_; } 
    67 OptionList::iterator OptionList::iterator::operator++() { return it++; } 
    68 OptionList::iterator OptionList::iterator::operator++( int i ) { return ++it; } 
    69 OptionList::iterator OptionList::iterator::operator--() { return it--; } 
    70 OptionList::iterator OptionList::iterator::operator--( int i ) { return --it; } 
    71 OptionList::OptionPtr OptionList::iterator::operator*() { return *it; } 
    72 bool OptionList::iterator::operator!=( const OptionList::iterator& it_ ) { return it_.it != it; } 
    73  
    7462JavaVMOption* OptionList::createJniOptions() const { 
    7563 
    7664  JavaVMOption* jniOptions = new JavaVMOption[ size() ]; 
    7765   
    78   iterator it = begin(); 
    79   iterator end_it = end(); 
     66        std::vector<OptionPtr>::const_iterator it = begin(); 
     67  std::vector<OptionPtr>::const_iterator end_it = end(); 
    8068 
    8169  for ( int i = 0; it != end_it; ++it, ++i ) { 
     
    9886 
    9987SystemProperty::SystemProperty( const std::string& name_, const std::string& value_ ) :  
    100   mName( name_ ), mValue( value_ ) { 
     88  mName ( name_ ), mValue ( value_ ) { 
     89} 
     90 
     91SystemProperty::SystemProperty(const SystemProperty& other) : 
     92        mName ( other.mName ), mValue ( other.mValue ) { 
     93} 
     94 
     95const std::string SystemProperty::name() { 
     96  return mName; 
    10197} 
    10298   
    103 std::string SystemProperty::name() { 
    104   return mName; 
    105 } 
    106    
    107 std::string SystemProperty::value() { 
     99const std::string SystemProperty::value() { 
    108100  return mValue; 
    109101} 
    110102 
    111 std::string SystemProperty::stringValue() { 
     103const std::string SystemProperty::stringValue() const { 
    112104  return "-D" + mName + "=" + mValue; 
    113105} 
     
    121113} 
    122114 
    123 Verbose::Verbose( const std::string& option ) : options() { 
    124   options.push_back( option ); 
    125 } 
    126  
    127 Verbose::Verbose( const std::string& o1, const std::string& o2 ) : options() { 
    128   options.push_back( o1 ); 
    129   options.push_back( o2 ); 
    130 } 
    131  
    132 Verbose::Verbose( const std::string& o1, const std::string& o2, const std::string& o3 ) : options() { 
    133   options.push_back( o1 ); 
    134   options.push_back( o2 ); 
    135   options.push_back( o3 ); 
    136 } 
    137  
    138 Verbose::Verbose( std::vector<std::string>::iterator begin, std::vector<std::string>::iterator end ) { 
    139   std::copy( begin, end, back_inserter( options ) ); 
    140 } 
    141  
    142 std::string Verbose::stringValue() { 
     115std::string Verbose::toString(Verbose::ComponentType component) const 
     116{ 
     117        switch (component) 
     118        { 
     119                case GC: 
     120                        return "gc"; 
     121                case JNI: 
     122                        return "jni"; 
     123                case CLASS: 
     124                        return "class"; 
     125                default: 
     126                        throw JNIException("Unknown component: " + component); 
     127        } 
     128} 
     129 
     130Verbose::Verbose( ComponentType component ) : options( createVector( component ) ) { 
     131} 
     132 
     133Verbose::Verbose( std::vector<ComponentType>::const_iterator begin, 
     134                                                                  std::vector<ComponentType>::const_iterator end ) :  
     135        options ( createVector( begin, end ) ) { 
     136} 
     137 
     138Verbose::Verbose( const Verbose& other ) :  
     139        options ( other.options ) { 
     140} 
     141 
     142std::vector<Verbose::ComponentType> Verbose::createVector( ComponentType& component ) { 
     143        std::vector<ComponentType> result; 
     144        result.push_back(component); 
     145        return result; 
     146} 
     147 
     148std::vector<Verbose::ComponentType> Verbose::createVector( std::vector<ComponentType>::const_iterator begin,  
     149                                                                                                                                                                                                                                         std::vector<ComponentType>::const_iterator end ) { 
     150        std::vector<ComponentType> result; 
     151        std::copy( begin, end, back_inserter( result ) ); 
     152        return result; 
     153} 
     154 
     155const std::string Verbose::stringValue() const { 
    143156 
    144157  std::string buffer( "-verbose:" ); 
    145158 
    146   vector<string>::iterator it = options.begin(); 
    147   vector<string>::iterator end = options.end(); 
     159        vector<ComponentType>::const_iterator it = options.begin(); 
     160  vector<ComponentType>::const_iterator end = options.end(); 
    148161 
    149162  for ( ; it != end; ++it ) { 
    150     buffer += *it; 
     163    buffer += toString(*it); 
    151164    if ( it + 1 != end ) { 
    152165      buffer += ","; 
     
    165178} 
    166179 
     180JavaAgent::JavaAgent( const std::string& path_ ) : 
     181        mPath ( path_ ), mOptions ( "" ) { 
     182} 
     183 
     184JavaAgent::JavaAgent( const std::string& path_, const std::string& options_ ) : 
     185        mPath ( path_ ), mOptions ( trim(options_) ) { 
     186} 
     187 
     188JavaAgent::JavaAgent( const JavaAgent& other) : 
     189        mPath ( other.mPath ), mOptions ( other.mOptions ) { 
     190} 
     191 
     192std::string JavaAgent::trim( const std::string& text ) { 
     193        // Trim Both leading and trailing spaces   
     194  size_t first = text.find_first_not_of(" \t"); // Find the first non-space character 
     195  size_t last = text.find_last_not_of(" \t"); // Find the last non-space character 
     196   
     197  // if all spaces or empty return an empty string 
     198  if ( ( string::npos != first ) && ( string::npos != last ) ) 
     199                return text.substr( first, last - first + 1 ); 
     200        else 
     201                return string(); 
     202} 
     203 
     204const std::string JavaAgent::path() { 
     205        return mPath; 
     206} 
     207 
     208const std::string JavaAgent::options() { 
     209        return mOptions; 
     210} 
     211 
     212const std::string JavaAgent::stringValue() const { 
     213        string result = "-javaagent:" + mPath; 
     214        if (mOptions != "") 
     215                result += "=" + mOptions; 
     216        return result; 
     217} 
     218 
     219void* JavaAgent::extraInfo() { 
     220  return 0; 
     221} 
     222 
     223Option* JavaAgent::clone() const { 
     224  return new JavaAgent( mPath, mOptions ); 
     225} 
     226 
    167227CustomOption::CustomOption( const std::string& value_ ) : value( value_ ) { 
    168228} 
    169229 
    170 std::string CustomOption::stringValue() { 
     230CustomOption::CustomOption( const CustomOption& other ) : 
     231        value ( other.value ) { 
     232} 
     233 
     234const std::string CustomOption::stringValue() const { 
    171235  return value; 
    172236} 
     
    184248} 
    185249 
    186 std::string VfprintfHook::stringValue() { 
     250const std::string VfprintfHook::stringValue() const { 
    187251  return "vfprintf"; 
    188252} 
     
    201265} 
    202266 
    203 std::string ExitHook::stringValue() { 
     267const std::string ExitHook::stringValue() const { 
    204268  return "exit"; 
    205269} 
     
    218282} 
    219283 
    220 std::string AbortHook::stringValue() { 
     284const std::string AbortHook::stringValue() const { 
    221285  return "abort"; 
    222286} 
  • trunk/components/bio-formats-jace/jace/source/jace/Win32VmLoader.cpp

    r4696 r4760  
    77using ::jace::JNIException; 
    88 
     9#define WIN32_LEAN_AND_MEAN 
    910#include <windows.h> 
    1011 
     
    8283                case JVMV_SUN: 
    8384                { 
    84                         /* Get current version */ 
     85                        // Get current version 
    8586                        if ( version.empty() ) 
    8687                        { 
     
    9091                                } 
    9192                        } 
    92                         /* Search Registry for PATH to Sun runtime */ 
     93                        // Search Registry for PATH to Sun runtime 
    9394                        switch ( jvmType ) 
    9495                        { 
  • trunk/components/bio-formats-jace/jace/source/jace/WrapperVmLoader.cpp

    r4696 r4760  
    55using ::jace::WrapperVmLoader; 
    66using ::jace::JNIException; 
     7 
     8BEGIN_NAMESPACE_2( jace, helper ) 
     9extern JavaVM* javaVM; 
     10END_NAMESPACE_2( jace, helper ) 
    711 
    812#include <string> 
     
    4145WrapperVmLoader::WrapperVmLoader( JNIEnv* env ) {  
    4246 
    43   jint result = env->GetJavaVM( &javaVM ); 
     47        jint result = env->GetJavaVM( &::jace::helper::javaVM ); 
    4448 
    4549  if ( result != 0 ) { 
     
    5357} 
    5458 
    55 WrapperVmLoader::WrapperVmLoader( JavaVM* javaVM ) {  
     59WrapperVmLoader::WrapperVmLoader( ) {  
    5660 
    57         if ( javaVM == 0 ) { 
     61        if ( ::jace::helper::javaVM == 0 ) { 
    5862    string msg = string( "WrapperVmLoader::WrapperVmLoader\n" ) + 
    5963                  "javaVM must be non-null"; 
     
    6266 
    6367  JNIEnv* env; 
    64   jint result = javaVM->AttachCurrentThread( reinterpret_cast<void**>( &env ), 0 ); 
     68  jint result = ::jace::helper::javaVM->AttachCurrentThread( reinterpret_cast<void**>( &env ), 0 ); 
    6569 
    6670  if ( result != 0 ) { 
     
    7175  } 
    7276         
    73         this->javaVM = javaVM; 
    7477        jniVersion = env->GetVersion(); 
    7578} 
     
    8790} 
    8891 
    89 jint WrapperVmLoader::createJavaVM( JavaVM **pvm, void **env, void *args ) { 
     92jint WrapperVmLoader::createJavaVM( JavaVM **pvm, void **env, void * ) { 
    9093 
    9194        if ( pvm == 0 || env == 0 ) 
    9295                return JNI_EINVAL; 
    9396        *env = helper::attach(); 
    94         *pvm = javaVM; 
     97        *pvm = ::jace::helper::javaVM; 
    9598        return JNI_OK; 
    9699} 
     
    100103        if ( bufLen < 1 || vmBuf == 0 ) 
    101104                return JNI_EINVAL; 
    102         *vmBuf = javaVM; 
     105        *vmBuf = ::jace::helper::javaVM; 
    103106        *nVMs = 1; 
    104107 
     
    107110 
    108111VmLoader* WrapperVmLoader::clone() const { 
    109         return new WrapperVmLoader( javaVM ); 
     112        return new WrapperVmLoader(); 
    110113} 
    111114 
  • trunk/components/bio-formats-jace/jace/source/jace/proxy/JObject.cpp

    r4696 r4760  
    8282 * for their own subclasses. 
    8383 */ 
    84 JObject::JObject( const NoOp& noOp ) { 
     84JObject::JObject( const NoOp& ) { 
    8585 
    8686  /* By default, all objects start out with a null reference, 
  • trunk/components/bio-formats-jace/source/showinf.cpp

    r4700 r4760  
    2525#include "jace/proxy/java/lang/String.h" 
    2626#include "jace/proxy/java/io/IOException.h" 
    27 #include "jace/proxy/loci/formats/FormatException.h" 
    28 #include "jace/proxy/loci/formats/ImageReader.h" 
    29 #include "jace/proxy/loci/formats/tools/ImageInfo.h" 
    3027 
    3128using namespace jace::proxy::java::lang; 
    3229using namespace jace::proxy::java::io; 
     30 
     31// TEMP - eventually want to automatically generate this list 
     32#include "jace/proxy/loci/formats/AWTImageTools.h" 
     33#include "jace/proxy/loci/formats/AxisGuesser.h" 
     34#include "jace/proxy/loci/formats/ChannelFiller.h" 
     35#include "jace/proxy/loci/formats/ChannelMerger.h" 
     36#include "jace/proxy/loci/formats/ChannelSeparator.h" 
     37#include "jace/proxy/loci/formats/ClassList.h" 
     38#include "jace/proxy/loci/formats/CoreMetadata.h" 
     39#include "jace/proxy/loci/formats/DimensionSwapper.h" 
     40#include "jace/proxy/loci/formats/FilePattern.h" 
     41#include "jace/proxy/loci/formats/FileStitcher.h" 
     42#include "jace/proxy/loci/formats/FormatException.h" 
     43#include "jace/proxy/loci/formats/FormatHandler.h" 
     44#include "jace/proxy/loci/formats/FormatReader.h" 
     45#include "jace/proxy/loci/formats/FormatTools.h" 
     46#include "jace/proxy/loci/formats/FormatWriter.h" 
     47#include "jace/proxy/loci/formats/IFormatHandler.h" 
     48#include "jace/proxy/loci/formats/IFormatReader.h" 
     49#include "jace/proxy/loci/formats/IFormatWriter.h" 
     50#include "jace/proxy/loci/formats/ImageReader.h" 
     51#include "jace/proxy/loci/formats/ImageTools.h" 
     52#include "jace/proxy/loci/formats/ImageWriter.h" 
     53#include "jace/proxy/loci/formats/Index16ColorModel.h" 
     54#include "jace/proxy/loci/formats/LegacyQTTools.h" 
     55#include "jace/proxy/loci/formats/MetadataTools.h" 
     56#include "jace/proxy/loci/formats/MinMaxCalculator.h" 
     57#include "jace/proxy/loci/formats/NetcdfTools.h" 
     58#include "jace/proxy/loci/formats/NumberFilter.h" 
     59#include "jace/proxy/loci/formats/POITools.h" 
     60#include "jace/proxy/loci/formats/ReaderWrapper.h" 
     61#include "jace/proxy/loci/formats/SignedColorModel.h" 
     62#include "jace/proxy/loci/formats/StatusEvent.h" 
     63#include "jace/proxy/loci/formats/StatusListener.h" 
     64#include "jace/proxy/loci/formats/StatusReporter.h" 
     65#include "jace/proxy/loci/formats/TiffIFDEntry.h" 
     66#include "jace/proxy/loci/formats/TiffRational.h" 
     67#include "jace/proxy/loci/formats/TiffTools.h" 
     68#include "jace/proxy/loci/formats/TwoChannelColorSpace.h" 
     69#include "jace/proxy/loci/formats/UnknownTagException.h" 
     70#include "jace/proxy/loci/formats/XMLTools.h" 
     71#include "jace/proxy/loci/formats/cache/BufferedImageSource.h" 
     72#include "jace/proxy/loci/formats/cache/ByteArraySource.h" 
     73#include "jace/proxy/loci/formats/cache/CacheConsole.h" 
     74#include "jace/proxy/loci/formats/cache/CacheEvent.h" 
     75#include "jace/proxy/loci/formats/cache/CacheException.h" 
     76#include "jace/proxy/loci/formats/cache/Cache.h" 
     77#include "jace/proxy/loci/formats/cache/CacheListener.h" 
     78#include "jace/proxy/loci/formats/cache/CacheReporter.h" 
     79#include "jace/proxy/loci/formats/cache/CacheSource.h" 
     80#include "jace/proxy/loci/formats/cache/CacheStrategy.h" 
     81#include "jace/proxy/loci/formats/cache/CacheUpdater.h" 
     82#include "jace/proxy/loci/formats/cache/CrosshairStrategy.h" 
     83#include "jace/proxy/loci/formats/cache/ICacheSource.h" 
     84#include "jace/proxy/loci/formats/cache/ICacheStrategy.h" 
     85#include "jace/proxy/loci/formats/cache/RectangleStrategy.h" 
     86#include "jace/proxy/loci/formats/codec/Base64Codec.h" 
     87#include "jace/proxy/loci/formats/codec/BaseCodec.h" 
     88#include "jace/proxy/loci/formats/codec/BitBuffer.h" 
     89#include "jace/proxy/loci/formats/codec/BitWriter.h" 
     90#include "jace/proxy/loci/formats/codec/ByteVector.h" 
     91#include "jace/proxy/loci/formats/codec/Codec.h" 
     92#include "jace/proxy/loci/formats/codec/CodecOptions.h" 
     93#include "jace/proxy/loci/formats/codec/JPEG2000Codec.h" 
     94#include "jace/proxy/loci/formats/codec/JPEGCodec.h" 
     95#include "jace/proxy/loci/formats/codec/LuraWaveCodec.h" 
     96#include "jace/proxy/loci/formats/codec/LZOCodec.h" 
     97#include "jace/proxy/loci/formats/codec/LZWCodec.h" 
     98#include "jace/proxy/loci/formats/codec/MJPBCodec.h" 
     99#include "jace/proxy/loci/formats/codec/MJPBCodecOptions.h" 
     100#include "jace/proxy/loci/formats/codec/MSRLECodec.h" 
     101#include "jace/proxy/loci/formats/codec/MSVideoCodec.h" 
     102#include "jace/proxy/loci/formats/codec/NikonCodec.h" 
     103#include "jace/proxy/loci/formats/codec/NikonCodecOptions.h" 
     104#include "jace/proxy/loci/formats/codec/PackbitsCodec.h" 
     105#include "jace/proxy/loci/formats/codec/QTRLECodec.h" 
     106#include "jace/proxy/loci/formats/codec/RPZACodec.h" 
     107#include "jace/proxy/loci/formats/codec/ZlibCodec.h" 
     108#include "jace/proxy/loci/formats/gui/CacheComponent.h" 
     109#include "jace/proxy/loci/formats/gui/CacheIndicator.h" 
     110#include "jace/proxy/loci/formats/gui/ComboFileFilter.h" 
     111#include "jace/proxy/loci/formats/gui/DataConverter.h" 
     112#include "jace/proxy/loci/formats/gui/ExtensionFileFilter.h" 
     113#include "jace/proxy/loci/formats/gui/FormatFileFilter.h" 
     114#include "jace/proxy/loci/formats/gui/GUITools.h" 
     115#include "jace/proxy/loci/formats/gui/ImageViewer.h" 
     116#include "jace/proxy/loci/formats/gui/NoExtensionFileFilter.h" 
     117#include "jace/proxy/loci/formats/gui/PreviewPane.h" 
     118#include "jace/proxy/loci/formats/gui/XMLCellRenderer.h" 
     119#include "jace/proxy/loci/formats/gui/XMLWindow.h" 
     120#include "jace/proxy/loci/formats/in/AliconaReader.h" 
     121#include "jace/proxy/loci/formats/in/APLReader.h" 
     122#include "jace/proxy/loci/formats/in/APNGReader.h" 
     123#include "jace/proxy/loci/formats/in/AVIReader.h" 
     124#include "jace/proxy/loci/formats/in/BaseTiffReader.h" 
     125#include "jace/proxy/loci/formats/in/BioRadReader.h" 
     126#include "jace/proxy/loci/formats/in/BMPReader.h" 
     127#include "jace/proxy/loci/formats/in/DeltavisionReader.h" 
     128#include "jace/proxy/loci/formats/in/DicomReader.h" 
     129#include "jace/proxy/loci/formats/in/EPSReader.h" 
     130#include "jace/proxy/loci/formats/in/FEIReader.h" 
     131#include "jace/proxy/loci/formats/in/FitsReader.h" 
     132#include "jace/proxy/loci/formats/in/FlexReader.h" 
     133#include "jace/proxy/loci/formats/in/FluoviewReader.h" 
     134#include "jace/proxy/loci/formats/in/FV1000Reader.h" 
     135#include "jace/proxy/loci/formats/in/GatanReader.h" 
     136#include "jace/proxy/loci/formats/in/GelReader.h" 
     137#include "jace/proxy/loci/formats/in/GIFReader.h" 
     138#include "jace/proxy/loci/formats/in/ICSReader.h" 
     139#include "jace/proxy/loci/formats/in/ImageIOReader.h" 
     140#include "jace/proxy/loci/formats/in/ImarisHDFReader.h" 
     141#include "jace/proxy/loci/formats/in/ImarisReader.h" 
     142#include "jace/proxy/loci/formats/in/ImarisTiffReader.h" 
     143#include "jace/proxy/loci/formats/in/ImprovisionTiffReader.h" 
     144#include "jace/proxy/loci/formats/in/InCellReader.h" 
     145#include "jace/proxy/loci/formats/in/IPLabReader.h" 
     146#include "jace/proxy/loci/formats/in/IPWReader.h" 
     147#include "jace/proxy/loci/formats/in/JPEGReader.h" 
     148#include "jace/proxy/loci/formats/in/KhorosReader.h" 
     149#include "jace/proxy/loci/formats/in/L2DReader.h" 
     150#include "jace/proxy/loci/formats/in/LegacyND2Reader.h" 
     151#include "jace/proxy/loci/formats/in/LegacyQTReader.h" 
     152#include "jace/proxy/loci/formats/in/LeicaHandler.h" 
     153#include "jace/proxy/loci/formats/in/LeicaReader.h" 
     154#include "jace/proxy/loci/formats/in/LIFReader.h" 
     155#include "jace/proxy/loci/formats/in/LIMReader.h" 
     156#include "jace/proxy/loci/formats/in/MDBParser.h" 
     157#include "jace/proxy/loci/formats/in/MetamorphHandler.h" 
     158#include "jace/proxy/loci/formats/in/MetamorphReader.h" 
     159#include "jace/proxy/loci/formats/in/MetamorphTiffReader.h" 
     160#include "jace/proxy/loci/formats/in/MicromanagerReader.h" 
     161#include "jace/proxy/loci/formats/in/MINCReader.h" 
     162#include "jace/proxy/loci/formats/in/MinimalTiffReader.h" 
     163#include "jace/proxy/loci/formats/in/MNGReader.h" 
     164#include "jace/proxy/loci/formats/in/MRCReader.h" 
     165#include "jace/proxy/loci/formats/in/MRWReader.h" 
     166#include "jace/proxy/loci/formats/in/NAFReader.h" 
     167#include "jace/proxy/loci/formats/in/ND2Reader.h" 
     168#include "jace/proxy/loci/formats/in/NikonReader.h" 
     169#include "jace/proxy/loci/formats/in/NRRDReader.h" 
     170#include "jace/proxy/loci/formats/in/OMETiffReader.h" 
     171#include "jace/proxy/loci/formats/in/OMEXMLReader.h" 
     172#include "jace/proxy/loci/formats/in/OpenlabRawReader.h" 
     173#include "jace/proxy/loci/formats/in/OpenlabReader.h" 
     174#include "jace/proxy/loci/formats/in/PCIReader.h" 
     175#include "jace/proxy/loci/formats/in/PCXReader.h" 
     176#include "jace/proxy/loci/formats/in/PerkinElmerReader.h" 
     177#include "jace/proxy/loci/formats/in/PGMReader.h" 
     178#include "jace/proxy/loci/formats/in/PictReader.h" 
     179#include "jace/proxy/loci/formats/in/PrairieReader.h" 
     180#include "jace/proxy/loci/formats/in/PSDReader.h" 
     181#include "jace/proxy/loci/formats/in/QTReader.h" 
     182#include "jace/proxy/loci/formats/in/SDTInfo.h" 
     183#include "jace/proxy/loci/formats/in/SDTReader.h" 
     184#include "jace/proxy/loci/formats/in/SEQReader.h" 
     185#include "jace/proxy/loci/formats/in/SlidebookReader.h" 
     186#include "jace/proxy/loci/formats/in/SVSReader.h" 
     187#include "jace/proxy/loci/formats/in/TCSReader.h" 
     188#include "jace/proxy/loci/formats/in/TiffReader.h" 
     189#include "jace/proxy/loci/formats/in/TillVisionReader.h" 
     190#include "jace/proxy/loci/formats/in/VisitechReader.h" 
     191#include "jace/proxy/loci/formats/in/ZeissLSMReader.h" 
     192#include "jace/proxy/loci/formats/in/ZeissZVIReader.h" 
     193#include "jace/proxy/loci/formats/meta/AggregateMetadata.h" 
     194#include "jace/proxy/loci/formats/meta/DummyMetadata.h" 
     195#include "jace/proxy/loci/formats/meta/FilterMetadata.h" 
     196#include "jace/proxy/loci/formats/meta/IMetadata.h" 
     197#include "jace/proxy/loci/formats/meta/IMinMaxStore.h" 
     198#include "jace/proxy/loci/formats/meta/MetadataConverter.h" 
     199#include "jace/proxy/loci/formats/meta/MetadataRetrieve.h" 
     200#include "jace/proxy/loci/formats/meta/MetadataStore.h" 
     201#include "jace/proxy/loci/formats/ome/OmeisException.h" 
     202#include "jace/proxy/loci/formats/ome/OmeisImporter.h" 
     203#include "jace/proxy/loci/formats/ome/OMEXML2003FCMetadata.h" 
     204#include "jace/proxy/loci/formats/ome/OMEXML200706Metadata.h" 
     205#include "jace/proxy/loci/formats/ome/OMEXML200802Metadata.h" 
     206#include "jace/proxy/loci/formats/ome/OMEXML200809Metadata.h" 
     207#include "jace/proxy/loci/formats/ome/OMEXMLMetadata.h" 
     208#include "jace/proxy/loci/formats/out/APNGWriter.h" 
     209#include "jace/proxy/loci/formats/out/AVIWriter.h" 
     210#include "jace/proxy/loci/formats/out/EPSWriter.h" 
     211#include "jace/proxy/loci/formats/out/ICSWriter.h" 
     212#include "jace/proxy/loci/formats/out/ImageIOWriter.h" 
     213#include "jace/proxy/loci/formats/out/JPEG2000Writer.h" 
     214#include "jace/proxy/loci/formats/out/JPEGWriter.h" 
     215#include "jace/proxy/loci/formats/out/LegacyQTWriter.h" 
     216#include "jace/proxy/loci/formats/out/OMETiffWriter.h" 
     217#include "jace/proxy/loci/formats/out/OMEXMLWriter.h" 
     218#include "jace/proxy/loci/formats/out/QTWriter.h" 
     219#include "jace/proxy/loci/formats/out/TiffWriter.h" 
     220#include "jace/proxy/loci/formats/tools/EditTiffG.h" 
     221#include "jace/proxy/loci/formats/tools/ImageConverter.h" 
     222#include "jace/proxy/loci/formats/tools/ImageInfo.h" 
     223#include "jace/proxy/loci/formats/tools/TiffComment.h" 
     224#include "jace/proxy/loci/formats/tools/XMLIndent.h" 
     225#include "jace/proxy/loci/formats/tools/XMLValidate.h" 
    33226using namespace jace::proxy::loci::formats; 
     227using namespace jace::proxy::loci::formats::cache; 
     228using namespace jace::proxy::loci::formats::codec; 
     229using namespace jace::proxy::loci::formats::gui; 
     230using namespace jace::proxy::loci::formats::in; 
     231using namespace jace::proxy::loci::formats::meta; 
     232using namespace jace::proxy::loci::formats::ome; 
     233using namespace jace::proxy::loci::formats::out; 
    34234using namespace jace::proxy::loci::formats::tools; 
    35235 
     
    53253    list.push_back(jace::CustomOption("-Xcheck:jni")); 
    54254    list.push_back(jace::CustomOption("-Xmx256m")); 
     255    list.push_back(jace::CustomOption("-verbose:jni")); 
    55256    jace::helper::createVm(loader, list, false); 
    56257    cout << "JVM created." << endl; 
     
    59260    for (int i=0; i<argc; i++) cout << "\t#" << i << ": " << argv[i] << endl; 
    60261 
    61     //typedef JArray<String> StringArray; 
    62     //StringArray args(argc - 1); 
    63     //for (int i=1; i<argc; i++) args[i - 1] = argv[i]; 
    64     //JBoolean result = ImageInfo::testRead(args); 
     262    typedef JArray<String> StringArray; 
     263    StringArray args(argc - 1); 
     264    for (int i=1; i<argc; i++) args[i - 1] = argv[i]; 
     265    JBoolean result = ImageInfo::testRead(args); 
    65266 
    66267    if (argc < 2) { 
Note: See TracChangeset for help on using the changeset viewer.