root/ompi/mpi/java/java/Info.java

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. create
  2. newEnv
  3. getEnv
  4. getNull
  5. set
  6. set
  7. get
  8. get
  9. delete
  10. delete
  11. size
  12. size
  13. getKey
  14. getKey
  15. clone
  16. dup
  17. dup
  18. free
  19. free
  20. isNull
  21. isNull

   1 /*
   2  * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
   3  *                         University Research and Technology
   4  *                         Corporation.  All rights reserved.
   5  * Copyright (c) 2004-2005 The University of Tennessee and The University
   6  *                         of Tennessee Research Foundation.  All rights
   7  *                         reserved.
   8  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
   9  *                         University of Stuttgart.  All rights reserved.
  10  * Copyright (c) 2004-2005 The Regents of the University of California.
  11  *                         All rights reserved.
  12  * Copyright (c) 2015      Los Alamos National Security, LLC. All rights
  13  *                         reserved.
  14  * Copyright (c) 2018      FUJITSU LIMITED.  All rights reserved.
  15  * $COPYRIGHT$
  16  *
  17  * Additional copyrights may follow
  18  *
  19  * $HEADER$
  20  */
  21 
  22 package mpi;
  23 
  24 /**
  25  * This class represents {@code MPI_Info}.
  26  */
  27 public final class Info implements Freeable, Cloneable
  28 {
  29         protected long handle;
  30         protected static final long NULL = getNull();
  31 
  32         /**
  33          * Java binding of the MPI operation {@code MPI_INFO_CREATE}.
  34          * @throws MPIException Signals that an MPI exception of some sort has occurred.
  35          */
  36         public Info() throws MPIException
  37         {
  38                 MPI.check();
  39                 handle = create();
  40         }
  41 
  42         protected Info(long handle)
  43         {
  44                 this.handle = handle;
  45         }
  46 
  47         private native long create();
  48 
  49         protected static Info newEnv()
  50         {
  51                 return new Info(getEnv());
  52         }
  53 
  54         private native static long getEnv();
  55         private native static long getNull();
  56 
  57         /**
  58          * Java binding of the MPI operation {@code MPI_INFO_SET}.
  59          * @param key   key
  60          * @param value value
  61          * @throws MPIException Signals that an MPI exception of some sort has occurred.
  62          */
  63         public void set(String key, String value) throws MPIException
  64         {
  65                 MPI.check();
  66                 set(handle, key, value);
  67         }
  68 
  69         private native void set(long handle, String key, String value)
  70                         throws MPIException;
  71 
  72         /**
  73          * Java binding of the MPI operation {@code MPI_INFO_GET}.
  74          * @param key key
  75          * @return value or {@code null} if key is not defined
  76          * @throws MPIException Signals that an MPI exception of some sort has occurred.
  77          */
  78         public String get(String key) throws MPIException
  79         {
  80                 MPI.check();
  81                 return get(handle, key);
  82         }
  83 
  84         private native String get(long handle, String key) throws MPIException;
  85 
  86         /**
  87          * Java binding of the MPI operation {@code MPI_INFO_DELETE}.
  88          * @param key key
  89          * @throws MPIException Signals that an MPI exception of some sort has occurred.
  90          */
  91         public void delete(String key) throws MPIException
  92         {
  93                 MPI.check();
  94                 delete(handle, key);
  95         }
  96 
  97         private native void delete(long handle, String key) throws MPIException;
  98 
  99         /**
 100          * Java binding of the MPI operation {@code MPI_INFO_GET_NKEYS}.
 101          * @return number of defined keys
 102          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 103          */
 104         public int size() throws MPIException
 105         {
 106                 MPI.check();
 107                 return size(handle);
 108         }
 109 
 110         private native int size(long handle) throws MPIException;
 111 
 112         /**
 113          * Java binding of the MPI operation {@code MPI_INFO_GET_NTHKEY}.
 114          * @param i key number
 115          * @return key
 116          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 117          */
 118         public String getKey(int i) throws MPIException
 119         {
 120                 MPI.check();
 121                 return getKey(handle, i);
 122         }
 123 
 124         private native String getKey(long handle, int i) throws MPIException;
 125 
 126         /**
 127          * Java binding of the MPI operation {@code MPI_INFO_DUP}.
 128          * <p>It is recommended to use {@link #dup} instead of {@link #clone}
 129          * because the last can't throw an {@link mpi.MPIException}.
 130          * @return info object
 131          */
 132         @Override public Info clone()
 133         {
 134                 try
 135                 {
 136                         return dup();
 137                 }
 138                 catch(MPIException e)
 139                 {
 140                         throw new RuntimeException(e.getMessage());
 141                 }
 142         }
 143 
 144         /**
 145          * Java binding of the MPI operation {@code MPI_INFO_DUP}.
 146          * @return info object
 147          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 148          */
 149         public Info dup() throws MPIException
 150         {
 151                 MPI.check();
 152                 return new Info(dup(handle));
 153         }
 154 
 155         private native long dup(long handle) throws MPIException;
 156 
 157         /**
 158          * Java binding of the MPI operation {@code MPI_INFO_FREE}.
 159          * @throws MPIException Signals that an MPI exception of some sort has occurred.
 160          */
 161         @Override public void free() throws MPIException
 162         {
 163                 MPI.check();
 164                 handle = free(handle);
 165         }
 166 
 167         private native long free(long handle) throws MPIException;
 168 
 169         /**
 170          * Tests if the info object is {@code MPI_INFO_NULL} (has been freed).
 171          * @return true if the info object is {@code MPI_INFO_NULL}, false otherwise.
 172          */
 173         public boolean isNull()
 174         {
 175                 return isNull(handle);
 176         }
 177 
 178         private native boolean isNull(long handle);
 179 
 180 } // Info

/* [<][>][^][v][top][bottom][index][help] */