00001 00006 #ifndef _GeneticOperatorValidator_h 00007 #define _GeneticOperatorValidator_h 00008 00009 // SYSTEM INCLUDES 00010 // 00011 00012 // PROJECT INCLUDES 00013 // 00014 00015 // LOCAL INCLUDES 00016 // 00017 #include "GeneticOperatorControl.h" 00018 00019 // FORWARD REFERENCES 00020 // 00021 00022 template <class T> 00023 class GeneticOperatorValidator 00024 : public wxValidator 00025 { 00026 public: 00027 // LIFECYCLE 00028 00031 GeneticOperatorValidator 00032 (CountedPtr<const T>& rcpGeneticOperator) 00033 : mrcpGeneticOperator(rcpGeneticOperator) 00034 { 00035 }// GeneticOperatorValidator 00036 00041 GeneticOperatorValidator(const GeneticOperatorValidator& from) 00042 : mrcpGeneticOperator(from.mrcpGeneticOperator) 00043 { 00044 }// GeneticOperatorValidator 00045 00048 ~GeneticOperatorValidator(void) 00049 { 00050 } 00051 00052 // OPERATORS 00053 // OPERATIONS 00054 00057 virtual wxObject* Clone() const 00058 { 00059 return new GeneticOperatorValidator(*this); 00060 }// Clone 00061 00064 virtual bool TransferToWindow() 00065 { 00066 if (mrcpGeneticOperator.Get() != NULL) 00067 { 00068 GeneticOperatorControl<T>* p_control 00069 = dynamic_cast<GeneticOperatorControl<T>*>(GetWindow()); 00070 00071 int pos = p_control->SelectName(mrcpGeneticOperator->Name()); 00072 00073 assert(pos != wxNOT_FOUND); 00074 } 00075 00076 return true; 00077 }// TransferToWindow 00078 00081 virtual bool TransferFromWindow() 00082 { 00083 GeneticOperatorControl<T> *p_control 00084 = dynamic_cast<GeneticOperatorControl<T>*>(GetWindow()); 00085 00086 mrcpGeneticOperator = CountedPtr<const T>(p_control->CreateSelected()); 00087 00088 return true; 00089 }// TransferFromWindow 00090 00093 virtual bool Validate(wxWindow* pParent) 00094 { 00095 return GetWindow()->Validate(); 00096 }// Validate 00097 00098 // ACCESS 00099 // INQUIRY 00100 00101 protected: 00102 private: 00103 00105 CountedPtr<const T>& mrcpGeneticOperator; 00106 00107 }; 00108 00109 // INLINE METHODS 00110 // 00111 00112 // EXTERNAL REFERENCES 00113 // 00114 00115 #endif // _GeneticOperatorValidator_h