Class CommandLine

java.lang.Object
jcuda.utils.CommandLine

public class CommandLine extends Object
Command line argument utility functions, similar to the CUTIL functions.

All command line arguments begin with '--' followed by the token. The token and value are separated by '='.
Example:
--samples=50
Arrays have the form
--model=[one.obj,two.obj,three.obj] (without whitespaces)
  • Method Details

    • checkCommandLineFlag

      public static boolean checkCommandLineFlag(String[] argv, String flagName)
      Returns whether the given command line arguments contain an argument with the given name (the name must be given without the "--" prefix);
      Parameters:
      argv - The arguments
      flagName - The argument to look for
      Returns:
      Whether the argument is found
    • getCommandLineArgumentInt

      public static int getCommandLineArgumentInt(String[] argv, String argName, int defaultValue)
      Returns the value of the command line argument with the given name as an int.
      Parameters:
      argv - The arguments
      argName - The name of the argument
      defaultValue - The default value to use of no value was given
      Returns:
      The value of the argument
      Throws:
      IllegalArgumentException - If the given argument has no appropriate value
    • getCommandLineArgumentFloat

      public static float getCommandLineArgumentFloat(String[] argv, String argName, float defaultValue)
      Returns the value of the command line argument with the given name as a float.
      Parameters:
      argv - The arguments
      argName - The name of the argument
      defaultValue - The default value to use of no value was given
      Returns:
      The value of the argument
      Throws:
      IllegalArgumentException - If the given argument has no appropriate value
    • getCommandLineArgumentString

      public static String getCommandLineArgumentString(String[] argv, String argName)
      Returns the value of the command line argument with the given name as a String.
      Parameters:
      argv - The arguments
      argName - The name of the argument
      Returns:
      The value of the argument
    • getCommandLineArgumentListString

      public static List<String> getCommandLineArgumentListString(String[] argv, String argName)
      Returns the value of the command line argument with the given name as a list of strings.
      Parameters:
      argv - The arguments
      argName - The name of the argument
      Returns:
      The value of the argument
      Throws:
      IllegalArgumentException - If the given argument has no appropriate value