Changeset 71 for cpp/gdk/geno.cpp
- Timestamp:
- 02/05/11 00:53:44 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/gdk/geno.cpp
r66 r71 5 5 #include "geno.h" 6 6 #include "model.h" 7 8 SListTempl<GenoValidator*> Geno::validators; 7 9 8 10 void Geno::init(const SString& genstring,int genformat,const SString& genname,const SString& comment) … … 206 208 SString Geno::getComment(void) const {return txt;} 207 209 210 class ModelGenoValidator: public GenoValidator 211 { 212 public: 213 ModelGenoValidator(); 214 int testGenoValidity(Geno& g); 215 }; 216 217 ModelGenoValidator::ModelGenoValidator() 218 { 219 Geno::validators+=this; 220 } 221 222 int ModelGenoValidator::testGenoValidity(Geno& g) 223 { 224 if (g.getFormat()=='0') 225 { 226 Model mod(g); 227 return mod.isValid(); 228 } 229 else 230 { 231 Geno f0geno=g.getConverted('0'); 232 return f0geno.isValid(); 233 } 234 } 235 236 static ModelGenoValidator default_validator; 237 208 238 void Geno::validate() 209 239 { 210 240 if (isvalid>=0) return; 211 241 if (gen.len()==0) { isvalid=0; return; } 212 if (getFormat()=='0') 213 { 214 Model mod(*this); 215 isvalid=mod.isValid(); 216 } 217 else 218 { 219 Geno f0geno=getConverted('0'); 220 f0geno.validate(); 221 isvalid=f0geno.isvalid; 222 } 242 FOREACH(GenoValidator*,v,validators) 243 if ((isvalid=v->testGenoValidity(*this))>=0) 244 break; 223 245 } 224 246
Note: See TracChangeset
for help on using the changeset viewer.