Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

ModuleSelector Class Reference

Base class for module selectors. More...

#include <ModuleSelector.h>

Inheritance diagram for ModuleSelector:

Inheritance graph
[legend]
Collaboration diagram for ModuleSelector:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ModuleSelector (SolutionRequest::ModuleID id)
 Constructor.

 ~ModuleSelector ()
 Destructor.

virtual ModulecreateSolution (SolutionRequest::ModuleSolutionID id)=0
 Is called on start and when the selected solution changes to create a specific solution.

void init ()
 Creates the default solution.

virtual void selectSolution (SolutionRequest::ModuleSolutionID id)
 Selects a module.

SolutionRequest::ModuleSolutionID getSelectedSolution () const
 Returns the index of the selected solution.

virtual void execute ()
 Executes the selected module.

virtual bool handleMessage (InMessage &message)
 Called from a MessageQueue to distribute messages.


Public Attributes

unsigned int frameCounter
 RunTime.

double averageRunTime
 RunTime.

unsigned long maxRunTime
 RunTime.

unsigned long minRunTime
 RunTime.


Protected Attributes

SolutionRequest::ModuleSolutionID selectedSolutionID
 The id of the selected solution.

SolutionRequest::ModuleID moduleID
 The id of the module, needed only for error messages.

ModuleselectedSolution
 The selected solution.


Detailed Description

Base class for module selectors.

Module selectors allow to switch between different solutions for a modules.

Author:
Max Risler

Martin Lötzsch

Definition at line 25 of file ModuleSelector.h.


Constructor & Destructor Documentation

ModuleSelector::ModuleSelector SolutionRequest::ModuleID  id  ) 
 

Constructor.

Parameters:
id The id of the module.

Definition at line 14 of file ModuleSelector.cpp.

References SolutionRequest::getDefaultSolution(), and selectedSolutionID.

Here is the call graph for this function:

ModuleSelector::~ModuleSelector  ) 
 

Destructor.

Definition at line 21 of file ModuleSelector.cpp.

References selectedSolution.


Member Function Documentation

virtual Module* ModuleSelector::createSolution SolutionRequest::ModuleSolutionID  id  )  [pure virtual]
 

Is called on start and when the selected solution changes to create a specific solution.

Parameters:
id The id of the solution to create
Returns:
The created solution or 0

Implemented in BallLocatorSelector, BehaviorControlSelector, CollisionDetectorSelector, ColorTableModSelector, GetupEngineSelector, GTCamSelector, HeadControlSelector, ImageProcessorSelector, LEDControlSelector, MotionControlSelector, ObstaclesLocatorSelector, PlayersLocatorSelector, RobotStateDetectorSelector, SelfLocatorSelector, SensorBehaviorControlSelector, SensorDataProcessorSelector, SoundControlSelector, TeamBallLocatorSelector, and WalkingEngineSelector.

Referenced by init().

void ModuleSelector::init  ) 
 

Creates the default solution.

This can not be done in the constructor, as the derived selector class is not created yet.

Definition at line 71 of file ModuleSelector.cpp.

References createSolution(), idText, moduleID, OUTPUT, selectedSolution, and selectedSolutionID.

Referenced by selectSolution(), and ModuleHandler::setModuleSelector().

Here is the call graph for this function:

void ModuleSelector::selectSolution SolutionRequest::ModuleSolutionID  id  )  [virtual]
 

Selects a module.

Parameters:
id id of module to select

Definition at line 26 of file ModuleSelector.cpp.

References ASSERT, init(), selectedSolution, selectedSolutionID, and solutionRequestMaxNumOfSolutions.

Referenced by ModuleHandler::selectSolution().

Here is the call graph for this function:

SolutionRequest::ModuleSolutionID ModuleSelector::getSelectedSolution  )  const
 

Returns the index of the selected solution.

Definition at line 40 of file ModuleSelector.cpp.

References selectedSolutionID.

Referenced by ModuleHandler::getSelectedSolution(), and ModuleHandler::selectSolution().

void ModuleSelector::execute  )  [virtual]
 

Executes the selected module.

Definition at line 45 of file ModuleSelector.cpp.

References averageRunTime, Module::execute(), frameCounter, SystemCall::getCurrentSystemTime(), SystemCall::getTimeSince(), maxRunTime, minRunTime, and selectedSolution.

Referenced by Motion::main(), and Cognition::main().

Here is the call graph for this function:

bool ModuleSelector::handleMessage InMessage message  )  [virtual]
 

Called from a MessageQueue to distribute messages.

Use message.getMessageID to decide if the message is relavant for the MesssageHandler derivate.

Parameters:
message The message that can be read.
Returns:
true if the message was read (handled).

Implements MessageHandler.

Reimplemented in WalkingEngineSelector.

Definition at line 63 of file ModuleSelector.cpp.

References Module::handleMessage(), and selectedSolution.

Referenced by ModuleHandler::handleMessage(), Motion::handleMessage(), and Cognition::handleMessage().

Here is the call graph for this function:


Member Data Documentation

SolutionRequest::ModuleSolutionID ModuleSelector::selectedSolutionID [protected]
 

The id of the selected solution.

Definition at line 29 of file ModuleSelector.h.

Referenced by getSelectedSolution(), init(), ModuleSelector(), and selectSolution().

unsigned int ModuleSelector::frameCounter
 

RunTime.

Definition at line 78 of file ModuleSelector.h.

Referenced by execute().

double ModuleSelector::averageRunTime
 

RunTime.

Definition at line 80 of file ModuleSelector.h.

Referenced by execute().

unsigned long ModuleSelector::maxRunTime
 

RunTime.

Definition at line 82 of file ModuleSelector.h.

Referenced by execute().

unsigned long ModuleSelector::minRunTime
 

RunTime.

Definition at line 84 of file ModuleSelector.h.

Referenced by execute().

SolutionRequest::ModuleID ModuleSelector::moduleID [protected]
 

The id of the module, needed only for error messages.

Definition at line 90 of file ModuleSelector.h.

Referenced by init().

Module* ModuleSelector::selectedSolution [protected]
 

The selected solution.

Definition at line 93 of file ModuleSelector.h.

Referenced by execute(), handleMessage(), init(), selectSolution(), and ~ModuleSelector().


The documentation for this class was generated from the following files:
Generated on Mon Mar 20 22:17:49 2006 for GT2005 by doxygen 1.3.6