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

ArArg.h

00001 /*
00002 ActivMedia Robotics Interface for Applications (ARIA)
00003 Copyright (C) 2004,2005 ActivMedia Robotics, LLC
00004 
00005 
00006      This program is free software; you can redistribute it and/or modify
00007      it under the terms of the GNU General Public License as published by
00008      the Free Software Foundation; either version 2 of the License, or
00009      (at your option) any later version.
00010 
00011      This program is distributed in the hope that it will be useful,
00012      but WITHOUT ANY WARRANTY; without even the implied warranty of
00013      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014      GNU General Public License for more details.
00015 
00016      You should have received a copy of the GNU General Public License
00017      along with this program; if not, write to the Free Software
00018      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 If you wish to redistribute ARIA under different terms, contact 
00021 ActivMedia Robotics for information about a commercial version of ARIA at 
00022 robots@activmedia.com or 
00023 ActivMedia Robotics, 19 Columbia Drive, Amherst, NH 03031; 800-639-9481
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

Generated on Wed Oct 19 12:56:34 2005 for Aria by  doxygen 1.4.0