00001 /** 00002 * @file Xabsl2BehaviorControl.h 00003 * 00004 * Implementation of class Xabsl2BehaviorControl. 00005 * 00006 * @author Matthias Jüngel 00007 * @author Martin Lötzsch 00008 */ 00009 00010 #ifndef __Xabsl2BehaviorControl_h_ 00011 #define __Xabsl2BehaviorControl_h_ 00012 00013 #include "BehaviorControl.h" 00014 #include "Tools/Xabsl2/GT/GTXabsl2EngineExecutor.h" 00015 00016 00017 /** 00018 * @class Xabsl2BehaviorControl 00019 * 00020 * Base class for all BehaviorControl solutions that use a Xabsl2Engine 00021 * 00022 * @author Matthias Jüngel 00023 * @author Martin Lötzsch 00024 */ 00025 class Xabsl2BehaviorControl : public BehaviorControl, public GTXabsl2EngineExecutor 00026 { 00027 public: 00028 /** 00029 * Constructor. 00030 * @param interfaces The paramters of the BehaviorControl module. 00031 * @param id The id of the Xabsl2Engine. 00032 */ 00033 Xabsl2BehaviorControl(const BehaviorControlInterfaces& interfaces, 00034 SolutionRequest::xabsl2EngineID id); 00035 00036 /** destructor */ 00037 ~Xabsl2BehaviorControl() {}; 00038 00039 /** 00040 * Is called for every incoming debug message. 00041 * @param message An interface to read the message from the queue 00042 * @return if the messag was read 00043 */ 00044 virtual bool handleMessage(InMessage& message); 00045 00046 protected: 00047 00048 /** Is called if the engine could not be created */ 00049 virtual void executeIfEngineCouldNotBeCreated(); 00050 00051 /** 00052 * Prints the main action that was generated by the execution of the engine to a string 00053 * @param buf the string where to print the action 00054 */ 00055 virtual void printGeneratedMainActionToString(char* buf); 00056 00057 }; 00058 00059 /** 00060 * Allows to register the same Xabsl2BehaviorControl instance more than once 00061 * at a ModuleHandler to be able to switch between different agents using the 00062 * GT Module mechanism. 00063 */ 00064 class Xabsl2BehaviorControlAgentInterface : public BehaviorControl, public Xabsl2NamedItem 00065 { 00066 public: 00067 /** 00068 * Constructor 00069 * @param name The name of the agent 00070 * @param behaviorControl A newly created Xabsl2BehaviorControl can contains the agent. 00071 * @param interfaces The paramters of the BehaviorControl module. 00072 */ 00073 Xabsl2BehaviorControlAgentInterface(const char* name, 00074 Xabsl2BehaviorControl* behaviorControl, 00075 const BehaviorControlInterfaces& interfaces); 00076 00077 /** Destructor. Deletes the Xabsl2BehaviorControl */ 00078 ~Xabsl2BehaviorControlAgentInterface(); 00079 00080 /** Executes the agent */ 00081 virtual void execute(); 00082 00083 /** 00084 * Is called for every incoming debug message. 00085 * @param message An interface to read the message from the queue 00086 * @return if the messag was read 00087 */ 00088 virtual bool handleMessage(InMessage& message); 00089 00090 private: 00091 /** A pointer to the Xabsl2BehaviorControl can contains the agent. */ 00092 Xabsl2BehaviorControl* behaviorControl; 00093 }; 00094 00095 #endif// __Xabsl2BehaviorControl_h_
1.3.6