00001 00012 #ifndef POPOBJECTFACTORY_H_ 00013 #define POPOBJECTFACTORY_H_ 00014 00015 #include "PopObjectValueGenerator.h" 00016 #include "SimObjectVariationFactory.h" 00017 #include "SimObjectPopulation.h" 00018 00020 class PopObjectFactory : public SimObjectVariationFactory 00021 { 00022 public: 00023 PopObjectFactory(SimObjectFactory const& model); 00024 PopObjectFactory(SimObjectVariationFactory const& model); 00025 00026 virtual ~PopObjectFactory(); 00027 00029 void set( string const& fieldname, RandomDistribution const& rd ); 00030 00032 void set(string const& fieldname, PopObjectValueGenerator const& rd); 00033 00035 virtual void announce(SimObjectPopulation &pop, size_t idx); 00036 00038 virtual SimObject* create(RandomEngine *eng) const; 00039 00041 virtual SimObject* create() const; 00042 00043 protected: 00044 size_t m_idx; 00045 00046 struct FieldGeneratorPair 00047 { 00048 FieldGeneratorPair() 00049 : field(NULL), gen(NULL) 00050 {}; 00051 FieldGeneratorPair( Field const* field, PopObjectValueGenerator *g) 00052 : field(field), gen(g) 00053 {}; 00054 00055 Field const* field; 00056 PopObjectValueGenerator *gen; 00057 }; 00058 00059 typedef map< string, FieldGeneratorPair* > value_generators_t; 00060 value_generators_t m_value_generators; 00061 }; 00062 00063 #endif /*POPOBJECTFACTORY_H_*/