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

# Tools/Module/ModuleHandler.h

Go to the documentation of this file.

    00001 /**
    00002 * @file ModuleHandler.h
    00003 *
    00004 * Declaration of class ModuleHandler
    00005 *
    00006 * @author Max Risler
    00007 * @author Martin Lötzsch
    00008 */
    00009
    00010 #ifndef __ModuleHandler_h_
    00011 #define __ModuleHandler_h_
    00012
    00013 #include "ModuleSelector.h"
    00014
    00015 /**
    00016 * @class ModuleHandler
    00017 *
    00018 * Manages runtime exhangeable modules.
    00019 *
    00020 * @author Max Risler
    00021 * @author Martin Lötzsch
    00022 */
    00023 class ModuleHandler : public MessageHandler
    00024 {
    00025 private:
    00026   /** Pointers to all module selectors */
    00027   ModuleSelector *pModuleSelectors[SolutionRequest::numOfModules];
    00028
    00029 public:
    00030   /** Constructor */
    00031   ModuleHandler();
    00032
    00033   /**
    00034   * Returns pointer to selector module.
    00035   * @param id id of module.
    00036   */
    00037   ModuleSelector *pGetModuleSelector(SolutionRequest::ModuleID id) const;
    00038
    00039   /**
    00040   * Set pointer to selector module.
    00041   * @param id id of module.
    00042   * @param module a pointer to the module selector
    00043   */
    00044   void setModuleSelector(SolutionRequest::ModuleID id,
    00045     ModuleSelector* module);
    00046
    00047   /** Returns the id of the selected solution for a module id */
    00048   SolutionRequest::ModuleSolutionID getSelectedSolution(SolutionRequest::ModuleID id) const;
    00049
    00050   /** Selects solution defined by solution in module id */
    00051   void selectSolution(SolutionRequest::ModuleID id, SolutionRequest::ModuleSolutionID solution);
    00052
    00053   /** Selects solutions as defined by a solution request */
    00054   void selectSolutions(SolutionRequest request);
    00055
    00056   /**
    00057   * Called from a MessageQueue to distribute messages.
    00058   * Use message.getMessageID to decide if the message is relavant for
    00059   * the MesssageHandler derivate.
    00060   * Use message.bin, message.text or message.config as In streams to get the data from.
    00061   * @param message The message that can be read.
    00062   * @return true if the message was read (handled).
    00063   */
    00064   virtual bool handleMessage(InMessage& message);
    00065 };
    00066
    00067
    00068 #endif //__ModuleHandler_h_