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

Tools/Module/ModuleSelector.h

Go to the documentation of this file.
00001 /**
00002 * @file ModuleSelector.h
00003 *
00004 * Definition of class ModuleSelector.
00005 *
00006 * @author Max Risler
00007 * @author Martin Lötzsch
00008 */
00009 
00010 #ifndef __ModuleSelector_h_
00011 #define __ModuleSelector_h_
00012 
00013 #include "SolutionRequest.h"
00014 #include "Module.h"
00015 
00016 /**
00017 * @class ModuleSelector
00018 * 
00019 * Base class for module selectors. Module selectors allow to switch between different
00020 * solutions for a modules.
00021 *
00022 * @author Max Risler
00023 * @author Martin Lötzsch
00024 */
00025 class ModuleSelector : public MessageHandler
00026 {
00027 protected:
00028   /** The id of the selected solution */
00029   SolutionRequest::ModuleSolutionID selectedSolutionID;
00030   
00031 public:
00032   /** 
00033   * Constructor 
00034   * @param id The id of the module. 
00035   */
00036   ModuleSelector(SolutionRequest::ModuleID id);
00037   
00038   /** Destructor */
00039   ~ModuleSelector();
00040   
00041   /** 
00042   * Is called on start and when the selected solution changes
00043   * to create a specific solution.
00044   * @param id The id of the solution to create
00045   * @return The created solution or 0
00046   */
00047   virtual Module* createSolution(SolutionRequest::ModuleSolutionID id) = 0;
00048 
00049   /** 
00050   * Creates the default solution.
00051   * This can not be done in the constructor, 
00052   * as the derived selector class is not created yet.
00053   */
00054   void init();
00055 
00056   /**
00057   * Selects a module.
00058   * @param id id of module to select
00059   */
00060   virtual void selectSolution(SolutionRequest::ModuleSolutionID id);
00061   
00062   /** Returns the index of the selected solution. */
00063   SolutionRequest::ModuleSolutionID getSelectedSolution() const;
00064   
00065   /** Executes the selected module */
00066   virtual void execute();
00067 
00068   /** 
00069   * Called from a MessageQueue to distribute messages.
00070   * Use message.getMessageID to decide if the message is relavant for 
00071   * the MesssageHandler derivate.
00072   * @param message The message that can be read.
00073   * @return true if the message was read (handled).
00074   */
00075   virtual bool handleMessage(InMessage& message);
00076 
00077 protected:
00078 
00079   /** The id of the module, needed only for error messages. */
00080   SolutionRequest::ModuleID moduleID;
00081 
00082   /** The selected solution */
00083   Module *selectedSolution;
00084 };
00085 
00086 
00087 #endif /// __ModuleSelector_h_
00088 
00089 /*
00090 * Change log :
00091 * 
00092 * $Log: ModuleSelector.h,v $
00093 * Revision 1.1.1.1  2004/05/22 17:37:19  cvsadm
00094 * created new repository GT2004_WM
00095 *
00096 * Revision 1.2  2004/01/21 14:31:58  loetzsch
00097 * Module Selectors create only the selected solution.
00098 * When the solution changes, the old solution is erased and the new
00099 * one ist created using createSolution(..)
00100 *
00101 * Revision 1.1  2003/10/07 10:13:24  cvsadm
00102 * Created GT2004 (M.J.)
00103 *
00104 * Revision 1.1.1.1  2003/07/02 09:40:29  cvsadm
00105 * created new repository for the competitions in Padova from the 
00106 * tamara CVS (Tuesday 2:00 pm)
00107 *
00108 * removed unused solutions
00109 *
00110 * Revision 1.3  2003/03/29 23:06:20  loetzsch
00111 * maded pSolution protected instead of private
00112 *
00113 * Revision 1.2  2002/09/10 17:53:26  loetzsch
00114 * First draft of new Module/Solution Architecture
00115 *
00116 * Revision 1.1  2002/09/10 15:53:59  cvsadm
00117 * Created new project GT2003 (M.L.)
00118 * - Cleaned up the /Src/DataTypes directory
00119 * - Removed challenge related source code
00120 * - Removed processing of incoming audio data
00121 * - Renamed AcousticMessage to SoundRequest
00122 *
00123 * Revision 1.2  2002/07/23 13:48:41  loetzsch
00124 * - new streaming classes
00125 * - removed many #include statements
00126 * - exchanged StaticQueue by MessageQueue
00127 * - new debug message handling
00128 * - general clean up
00129 *
00130 * Revision 1.1.1.1  2002/05/10 12:40:32  cvsadm
00131 * Moved GT2002 Project from ute to tamara.
00132 *
00133 * Revision 1.9  2002/01/20 13:00:18  risler
00134 * changed implementation of selecting default solution
00135 *
00136 * Revision 1.8  2002/01/17 14:35:48  risler
00137 * SolutionRequest added
00138 *
00139 * Revision 1.7  2001/12/21 14:09:38  roefer
00140 * Added several destructors
00141 *
00142 * Revision 1.6  2001/12/10 17:47:10  risler
00143 * change log added
00144 *
00145 */

Generated on Thu Sep 23 19:57:40 2004 for GT2004 by doxygen 1.3.6