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.


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 20 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, 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 57 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 25 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 39 of file ModuleSelector.cpp.

References selectedSolutionID.

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

void ModuleSelector::execute  )  [virtual]
 

Executes the selected module.

Definition at line 44 of file ModuleSelector.cpp.

References Module::execute(), 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 49 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().

SolutionRequest::ModuleID ModuleSelector::moduleID [protected]
 

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

Definition at line 80 of file ModuleSelector.h.

Referenced by init().

Module* ModuleSelector::selectedSolution [protected]
 

The selected solution.

Definition at line 83 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 Thu Sep 23 20:09:37 2004 for GT2004 by doxygen 1.3.6