]> ruin.nu Git - germs.git/blobdiff - src/model.cpp
More help output
[germs.git] / src / model.cpp
index 12bee4bddafc7084cdf0a60a4bfe383d92bf7a92..f801f12d6ec2f8dcc90288df63d5397a820a3a5a 100644 (file)
 #include "model.h"
 #include "models.h"
 
+#include <stdexcept>
+
 Model::Model(Models::ModelImpl* model): _impl(model){
 }
 
-double Model::score(const SortAction& sa) const{
-       return _impl->score(sa);
+double Model::score(const SortAction& sa, const GeneOrder& go) const{
+       return _impl->score(sa, go);
 }
 
-std::string Model::name() const{
+const char* Model::name() const{
        return _impl->name();
 }
 
 bool operator<(const Model& lh,const Model& rh){
        return &lh < &rh;
 }
+
+Model Model::modelFactory(const std::string& name){
+       if (name == "X"){
+               return Model(new Models::X());
+       }else if(name == "Whirl"){
+               return Model(new Models::Whirl());
+       }else if(name == "Standard"){
+               return Model(new Models::ModelImpl());
+       }else if(name == "Zipper"){
+               return Model(new Models::Zipper());
+       }else if(name == "FatX"){
+               return Model(new Models::FatX());
+       }else if(name == "Cloud"){
+               return Model(new Models::Cloud());
+       }
+       throw std::invalid_argument(name + " is not a valid model");
+}