Class ProgramOptions


  • public class ProgramOptions
    extends java.lang.Object
    a class for parsing program command line into a PropertyMap
    • Constructor Detail

      • ProgramOptions

        public ProgramOptions​(long cPtr,
                              boolean cMemoryOwn)
      • ProgramOptions

        public ProgramOptions​(java.lang.String applicationName,
                              java.lang.String version)
        Construct new set of program options.
        Parameters:
        applicationName - [in] the name of the application.
        version - [in] the version of the application.
    • Method Detail

      • delete

        public void delete()
      • initOptions

        public void initOptions()
        this initialize default options that can add simple properties to the propertymap.
      • addStringOption

        public void addStringOption​(java.lang.String name,
                                    java.lang.String defval,
                                    java.lang.String desc)
        add a string option that is only allowed to occur once on the command line
        Parameters:
        name - [in] name of option
        defval - [in] the default string value if any
        desc - [in] description of commandline option
      • addBoolOption

        public void addBoolOption​(java.lang.String name,
                                  boolean defval,
                                  java.lang.String desc)
        add a bool option that is only allowed to occur once on the command line
        Parameters:
        name - [in] name of option
        defval - [in] the default value when arg not present
        desc - [in] description of commandline option
      • setPositionalOption

        public void setPositionalOption​(java.lang.String name,
                                        int i)
        Set name of option number i.
        Parameters:
        name - [in] the name.
        i - [in] index of the option.
      • parse

        public int parse​(int argc,
                         SWIGTYPE_p_p_char argv)
        parses input, if
        Parameters:
        argc -
        argv -
        Returns:
        if 0 is returned then help or an error
      • parse

        public int parse​(java.lang.String string)
        Parses input from a string.
        Parameters:
        string - [in] input line.
        Returns:
        0 if success.
      • getPropertyMap

        public PropertyMap getPropertyMap()
        Get parsed properties in RobWork format in the form of a PropertyMap.
        Returns:
        the property map with parsed options.