Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

gevd_param_mixin.h

Go to the documentation of this file.
00001 #ifndef gevd_param_mixin_h_
00002 #define gevd_param_mixin_h_
00003 //=======================================================================
00004 //:
00005 // \file
00006 // \brief A mixin to package algorithm parameters
00007 //
00008 //   The base class for blocks of algorithm parameters. Algorithms,
00009 //   such as edge detection, would inherit specializations of this mixin
00010 //   which contain the actual parameters and methods to validate the
00011 //   parameters.
00012 //
00013 // \author J.L. Mundy
00014 // \date   November 28, 1997
00015 //
00016 // \verbatim
00017 //  Modifications:
00018 //   Rupert Curwen -  February 3, 1998
00019 //      Added the ParamModifier class as an abstract base class which
00020 //      will allow parameter blocks to support generic "modifier"
00021 //      classes.  A parameter class defines the virtual method
00022 //      DescribeParams, which takes a ParamModifier as an argument.
00023 //      The parameter block calls AddParam on this ParamModifier for
00024 //      each of the parameters in the block.  For example, the
00025 //      particular ParamModifier passed into the method might be one
00026 //      which builds a dialog which will then modify the parameter
00027 //      class.  Or it might just print the values to a stream.  See
00028 //      Segmentation/Detection/DetectorParams for an example of use.
00029 // \endverbatim
00030 //======================================================================
00031 
00032 #include <vcl_string.h>
00033 
00034 #if 0 // not implemented
00035 class ParamModifier;
00036 #endif
00037 
00038 class gevd_param_mixin
00039 {
00040   bool valid_;
00041   vcl_string error_msg_;
00042  public:
00043   //=====================================================
00044   //: Constructor.  By default a constructed parameter block is valid.
00045   gevd_param_mixin() : valid_(true) {}
00046   // Destructor
00047   virtual ~gevd_param_mixin() {}
00048   //=====================================================
00049   virtual bool SanityCheck();
00050   bool Valid() { return valid_; }
00051   const char* GetErrorMsg() { return error_msg_.c_str(); }
00052   void SetErrorMsg(const char* msg);
00053 #if 0// not implemented in vxl
00054   virtual void Describe(ParamModifier&) {}
00055 #endif
00056 };
00057 #if 0 // not implemented in vxl
00058 class ParamModifier
00059 {
00060  virtual ~ParamModifier() {}
00061 
00062  public:
00063   //------------------------------------------------------------
00064   //: These are some standard boolean choice styles defined for convenience.
00065   enum BoolChoiceStyle { TrueFalse, OnOff, YesNo };
00066 
00067   //------------------------------------------------------------
00068   //: Name those parameters which follow.
00069   virtual void Name(const vcl_string& name) = 0;
00070 
00071   //------------------------------------------------------------
00072   //: Add a float parameter.
00073   virtual void AddParam(const vcl_string& name, float& value) = 0;
00074 
00075   //------------------------------------------------------------
00076   //: Add a double parameter.
00077   virtual void AddParam(const vcl_string& name, double& value) = 0;
00078 
00079   //------------------------------------------------------------
00080   //: Add an integer parameter.
00081   virtual void AddParam(const vcl_string& name, int& value) = 0;
00082 
00083   //------------------------------------------------------------
00084   //: Add a boolean parameter.
00085   virtual void AddParam(const vcl_string& name, bool& value) = 0;
00086 
00087   //------------------------------------------------------------
00088   //: Add a choice parameter.
00089   //  virtual void AddParam(const vcl_string& name, int& value, UIChoice* choices) = 0;
00090 
00091   //------------------------------------------------------------
00092   //: Add a boolean choice parameter, using one of the convenient standard styles.
00093   virtual void AddParam(const vcl_string& name, bool& value,
00094                         BoolChoiceStyle style = TrueFalse) = 0;
00095 };
00096 #endif
00097 #endif // gevd_param_mixin_h_

Generated on Thu Jan 10 14:47:17 2008 for contrib/gel/gevd by  doxygen 1.4.4