00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef ARARG_H
00028 #define ARARG_H
00029
00030 #include "ariaTypedefs.h"
00031 #include "ariaUtil.h"
00032 #include "ArFunctor.h"
00033
00034 class ArArgumentBuilder;
00035
00037
00045 class ArArg
00046 {
00047 public:
00048 typedef enum
00049 {
00050 INVALID,
00051 INT,
00052 DOUBLE,
00053 STRING,
00054 BOOL,
00055 POSE,
00056 FUNCTOR,
00057 DESCRIPTION_HOLDER,
00058
00059 LAST_TYPE = DESCRIPTION_HOLDER
00060 } Type;
00061
00062
00063 enum {
00064 TYPE_COUNT = LAST_TYPE + 1
00065 };
00066
00068 ArArg();
00070 ArArg(const char * name, int *pointer,
00071 const char * description = "",
00072 int minInt = INT_MIN,
00073 int maxInt = INT_MAX);
00075 ArArg(const char * name, double *pointer,
00076 const char * description = "",
00077 double minDouble = -HUGE_VAL,
00078 double maxDouble = HUGE_VAL);
00080 ArArg(const char * name, bool *pointer,
00081 const char * description = "");
00083 ArArg(const char * name, ArPose *pointer,
00084 const char * description = "");
00086 ArArg(const char *name, char *pointer,
00087 const char *description,
00088 size_t maxStrLen);
00090 ArArg(const char *name,
00091 ArRetFunctor1<bool, ArArgumentBuilder *> *setFunctor,
00092 ArRetFunctor<const std::list<ArArgumentBuilder *> *> *getFunctor,
00093 const char *description);
00095 ArArg(const char *description);
00097 ArArg(const ArArg & arg);
00099 ArArg &operator=(const ArArg &arg);
00101 virtual ~ArArg();
00102
00104 Type getType(void) const;
00106 const char *getName(void) const;
00108 const char *getDescription(void) const;
00110 bool setInt(int val);
00112 bool setDouble(double val);
00114 bool setBool(bool val);
00116 bool setPose(ArPose pose);
00118 bool setString(const char *str);
00120 bool setArgWithFunctor(ArArgumentBuilder *argument);
00122 int getInt(void) const;
00124 double getDouble(void) const;
00126 bool getBool(void) const;
00128 ArPose getPose(void) const;
00130 const char *getString(void) const;
00132 const std::list<ArArgumentBuilder *> *getArgsWithFunctor(void) const;
00134 void log(void) const;
00136 int getMinInt(void) const;
00138 int getMaxInt(void) const;
00140 double getMinDouble(void) const;
00142 double getMaxDouble(void) const;
00144 bool getConfigPrioritySet(void) const;
00146 ArPriority::Priority getConfigPriority(void) const;
00148 void setConfigPriority(ArPriority::Priority priority);
00149
00150 private:
00152 void clear(void);
00153
00154 protected:
00155
00156 ArArg::Type myType;
00157 std::string myName;
00158 std::string myDescription;
00159 int *myIntPointer;
00160 int myMinInt, myMaxInt;
00161 double *myDoublePointer;
00162 double myMinDouble, myMaxDouble;
00163 bool *myBoolPointer;
00164 ArPose *myPosePointer;
00165 char *myStringPointer;
00166 size_t myMaxStrLen;
00167 bool myConfigPrioritySet;
00168 ArPriority::Priority myConfigPriority;
00169 ArRetFunctor1<bool, ArArgumentBuilder *> *mySetFunctor;
00170 ArRetFunctor<const std::list<ArArgumentBuilder *> *> *myGetFunctor;
00171 };
00172
00173 #endif // ARARGUMENT_H