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

ArConfigArg Class Reference

Argument class for ArConfig. More...

#include <ArConfigArg.h>

List of all members.

Public Types

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

Public Member Functions

 ArConfigArg (const ArConfigArg &arg)
 Copy constructor.
 ArConfigArg (const char *description)
 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.
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.
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.
Type getType (void) const
 Gets the type of the argument.
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).
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 whehter 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.
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
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


Detailed Description

Argument class for ArConfig.

Definition at line 40 of file ArConfigArg.h.


Member Enumeration Documentation

anonymous enum
 

Enumeration values:
TYPE_COUNT  Number of argument types.

Definition at line 56 of file ArConfigArg.h.

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).

Definition at line 177 of file ArConfigArg.h.

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.
LAST_TYPE  Last value in the enumeration.

Definition at line 43 of file ArConfigArg.h.


Constructor & Destructor Documentation

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 one is tricky because it needs to handle both the pointer case and value case which is the same for strings... and so if the maxStrLen is given as 0 here then the ArConfigArg class will assume it owns the string and use its own memory for it.

Definition at line 162 of file ArConfigArg.cpp.

References STRING.

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:
setFunctor when an argument is read it is passed to this functor which should set up whatever it needs to from the data
getFunctor since parameter files need to be written too, this get functor will get a list of strings to be written to the file

Definition at line 193 of file ArConfigArg.cpp.

References FUNCTOR.


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.

Definition at line 672 of file ArConfigArg.cpp.

Referenced by ArConfig::writeFile().

ArConfigArg::Type ArConfigArg::getType void   )  const
 

Gets the type of the argument.

See also:
INVALID

INT

DOUBLE

BOOL

POSE

Definition at line 353 of file ArConfigArg.cpp.

Referenced by log(), ArConfig::parseArgument(), and ArConfig::writeFile().

void ArConfigArg::setConfigPriority ArPriority::Priority  priority  ) 
 

Sets the priority (only used by ArConfig).

The priority of this argument when used in ArConfig.

Definition at line 681 of file ArConfigArg.cpp.

void ArConfigArg::setIgnoreBounds bool  ignoreBounds = false  ) 
 

Sets whehter 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

Definition at line 690 of file ArConfigArg.cpp.


The documentation for this class was generated from the following files:
Generated on Wed Oct 19 12:56:43 2005 for Aria by  doxygen 1.4.0