Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

ArConfigArg Class Reference

#include <ArConfigArg.h>

List of all members.


Detailed Description

Argument class for ArConfig.

Java and Python Wrappers: Swig cannot determine the correct constructor to use based on most target langugages types, so you must use subclasses defined for various types. Or, use the constructor that accepts functors for dealing with arguments. Also, Swig cannot use pointers to change variables, so you must create ArConfigArg objects, passing in default values, and retain references to those objects, in addition to passing them to ArConfig, and read new values from those objects if ArConfig changes; or pass functors to ArConfigArg instead of the initial value.

Examples:

configExample.cpp.


Public Types

enum  { TYPE_COUNT = LAST_TYPE + 1 }
enum  Type {
  INVALID, INT, DOUBLE, STRING,
  BOOL, FUNCTOR, DESCRIPTION_HOLDER, STRING_HOLDER,
  SEPARATOR, LAST_TYPE = SEPARATOR
}

Public Member Functions

 ArConfigArg (const ArConfigArg &arg)
 Copy constructor.
 ArConfigArg (Type type)
 Constructs a new argument of the specified type.
 ArConfigArg (const char *name, const char *str)
 Constructor for holding an unknown argument (STRING_HOLDER).
 ArConfigArg (const char *str, Type type=DESCRIPTION_HOLDER)
 Constructor for just holding a description (for ArConfig).
 ArConfigArg (const char *name, ArRetFunctor1< bool, ArArgumentBuilder * > *setFunctor, ArRetFunctor< const std::list< ArArgumentBuilder * > * > *getFunctor, const char *description)
 Constructor for making an argument that has functors to handle things.
 ArConfigArg (const char *name, bool val, const char *description="")
 Constructor for making a boolean argument.
 ArConfigArg (const char *name, double val, const char *description="", double minDouble=-HUGE_VAL, double maxDouble=HUGE_VAL)
 Constructor for making a double argument.
 ArConfigArg (const char *name, int val, const char *description="", int minInt=INT_MIN, int maxInt=INT_MAX)
 Constructor for making an integer argument.
 ArConfigArg (const char *name, char *str, const char *description, size_t maxStrLen)
 Constructor for making an argument of a string by pointer (see details).
 ArConfigArg (const char *name, bool *pointer, const char *description="")
 Constructor for making a boolean argument by pointer.
 ArConfigArg (const char *name, double *pointer, const char *description="", double minDouble=-HUGE_VAL, double maxDouble=HUGE_VAL)
 Constructor for making a double argument by pointer.
 ArConfigArg (const char *name, unsigned char *pointer, const char *description="", int minInt=0, int maxInt=255)
 Constructor for making an char (1 byte) argument by pointer (treated as int).
 ArConfigArg (const char *name, unsigned short *pointer, const char *description="", int minInt=0, int maxInt=USHRT_MAX)
 Constructor for making an int argument thats a ushort (2 bytes).
 ArConfigArg (const char *name, short *pointer, const char *description="", int minInt=SHRT_MIN, int maxInt=SHRT_MAX)
 Constructor for making an int argument thats a short (2 bytes).
 ArConfigArg (const char *name, int *pointer, const char *description="", int minInt=INT_MIN, int maxInt=INT_MAX)
 Constructor for making an integer argument by pointer (4 bytes).
 ArConfigArg ()
 Default empty contructor.
void clearValueSet (void)
 Tells the configArg that the value hasn't been set.
const std::list< ArArgumentBuilder * > * getArgsWithFunctor (void) const
 Gets the argument value, which is a list of argumentbuilders here.
bool getBool (void) const
 Gets the argument value, for bool arguments.
ArPriority::Priority getConfigPriority (void) const
 Gets the priority (only used by ArConfig).
const char * getDescription (void) const
 Gets the long description of the argument.
const char * getDisplayHint () const
 Returns the display hint for this arg, or NULL if none is defined.
double getDouble (void) const
 Gets the argument value, for double arguments.
int getInt (void) const
 Gets the argument value, for int arguments.
double getMaxDouble (void) const
 Gets the maximum double value.
int getMaxInt (void) const
 Gets the maximum int value.
double getMinDouble (void) const
 Gets the minimum double value.
int getMinInt (void) const
 Gets the minimum int value.
const char * getName (void) const
 Gets the name of the argument.
const char * getString (void) const
 Gets the argument value, for string arguments.
ArConfigArg::Type getType (void) const
 Gets the type of the argument.
bool isValueEqual (const ArConfigArg &other) const
 Checks only the name, type, and value attributes and returns whether they are equal.
bool isValueSet (void)
 Gets whether this value has been set since it was last cleared or not.
void log (bool verbose=false) const
 Logs the type, name, and value of this argument.
ArConfigArgoperator= (const ArConfigArg &arg)
 Assignment operator.
bool setArgWithFunctor (ArArgumentBuilder *argument, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false)
 Sets the argument by calling the setFunctor callback.
bool setBool (bool val, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false)
 Sets the argument value, for bool arguments.
void setConfigPriority (ArPriority::Priority priority)
 Sets the priority (only used by ArConfig).
void setDisplayHint (const char *hintText)
 Sets the display hint for this arg.
bool setDouble (double val, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false)
 Sets the argument value, for double arguments.
void setIgnoreBounds (bool ignoreBounds=false)
 Sets whether to ignore bounds or not (default is to not to.
bool setInt (int val, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false)
 Sets the argument value, for int arguments.
bool setString (const char *str, char *errorBuffer=NULL, size_t errorBufferLen=0, bool doNotSet=false)
 Sets the argument value for ArArgumentBuilder arguments.
bool setValue (const ArConfigArg &source)
 If the given source is of the same type, copies its value to this arg.
virtual ~ArConfigArg ()
 Destructor.

Protected Types

enum  IntType {
  INT_NOT, INT_INT, INT_SHORT, INT_UNSIGNED_SHORT,
  INT_UNSIGNED_CHAR
}

Protected Attributes

bool * myBoolPointer
ArPriority::Priority myConfigPriority
std::string myDescription
std::string myDisplayHint
double * myDoublePointer
ArRetFunctor< const std::list<
ArArgumentBuilder * > * > * 
myGetFunctor
bool myIgnoreBounds
int * myIntPointer
short * myIntShortPointer
ArConfigArg::IntType myIntType
unsigned char * myIntUnsignedCharPointer
unsigned short * myIntUnsignedShortPointer
double myMaxDouble
int myMaxInt
size_t myMaxStrLen
double myMinDouble
int myMinInt
std::string myName
bool myOwnPointedTo
ArRetFunctor1< bool, ArArgumentBuilder * > * mySetFunctor
std::string myString
char * myStringPointer
ArConfigArg::Type myType
bool myUsingOwnedString
bool myValueSet


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
TYPE_COUNT  Number of argument types.

enum ArConfigArg::IntType [protected]
 

Enumeration values:
INT_NOT  Not an int.
INT_INT  An int (4 bytes).
INT_SHORT  A short (2 bytes).
INT_UNSIGNED_SHORT  An unsigned short (2 bytes).
INT_UNSIGNED_CHAR  An unsigned char (1 byte).

enum ArConfigArg::Type
 

Enumeration values:
INVALID  An invalid argument, the argument wasn't created correctly.
INT  Integer argument.
DOUBLE  Double argument.
STRING  String argument.
BOOL  Boolean argument.
FUNCTOR  Argument that handles things with functors.
DESCRIPTION_HOLDER  Argument that just holds a description.
STRING_HOLDER  this one is for holding strings and reading them in and writing them out but not really letting them get sent anywhere (its for unknown config parameters (so they don't get lost if a feature is turned off)
SEPARATOR  Empty argument that merely acts as a separator within a (large) section.
LAST_TYPE  Last value in the enumeration.


Constructor & Destructor Documentation

ArConfigArg::ArConfigArg const char *  name,
int *  pointer,
const char *  description = "",
int  minInt = INT_MIN,
int  maxInt = INT_MAX
 

Constructor for making an integer argument by pointer (4 bytes).

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

ArConfigArg::ArConfigArg const char *  name,
short *  pointer,
const char *  description = "",
int  minInt = SHRT_MIN,
int  maxInt = SHRT_MAX
 

Constructor for making an int argument thats a short (2 bytes).

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

ArConfigArg::ArConfigArg const char *  name,
unsigned short *  pointer,
const char *  description = "",
int  minInt = 0,
int  maxInt = USHRT_MAX
 

Constructor for making an int argument thats a ushort (2 bytes).

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

ArConfigArg::ArConfigArg const char *  name,
unsigned char *  pointer,
const char *  description = "",
int  minInt = 0,
int  maxInt = 255
 

Constructor for making an char (1 byte) argument by pointer (treated as int).

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

ArConfigArg::ArConfigArg const char *  name,
double *  pointer,
const char *  description = "",
double  minDouble = -HUGE_VAL,
double  maxDouble = HUGE_VAL
 

Constructor for making a double argument by pointer.

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

ArConfigArg::ArConfigArg const char *  name,
bool *  pointer,
const char *  description = ""
 

Constructor for making a boolean argument by pointer.

Java and Python Wrappers: Not available in Java or Python wrapper libraries.

ArConfigArg::ArConfigArg const char *  name,
char *  str,
const char *  description,
size_t  maxStrLen
 

Constructor for making an argument of a string by pointer (see details).

This constructor can accept both an already-allocated string, or ArConfigArg can to the memory managment itself (reallocation and finally deletion). If maxStrLen is 0, then ArConfigArg will do its own memory management, with the contents of str copied as the initial value of the internally held string. Otherwise, str must point to an allocated string, with its size given by maxStrLen.

Warning:
The parameter name and value must not contain any characters with special meaning when saved and loaded from a config file, such as '#', ';', tab, or newline.

Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_String subclass instead (which has no maxStrLen parameter in its constructor)

ArConfigArg::ArConfigArg const char *  name,
int  val,
const char *  description = "",
int  minInt = INT_MIN,
int  maxInt = INT_MAX
 

Constructor for making an integer argument.

Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_Int subclass instead.

ArConfigArg::ArConfigArg const char *  name,
double  val,
const char *  description = "",
double  minDouble = -HUGE_VAL,
double  maxDouble = HUGE_VAL
 

Constructor for making a double argument.

Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_Double subclass instead.

ArConfigArg::ArConfigArg const char *  name,
bool  val,
const char *  description = ""
 

Constructor for making a boolean argument.

Java and Python Wrappers: Not available in Java or Python wrapper libraries. Use ArConfigArg_Bool subclass instead.

ArConfigArg::ArConfigArg const char *  name,
ArRetFunctor1< bool, ArArgumentBuilder * > *  setFunctor,
ArRetFunctor< const std::list< ArArgumentBuilder * > * > *  getFunctor,
const char *  description
 

Constructor for making an argument that has functors to handle things.

This constructor is for the functor type of argument, this is for cases that need to be complicated and have more than one argument per name... such as the sonar in a config file. Where this data needs to be used to construct internal data structures.

Parameters:
name Name of this argument
description Description of the purpose of this argument
setFunctor When an argument is read it is passed to this functor in an ArArgumentBuilder object. The functor should return false if there is an error or problem handling the argument, or true otherwise.
getFunctor Since configuration needs to be serialized to save files on disk or send data over the network etc., this functor will be called to get a list of strings to represent this argument and its value as text in the file etc.
Warning:
The parameter name and value must not contain any characters with special meaning when saved and loaded from a config file, such as '#', ';', tab, or newline.

ArConfigArg::ArConfigArg const char *  name,
const char *  str
 

Constructor for holding an unknown argument (STRING_HOLDER).

Warning:
The parameter name and value must not contain any characters with special meaning when saved and loaded from a config file, such as '#', ';', tab, or newline.

ArConfigArg::ArConfigArg Type  type  ) 
 

Constructs a new argument of the specified type.

This constructor is useful for creating separators within a config section.


Member Function Documentation

ArPriority::Priority ArConfigArg::getConfigPriority void   )  const
 

Gets the priority (only used by ArConfig).

The priority of this argument when used in ArConfig.

ArConfigArg::Type ArConfigArg::getType void   )  const
 

Gets the type of the argument.

See also:
INVALID

INT

DOUBLE

BOOL

POSE

void ArConfigArg::setConfigPriority ArPriority::Priority  priority  ) 
 

Sets the priority (only used by ArConfig).

The priority of this argument when used in ArConfig.

void ArConfigArg::setDisplayHint const char *  hintText  ) 
 

Sets the display hint for this arg.

The "display hint" is a text string that may be used by the client to improve the display of the argument. The following display hints are currently supported by MobileEyes and Mapper3.

For type STRING:

  • Choices:choice1(;;choice#i)*
    • For example, "Choices:North;;South;;East;;West"
  • MapItem:type|(Parent|SubType|SubTypeAndParent)|(Optional|Required)
    • For example, "MapItem:Dock|Parent|Optional"
  • Macro:taskClass1(;;taskClass#i)*|(Optional|Required)
    • For example, "Macro:Audio;;Camera;;Video|Optional"
  • Macro
    • When used with no qualifiers, there are no task class restrictions and the macro is optional

  • RobotFile:fileFilterNames|fileFilters
    • where:
      • fileFilterNames is a string that contains the complete displayable names for all of the file filters (e.g. Map files (*.map);;World files (*.wld)), or, empty if no filter needs to be applied, and
      • fileFilters is a string that contains just file extensions for each of the file filters (e.g. *.map;;*.wld"). The number and order of these filters must match that of the fileFilterNames parameter.
    • For example, "RobotFile:Map Files (*.map);;World Files (*.wld)|*.map;;*.wld"

For type INT:

  • Color

void ArConfigArg::setIgnoreBounds bool  ignoreBounds = false  ) 
 

Sets whether to ignore bounds or not (default is to not to.

This is for debugging and will prevent the bounds checking from happening, you shouldn't normally use it

bool ArConfigArg::setString const char *  str,
char *  errorBuffer = NULL,
size_t  errorBufferLen = 0,
bool  doNotSet = false
 

Sets the argument value for ArArgumentBuilder arguments.

Warning:
The value must not contain any characters with special meaning when saved and loaded from a config file, such as '#', ';', tab, or newline.

bool ArConfigArg::setValue const ArConfigArg source  ) 
 

If the given source is of the same type, copies its value to this arg.

Note that this method currently only works for the primitive arg types (i.e. int, bool, etc.). It doesn't copy functors or description holders.

Parameters:
source the ArConfigArg whose value is to be copied to this arg
Returns:
bool true if the value was copied; false if the source was of a different (or non-copyable) type


The documentation for this class was generated from the following files:
Generated on Thu Jan 7 10:34:41 2010 for Aria by  doxygen 1.4.2