#ifndef GENETIC_POPULATION_H #define GENETIC_POPULATION_H #include #include #include #include "genetic/config.h" namespace Genetic { class Phenotype; class Population { public: Population(); virtual ~Population(); typedef Bu::Hash PhenotypeHash; typedef PhenotypeHash::iterator iterator; typedef PhenotypeHash::const_iterator const_iterator; iterator begin() { return hPhenotype.begin(); } const_iterator begin() const { return hPhenotype.begin(); } int getSize() const { return hPhenotype.getSize(); } PhenotypeId addPhenotype( Phenotype *pNew ); Phenotype *getPhenotype( PhenotypeId id ) const { return hPhenotype.get( id ); } bool hasProperty( PhenotypeId id, const Bu::String &sKey ) const; Bu::Variant getProperty( PhenotypeId id, const Bu::String &sKey ) const; void setProperty( PhenotypeId id, const Bu::String &sKey, Bu::Variant vValue ); void delPhenotype( PhenotypeId id ); Phenotype *takePhenotype( PhenotypeId id ); void clear(); PhenotypeId timestep(); PhenotypeId time() const; private: PhenotypeId uNextId; PhenotypeId uTime; PhenotypeHash hPhenotype; mutable Bu::Mutex mGeneral; }; }; #endif