jcuda.utils
Class CommandLine

java.lang.Object
  extended by jcuda.utils.CommandLine

public class CommandLine
extends java.lang.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 Summary
static boolean checkCommandLineFlag(java.lang.String[] argv, java.lang.String flagName)
          Returns whether the given command line arguments contain an argument with the given name (the name must be given without the "--" prefix);
static float getCommandLineArgumentFloat(java.lang.String[] argv, java.lang.String argName, float defaultValue)
          Returns the value of the command line argument with the given name as a float.
static int getCommandLineArgumentInt(java.lang.String[] argv, java.lang.String argName, int defaultValue)
          Returns the value of the command line argument with the given name as an int.
static java.util.List<java.lang.String> getCommandLineArgumentListString(java.lang.String[] argv, java.lang.String argName)
          Returns the value of the command line argument with the given name as a list of strings.
static java.lang.String getCommandLineArgumentString(java.lang.String[] argv, java.lang.String argName)
          Returns the value of the command line argument with the given name as a String.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

checkCommandLineFlag

public static boolean checkCommandLineFlag(java.lang.String[] argv,
                                           java.lang.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(java.lang.String[] argv,
                                            java.lang.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:
java.lang.IllegalArgumentException - If the given argument has no appropriate value

getCommandLineArgumentFloat

public static float getCommandLineArgumentFloat(java.lang.String[] argv,
                                                java.lang.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:
java.lang.IllegalArgumentException - If the given argument has no appropriate value

getCommandLineArgumentString

public static java.lang.String getCommandLineArgumentString(java.lang.String[] argv,
                                                            java.lang.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 java.util.List<java.lang.String> getCommandLineArgumentListString(java.lang.String[] argv,
                                                                                java.lang.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:
java.lang.IllegalArgumentException - If the given argument has no appropriate value