00001 00013 #ifndef POPOBJECTATTRIBUTEFACTORY_H_ 00014 #define POPOBJECTATTRIBUTEFACTORY_H_ 00015 00016 #include "RandomEngine.h" 00017 #include "PopObjectFactory.h" 00018 #include "SimObjectAttributes.h" 00019 00020 00035 class PopObjectAttributeFactory : public PopObjectFactory 00036 { 00037 public: 00038 00039 // PopObjectAttributeFactory(PopObjectAttributeFactory const& model); 00040 00041 PopObjectAttributeFactory(PopObjectFactory const& model); 00042 00043 virtual ~PopObjectAttributeFactory(); 00044 00046 virtual void announce(SimObjectPopulation &pop, size_t idx); 00047 00048 00052 void set(string const& attrname, string const& value); 00053 00058 void set(string const& attrname, RandomDistribution & rd ); 00059 00060 00065 void set(string const& attr, PopObjectValueGenerator & valgen); 00066 00071 virtual SimObject* create(RandomEngine *rnd); 00072 00073 virtual SimObjectAttributes *createAttributes(RandomEngine *rnd); 00074 00075 protected: 00076 bool CheckAndRemoveAttrName(string const& attrname); 00077 00078 typedef map< string, PopObjectValueGenerator* > attr_generators_t; 00079 attr_generators_t m_attr_generators; 00080 00081 typedef map< string, RandomDistribution* > attr_distributions_t; 00082 attr_distributions_t m_attr_distributions; 00083 00084 shared_ptr<SimObjectAttributesDefinition> m_attr_def; 00085 }; 00086 00087 #endif /*POPOBJECTATTRIBUTEFACTORY_H_*/