00001 #ifndef SIMOBJECTCLONEFACTORY_H_ 00002 #define SIMOBJECTCLONEFACTORY_H_ 00003 00004 #include "SimObjectFactory.h" 00005 00007 template< class T > 00008 class SimObjectCloneFactory : public SimObjectFactory 00009 { 00010 00011 public: 00012 00013 SimObjectCloneFactory(T &src) : source(src) 00014 { /* NOOP */ }; 00015 00016 SimObjectCloneFactory(void) 00017 { /* NOOP */ }; 00018 00019 virtual ~SimObjectCloneFactory() 00020 { /* NOOP */ }; 00021 00022 virtual SimObject* create(void) const 00023 { 00024 return new T(source); 00025 }; 00026 00027 virtual SimObject* create( RandomEngine * ) const 00028 { 00029 return new T(source); 00030 }; 00031 00032 virtual object_type_t getObjectTypeID() const 00033 { 00034 return T::objectTypeID(); 00035 }; 00036 00037 protected: 00038 T source; 00039 00040 }; 00041 00042 #endif /*SIMOBJECTCLONEFACTORY_H_*/