Ignore:
Timestamp:
02/26/14 20:21:22 (10 years ago)
Author:
sz
Message:

Genetics reorganization (affects ALL applications!):

  • Converters/Validators? are now configured/initialized in a more verbose but also less confusing way
  • At the same time, the PreconfiguredGenetics? object will help you avoid the increased complexity by creating the ready-to-use environment that is sufficient in 99% of cases (see the demos)
  • Format F genetics updated (work in progress)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/genetics/geno.cpp

    r121 r145  
    44
    55#include "geno.h"
     6#include "genoconv.h"
    67#include <frams/model/model.h>
    78
    89SListTempl<GenoValidator*> Geno::validators;
     10GenoConvManager *Geno::converters=NULL;
    911
    1012void Geno::init(const SString& genstring,char genformat,const SString& genname,const SString& comment)
     
    209211SString Geno::getComment(void) const {return txt;}
    210212
    211 class ModelGenoValidator: public GenoValidator
    212 {
    213 public:
    214         ModelGenoValidator();
    215         int testGenoValidity(Geno& g);
    216 };
    217 
    218 ModelGenoValidator::ModelGenoValidator()
    219 {
    220 Geno::validators+=this;
    221 }
    222 
    223213int ModelGenoValidator::testGenoValidity(Geno& g)
    224214{
     
    234224        }
    235225}
    236 
    237 static ModelGenoValidator default_validator;
    238226
    239227void Geno::validate()
     
    256244if (otherformat==getFormat()) return *this;
    257245#ifndef NO_GENOCONVMANAGER
    258 if ((otherformat=='0')&&(!m))
    259         {
    260         if (!f0gen)
    261                 f0gen=new Geno(GenoConvManager::globalConvert(*this,otherformat));
    262         return *f0gen;
    263         }
    264 else
    265         return GenoConvManager::globalConvert(*this,otherformat,m);
    266 #else
     246if (converters)
     247        {
     248        if ((otherformat=='0')&&(!m))
     249                {
     250                if (!f0gen)
     251                        f0gen=new Geno(converters->convert(*this,otherformat));
     252                return *f0gen;
     253        }
     254        else
     255                return converters->convert(*this,otherformat,m);
     256        }
     257#endif
    267258return (otherformat==getFormat())?*this:Geno(0,0,0,"GenConvManager not available");
    268 #endif
    269259}
    270260
Note: See TracChangeset for help on using the changeset viewer.