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 -
cpp/gdk/geno.h
r66 r71 10 10 11 11 class MultiMap; 12 class Geno; 13 14 class GenoValidator 15 { 16 public: 17 virtual int testGenoValidity(Geno& g)=0;/// -1=no information 0=invalid 1=valid 18 }; 12 19 13 20 /// basic information about a single genotype. … … 96 103 97 104 void* owner; 105 static SListTempl<GenoValidator*> validators; 98 106 }; 99 107
Note: See TracChangeset
for help on using the changeset viewer.