00001 00012 #ifndef CONNOBJECTFACTORY_H_ 00013 #define CONNOBJECTFACTORY_H_ 00014 00015 #include "SimObjectVariationFactory.h" 00016 #include "ConnObjectValueGenerator.h" 00017 #include "SimObjectPopulation.h" 00018 #include "PopObjectFactory.h" 00019 00020 class ConnObjectFactory : public SimObjectVariationFactory 00021 { 00022 public: 00023 ConnObjectFactory(SimObjectFactory const& model); 00024 ConnObjectFactory(SimObjectVariationFactory const& model); 00025 00026 virtual ~ConnObjectFactory(); 00027 00028 void set(string const& fieldname, RandomDistribution const& rd); 00029 00031 void set(string const& fieldname, ConnObjectValueGenerator const& val_gen); 00032 00034 virtual void init(const SimObjectPopulation &src_pop, size_t src_idx, 00035 const SimObjectPopulation &dst_pop, size_t dst_idx); 00036 00038 virtual SimObject* create() const; 00039 00041 virtual SimObject* create(RandomEngine *eng) const; 00042 00043 00044 protected: 00045 size_t m_src_idx; 00046 size_t m_dst_idx; 00047 00048 struct FieldGeneratorPair 00049 { 00050 FieldGeneratorPair() 00051 : field(NULL), gen(NULL) 00052 {}; 00053 FieldGeneratorPair( Field const* field, ConnObjectValueGenerator *g) 00054 : field(field), gen(g) 00055 {}; 00056 00057 Field const* field; 00058 ConnObjectValueGenerator *gen; 00059 }; 00060 00061 typedef map< string, FieldGeneratorPair* > value_generators_t; 00062 value_generators_t m_value_generators; 00063 }; 00064 00065 #endif /*CONNOBJECTFACTORY_H_*/