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 #ifndef ARARG_H
00027 #define ARARG_H
00028
00029 #include "ariaTypedefs.h"
00030 #include "ariaUtil.h"
00031 #include "ArFunctor.h"
00032
00033 class ArArgumentBuilder;
00034
00036
00044 class ArArg
00045 {
00046 public:
00047 typedef enum
00048 {
00049 INVALID,
00050 INT,
00051 DOUBLE,
00052 STRING,
00053 BOOL,
00054 POSE,
00055 FUNCTOR,
00056 DESCRIPTION_HOLDER,
00057
00058 LAST_TYPE = DESCRIPTION_HOLDER
00059 } Type;
00060
00061
00062 enum {
00063 TYPE_COUNT = LAST_TYPE + 1
00064 };
00065
00067 AREXPORT ArArg();
00069 AREXPORT ArArg(const char * name, int *pointer,
00070 const char * description = "",
00071 int minInt = INT_MIN,
00072 int maxInt = INT_MAX);
00074 AREXPORT ArArg(const char * name, double *pointer,
00075 const char * description = "",
00076 double minDouble = -HUGE_VAL,
00077 double maxDouble = HUGE_VAL);
00079 AREXPORT ArArg(const char * name, bool *pointer,
00080 const char * description = "");
00082 AREXPORT ArArg(const char * name, ArPose *pointer,
00083 const char * description = "");
00085 AREXPORT ArArg(const char *name, char *pointer,
00086 const char *description,
00087 size_t maxStrLen);
00089 AREXPORT ArArg(const char *name,
00090 ArRetFunctor1<bool, ArArgumentBuilder *> *setFunctor,
00091 ArRetFunctor<const std::list<ArArgumentBuilder *> *> *getFunctor,
00092 const char *description);
00094 AREXPORT ArArg(const char *description);
00096 AREXPORT ArArg(const ArArg & arg);
00098 AREXPORT ArArg &operator=(const ArArg &arg);
00100 AREXPORT virtual ~ArArg();
00101
00103 AREXPORT Type getType(void) const;
00105 AREXPORT const char *getName(void) const;
00107 AREXPORT const char *getDescription(void) const;
00109 AREXPORT bool setInt(int val);
00111 AREXPORT bool setDouble(double val);
00113 AREXPORT bool setBool(bool val);
00115 AREXPORT bool setPose(ArPose pose);
00117 AREXPORT bool setString(const char *str);
00119 AREXPORT bool setArgWithFunctor(ArArgumentBuilder *argument);
00121 AREXPORT int getInt(void) const;
00123 AREXPORT double getDouble(void) const;
00125 AREXPORT bool getBool(void) const;
00127 AREXPORT ArPose getPose(void) const;
00129 AREXPORT const char *getString(void) const;
00131 AREXPORT const std::list<ArArgumentBuilder *> *getArgsWithFunctor(void) const;
00133 AREXPORT void log(void) const;
00135 AREXPORT int getMinInt(void) const;
00137 AREXPORT int getMaxInt(void) const;
00139 AREXPORT double getMinDouble(void) const;
00141 AREXPORT double getMaxDouble(void) const;
00143 AREXPORT bool getConfigPrioritySet(void) const;
00145 AREXPORT ArPriority::Priority getConfigPriority(void) const;
00147 AREXPORT void setConfigPriority(ArPriority::Priority priority);
00148
00149 private:
00151 AREXPORT void clear(void);
00152
00153 protected:
00154
00155 ArArg::Type myType;
00156 std::string myName;
00157 std::string myDescription;
00158 int *myIntPointer;
00159 int myMinInt, myMaxInt;
00160 double *myDoublePointer;
00161 double myMinDouble, myMaxDouble;
00162 bool *myBoolPointer;
00163 ArPose *myPosePointer;
00164 char *myStringPointer;
00165 size_t myMaxStrLen;
00166 bool myConfigPrioritySet;
00167 ArPriority::Priority myConfigPriority;
00168 ArRetFunctor1<bool, ArArgumentBuilder *> *mySetFunctor;
00169 ArRetFunctor<const std::list<ArArgumentBuilder *> *> *myGetFunctor;
00170 };
00171
00172 #endif // ARARGUMENT_H