PongUIO/AndroidWars — Issue #2: Simulation functions required to simplify generic programming
Author: Thekian
Created: 2012-02-18 18:33:50+00:00
State: open
Labels: extsim, simulation

A rudimentary system to simplify generic programming is already implemented (see for example, Sim::ProgramFactory::getFactory() ), but this system is clunky and is not yet implemented for all types that may benefit from it.

Improvements to this system is needed. One solution to this is to have a template function in Sim::State, Sim::Data, and Sim::Input that allows for generic retrieval of their internal components. In addition, code that depends on the old system should be adapted to the new system.

If similar functions turns out to be useful other places, they should be implemented as well.

For ease of programming, directly related classes should probably also support component retrieval. For example,
```
Sim::Simulation::getState().getComponent();
Sim::Simulation::getState().getComponentByRelated();
```
should both return the same result (the state's ProgramFactory component). getComponentByRelated() should also work for classes that derive from these related classes.

Code that is deprecated as a result of these changes should be removed.