#include <SimObjectVariationFactory.h>
Public Member Functions | |
SimObjectVariationFactory (SimObjectFactory const &model) | |
Creates a variation factory by using the model argument as a basis. | |
SimObjectVariationFactory (SimObjectVariationFactory const &model) | |
virtual | ~SimObjectVariationFactory () |
Destruct me. | |
void | set (string const &fieldname, RandomDistribution const &rd) |
Set the specified RandomDistribution for the given field. | |
virtual SimObject * | create (void) const |
Return a pointer to a newly created SimObject using the factories number engine (use setRandomEngine to specify). | |
virtual SimObject * | create (RandomEngine *eng) const |
Return a pointer to a newly created SimObject using the random number engine. | |
virtual object_type_t | getObjectTypeID () const |
Return te object type of the objects generated by this factory. | |
void | setRandomEngine (RandomEngine *eng) |
Explicitly specifies a random engine to be used with the RandomDistribution objects inside the factory. | |
void | unsetRandomEngine (void) |
Tells the SimObjectVariationFactory to use the default random number engine. | |
Protected Types | |
typedef map< string, FieldRngPair * > | var_fields_t |
Protected Attributes | |
SimObject * | m_base |
RandomEngine * | rnd_eng |
var_fields_t | m_var_fields |
Classes | |
struct | FieldRngPair |
Allows for specification of random distribution objects associated with each field of the SimObject class that is produced by the factory.
Definition at line 32 of file SimObjectVariationFactory.h.
typedef map< string, FieldRngPair* > SimObjectVariationFactory::var_fields_t [protected] |
Definition at line 79 of file SimObjectVariationFactory.h.
SimObjectVariationFactory::SimObjectVariationFactory | ( | SimObjectFactory const & | sof | ) |
Creates a variation factory by using the model argument as a basis.
Creates a variation factory by using the factory argument
Definition at line 28 of file SimObjectVariationFactory.cpp.
References SimObjectFactory::create(), ThreadSpecificRandomEngine::get(), ThreadSpecificRandomEngine::init(), m_base, rnd_eng, and theThreadSpecificRandomEngine.
SimObjectVariationFactory::SimObjectVariationFactory | ( | SimObjectVariationFactory const & | model | ) |
Definition at line 35 of file SimObjectVariationFactory.cpp.
References Field::clone(), SimObjectFactory::create(), SimObject::findField(), ThreadSpecificRandomEngine::get(), ThreadSpecificRandomEngine::init(), m_base, m_var_fields, rnd_eng, and theThreadSpecificRandomEngine.
SimObjectVariationFactory::~SimObjectVariationFactory | ( | ) | [virtual] |
Destruct me.
Definition at line 48 of file SimObjectVariationFactory.cpp.
References m_base, and m_var_fields.
void SimObjectVariationFactory::set | ( | string const & | fieldname, | |
RandomDistribution const & | rd | |||
) |
Set the specified RandomDistribution for the given field.
Associates the field named fieldname of the SimObject with the RandomDistribution object, such that values for this parameter are generated from the RandomDistribution.
Reimplemented in ConnObjectFactory, and PopObjectFactory.
Definition at line 65 of file SimObjectVariationFactory.cpp.
References RandomDistribution::clone(), SimObject::findField(), m_base, and m_var_fields.
Referenced by PopObjectFactory::set(), and ConnObjectFactory::set().
SimObject * SimObjectVariationFactory::create | ( | void | ) | const [virtual] |
Return a pointer to a newly created SimObject using the factories number engine (use setRandomEngine to specify).
Reimplemented from SimObjectFactory.
Reimplemented in ConnObjectFactory, and PopObjectFactory.
Definition at line 86 of file SimObjectVariationFactory.cpp.
References rnd_eng.
Referenced by PopObjectFactory::create(), and ConnObjectFactory::create().
SimObject * SimObjectVariationFactory::create | ( | RandomEngine * | eng | ) | const [virtual] |
Return a pointer to a newly created SimObject using the random number engine.
Reimplemented from SimObjectFactory.
Reimplemented in ConnObjectFactory, and PopObjectFactory.
Definition at line 75 of file SimObjectVariationFactory.cpp.
References SimObjectFactory::create(), m_base, m_var_fields, and SimObject::setScalarField().
object_type_t SimObjectVariationFactory::getObjectTypeID | ( | ) | const [virtual] |
Return te object type of the objects generated by this factory.
Reimplemented from SimObjectFactory.
Definition at line 91 of file SimObjectVariationFactory.cpp.
References SimObjectFactory::getObjectTypeID(), and m_base.
void SimObjectVariationFactory::setRandomEngine | ( | RandomEngine * | eng | ) | [inline] |
Explicitly specifies a random engine to be used with the RandomDistribution objects inside the factory.
This is actually not necessary since it is automatically and properly done
Definition at line 58 of file SimObjectVariationFactory.h.
References rnd_eng.
void SimObjectVariationFactory::unsetRandomEngine | ( | void | ) |
Tells the SimObjectVariationFactory to use the default random number engine.
Definition at line 56 of file SimObjectVariationFactory.cpp.
References ThreadSpecificRandomEngine::get(), ThreadSpecificRandomEngine::init(), rnd_eng, and theThreadSpecificRandomEngine.
SimObject* SimObjectVariationFactory::m_base [protected] |
Definition at line 67 of file SimObjectVariationFactory.h.
Referenced by create(), getObjectTypeID(), set(), PopObjectFactory::set(), ConnObjectFactory::set(), SimObjectVariationFactory(), and ~SimObjectVariationFactory().
RandomEngine* SimObjectVariationFactory::rnd_eng [protected] |
Definition at line 68 of file SimObjectVariationFactory.h.
Referenced by PopObjectFactory::announce(), create(), PopObjectFactory::create(), ConnObjectFactory::create(), ConnObjectFactory::init(), setRandomEngine(), SimObjectVariationFactory(), and unsetRandomEngine().
var_fields_t SimObjectVariationFactory::m_var_fields [protected] |
Definition at line 80 of file SimObjectVariationFactory.h.
Referenced by create(), set(), SimObjectVariationFactory(), and ~SimObjectVariationFactory().