Aria  2.8.0
ArArg Class Reference

Argument class, mostly for actions, could be used for other things. More...

#include <ArArg.h>

Public Types

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

Public Member Functions

 ArArg ()
 Default empty contructor.
 
 ArArg (const char *name, int *pointer, const char *description="", int minInt=INT_MIN, int maxInt=INT_MAX)
 Constructor for making an integer argument.
 
 ArArg (const char *name, double *pointer, const char *description="", double minDouble=-HUGE_VAL, double maxDouble=HUGE_VAL)
 Constructor for making a double argument.
 
 ArArg (const char *name, bool *pointer, const char *description="")
 Constructor for making a boolean argument.
 
 ArArg (const char *name, ArPose *pointer, const char *description="")
 Constructor for making a position argument.
 
 ArArg (const char *name, char *pointer, const char *description, size_t maxStrLen)
 Constructor for making an argument of a string.
 
 ArArg (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. More...
 
 ArArg (const char *description)
 Constructor for just holding a description (for ArConfig)
 
 ArArg (const ArArg &arg)
 Copy constructor.
 
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) More...
 
bool getConfigPrioritySet (void) const
 Gets if the config priority is set. More...
 
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.
 
ArPose getPose (void) const
 Gets the argument value, for pose arguments.
 
const char * getString (void) const
 Gets the argument value, for string arguments.
 
Type getType (void) const
 Gets the type of the argument. More...
 
void log (void) const
 Logs the type, name, and value of this argument.
 
ArArgoperator= (const ArArg &arg)
 Assignment operator.
 
bool setArgWithFunctor (ArArgumentBuilder *argument)
 Sets the argument by calling the setFunctor callback.
 
bool setBool (bool val)
 Sets the argument value, for bool arguments.
 
void setConfigPriority (ArPriority::Priority priority)
 Sets the priority (only used by ArConfig) More...
 
bool setDouble (double val)
 Sets the argument value, for double arguments.
 
bool setInt (int val)
 Sets the argument value, for int arguments.
 
bool setPose (ArPose pose)
 Sets the argument value, for ArPose arguments.
 
bool setString (const char *str)
 Sets the argument value for ArArgumentBuilder arguments.
 
virtual ~ArArg ()
 Destructor.
 

Protected Attributes

bool * myBoolPointer
 
ArPriority::Priority myConfigPriority
 
bool myConfigPrioritySet
 
std::string myDescription
 
double * myDoublePointer
 
ArRetFunctor< const std::list< ArArgumentBuilder * > * > * myGetFunctor
 
int * myIntPointer
 
double myMaxDouble
 
int myMaxInt
 
size_t myMaxStrLen
 
double myMinDouble
 
int myMinInt
 
std::string myName
 
ArPosemyPosePointer
 
ArRetFunctor1< bool, ArArgumentBuilder * > * mySetFunctor
 
char * myStringPointer
 
ArArg::Type myType
 

Detailed Description

Argument class, mostly for actions, could be used for other things.

This is designed to be easy to add another type to the arguments... All you have to do to do so, is add an enum to the Type enum, add a newType getNewType(void), add a void setNewType(newType nt), and add a case statement for the newType to ArArg::print. You should probably also add an

See also
newType to the documentation for ArArg::getType.
Examples:
actionExample.cpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
TYPE_COUNT 

Number of argument types.

◆ Type

Enumerator
INVALID 

An invalid argument, the argument wasn't created correctly.

INT 

Integer argument.

DOUBLE 

Double argument.

STRING 

String argument.

BOOL 

Boolean argument.

POSE 

ArPose argument.

FUNCTOR 

Argument that handles things with functors.

DESCRIPTION_HOLDER 

Argument that just holds a description.

LAST_TYPE 

Last value in the enumeration.

Constructor & Destructor Documentation

◆ ArArg()

ArArg::ArArg ( 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 value per name, such as the sonar in a config file, and where this data needs to be used to construct compound data structures rather than single variables.

Parameters
nameargument name
descriptionargument description
setFunctorwhen an argument is read it is passed to this functor which should set up whatever it needs to from the data
getFunctorsince parameter files need to be written too, this get functor will get a list of strings to be written to the file

Member Function Documentation

◆ getConfigPriority()

ArPriority::Priority ArArg::getConfigPriority ( void  ) const

Gets the priority (only used by ArConfig)

The priority of this argument when used in ArConfig.

◆ getConfigPrioritySet()

bool ArArg::getConfigPrioritySet ( void  ) const

Gets if the config priority is set.

If this is true then the config priority is set and you can use getConfigPriority.

◆ getType()

ArArg::Type ArArg::getType ( void  ) const

Gets the type of the argument.

See also
INVALID
INT
DOUBLE
BOOL
POSE

◆ setConfigPriority()

void ArArg::setConfigPriority ( ArPriority::Priority  priority)

Sets the priority (only used by ArConfig)

The priority of this argument when used in ArConfig.


The documentation for this class was generated from the following files: