Robot Simulator of the Robotics Group for Self-Organization of Control: SingletonGenFactory Class Reference

# SingletonGenFactory Class Reference

This is the factory for the class Gen. More...

`#include <SingletonGenFactory.h>`

Collaboration diagram for SingletonGenFactory:
[legend]

List of all members.

## Public Member Functions
Gen * | createGen (GenContext *context, Individual *individual, GenPrototype *prototype) const
| random generation of a new gen.
Gen * | createGen (GenContext *context, Individual *individual, GenPrototype *prototype, GenContext *oldContext, Individual *oldIndividual, Gen *oldGen, bool mutate=false) const
| this function generate a new Gen by mutate a old Gen
Gen * | createGen (GenContext *context, Individual *individual, GenPrototype *prototype, IValue *value)
| create a new Gen by a giving value
void | setNumber (int number)
| set the member variable m_number to number
## Static Public Member Functions
static SingletonGenFactory * | getInstance (void)
| this method is to become the only existing factory
static void | destroyGenFactory (void)
| this method is to destroy the one and only factory.

## Detailed Description

This is the factory for the class Gen.

It gives 3 Methodes to generate new gens. (random,value and mutation) Over this is the class as singleton concepted. Only one Factory for a run.

It use by every method the GenPrototype to be independent from the type of the Gen.

## Member Function Documentation

Gen * createGen | ( | GenContext * | context,
|  | Individual * | individual,
|  | GenPrototype * | prototype,
|  | IValue * | value |
| ) |  |  |

create a new Gen by a giving value

Parameters:

  | context | (GenContext*) the context of the new Gen
  | individual | (Individual*) the individual, where the gen is part of.
  | prototype | (GenPrototype*) the prototype of the gen, which should be create.
  | value | (IValue*) the value of the new gen

Returns:

Gen * createGen | ( | GenContext * | context,
|  | Individual * | individual,
|  | GenPrototype * | prototype,
|  | GenContext * | oldContext,
|  | Individual * | oldIndividual,
|  | Gen * | oldGen,
|  | bool | mutate = `false` |
| ) |  |  | const

this function generate a new Gen by mutate a old Gen

Parameters:

  | context | (GenContext*) the context of the new Gen
  | individual | (Individual*) the individual, where the gen is part of.
  | prototype | (GenPrototype*) the prototype of the gen, which should be create.
  | oldContext | (GenContext*) the Context of the old Gen
  | oldIndividual | (Individual*) the individua, where the olg gen is part of.
  | oldGen | (Gen*) the old Gen
  | mutate | (bool) should be mutate?

Returns:
  (Gen*) the new (or old gen)

Gen * createGen | ( | GenContext * | context,
|  | Individual * | individual,
|  | GenPrototype * | prototype |
| ) |  |  | const

random generation of a new gen.

Parameters:

  | context | (GenContext*) the context of the new Gen
  | individual | (Individual*) the individual, where the gen is part of.
  | prototype | (GenPrototype*) the prototype of the gen, which should be create.

Returns:
  (Gen*) the new Gen

static void destroyGenFactory | ( | void |  | ) | `[inline, static]`

this method is to destroy the one and only factory.

static SingletonGenFactory* getInstance | ( | void |  | ) | `[inline, static]`

this method is to become the only existing factory

Returns:
  (SingletonGenFactory*) the one and only factory

void setNumber | ( | int | number | ) | `[inline]`

set the member variable m_number to number

Parameters:

  | number | (int) the new value

The documentation for this class was generated from the following files:

- SingletonGenFactory.h
- SingletonGenFactory.cpp