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

Tools/Module/Module.h

Go to the documentation of this file.
00001 /** 
00002 * @file Module.h
00003 *
00004 * Definition of class Module.
00005 *
00006 * @author <a href="mailto:juengel@informatik.hu-berlin.de">Matthias Jüngel</a>
00007 * @author <a href="mailto:martin@martin-loetzsch.de">Martin Lötzsch</a>
00008 */
00009 
00010 #ifndef __Module_h_
00011 #define __Module_h_
00012 
00013 #include "Platform/SystemCall.h"
00014 #include "Tools/MessageQueue/InMessage.h"
00015 
00016 /**
00017 * @class Module
00018 *
00019 * Base class for all modules.
00020 *
00021 * @author <a href="mailto:juengel@informatik.hu-berlin.de">Matthias Jüngel</a>
00022 * @author <a href="mailto:martin@martin-loetzsch.de">Martin Lötzsch</a>
00023 */
00024 class Module : public MessageHandler
00025 {
00026 public:
00027   /** executes the module */
00028 #ifdef NDEBUG
00029   virtual void execute() = 0;
00030 #else
00031   /**
00032   * When doing a debug build, we save the time, when we entered the module, so we can find endless loops
00033   */
00034   virtual void execute() {
00035     entryTime = SystemCall::getCurrentSystemTime ();
00036   };
00037 #endif
00038 
00039   /** 
00040   * Called from a MessageQueue to distribute messages.
00041   * Use message.getMessageID to decide if the message is relavant for 
00042   * the MesssageHandler derivate.
00043   * Use message.bin, message.text or message.config as In streams to get the data from.
00044   * @param message The message that can be read.
00045   * @return true if the message was read (handled).
00046   */
00047   virtual bool handleMessage(InMessage& message) {return false;}
00048 
00049   virtual ~Module() {};
00050 
00051 #ifndef NDEBUG
00052   /**
00053   * Used for finding endless loops
00054   */
00055   unsigned long entryTime;
00056 #endif
00057 };
00058 
00059 #endif //__Module_h_

Generated on Mon Mar 20 22:00:07 2006 for GT2005 by doxygen 1.3.6