>xabsl | The Extensible Agent Behavior Specification Language |
start | team | language reference | tools | xabsl engine | download | licence | |
XabslEngine Class Library Reference | |
  | |
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members
XabslOption.hGo to the documentation of this file.00001 /** 00002 * @file XabslOption.h 00003 * 00004 * Definition of class Option and Helper classes 00005 * 00006 * @author <a href="http://www.martin-loetzsch.de">Martin Loetzsch</a> 00007 * @author <a href="http://www.sim.informatik.tu-darmstadt.de/pers/card/risler.html">Max Risler</a> 00008 */ 00009 00010 #ifndef __XabslOption_h_ 00011 #define __XabslOption_h_ 00012 00013 #include "XabslState.h" 00014 #include "XabslBehavior.h" 00015 00016 namespace xabsl 00017 { 00018 00019 /** 00020 * @class OptionParameters 00021 * 00022 * Represents the current set of parameters of an option or basic behavior 00023 * 00024 * @author <a href="http://www.martin-loetzsch.de">Martin Loetzsch</a> 00025 * @author <a href="http://www.sim.informatik.tu-darmstadt.de/pers/card/risler.html">Max Risler</a> 00026 */ 00027 class OptionParameters : public Parameters 00028 { 00029 public: 00030 /** 00031 * Constructor. 00032 * @param input An input source for the intermediate code. It must be opened and read until 00033 * A position where an option starts. 00034 * @param errorHandler A reference to a ErrorHandler instance 00035 * @param symbols All available symbols 00036 */ 00037 OptionParameters(InputSource& input, 00038 ErrorHandler& errorHandler, 00039 Symbols& symbols); 00040 00041 /** Destructor */ 00042 ~OptionParameters(); 00043 }; 00044 00045 /** 00046 * @class Option 00047 * 00048 * Represents a single option written in 00049 * 00050 * @author <a href="http://www.martin-loetzsch.de">Martin Loetzsch</a> 00051 * @author <a href="http://www.sim.informatik.tu-darmstadt.de/pers/card/risler.html">Max Risler</a> 00052 */ 00053 class Option : public Behavior 00054 { 00055 public: 00056 /** 00057 * Constructor. Does not create the option. 00058 * @param name The name of the option. For debugging purposes. 00059 * @param input An input source for the intermediate code. It must be opened and read until 00060 * A position where an option starts. 00061 * @param errorHandler A reference to a ErrorHandler instance 00062 * @param symbols All available symbols 00063 * @param time The system time in ms. 00064 * @param Index of the option in array options in corresponding engine 00065 */ 00066 Option(const char* name, InputSource& input, 00067 ErrorHandler& errorHandler, 00068 Symbols& symbols, 00069 const unsigned& time, 00070 int index); 00071 00072 /** Destructor. Deletes the states */ 00073 ~Option(); 00074 00075 /** 00076 * Creates the option and it's states from the intermediate code. 00077 * @param input An input source for the intermediate code. It must be opened and read until 00078 * A position where an option starts. 00079 * @param options All other options 00080 * @param basicBehaviors All basic behaviors 00081 * @param symbols All available symbols 00082 * @param agentPriority Priority value of the agent, used for solving conflicts in cooperative state assignment 00083 * @param synchronizationTicks Number of execution cycles that is required for synchonization with other agents, i.e time from sending a message until answer is received 00084 */ 00085 void create(InputSource& input, 00086 NamedArray<Option*>& options, 00087 NamedArray<BasicBehavior*>& basicBehaviors, 00088 Symbols& symbols, 00089 const int& agentPriority, 00090 const int& synchronizationTicks); 00091 00092 /** 00093 * Executes the option. The state machine is carried out to determine the subsequent 00094 * option or the subsequent basic behavior. Output symbols are set. 00095 */ 00096 virtual void execute(); 00097 00098 /** The states of the option */ 00099 NamedArray<State*> states; 00100 00101 /** A pointer to the active state. If 0, then no state is active */ 00102 State* activeState; 00103 00104 /** Returns wheter the option reached a target state */ 00105 bool getOptionReachedATargetState() const; 00106 00107 /** Index of the option in array options in corresponding engine */ 00108 int index; 00109 00110 private: 00111 00112 /** A pointer to the initial state */ 00113 State* initialState; 00114 00115 /** Used for error handling */ 00116 ErrorHandler& errorHandler; 00117 00118 /** The system time in ms. */ 00119 const unsigned& time; 00120 }; 00121 00122 } // namespace 00123 00124 #endif //__XabslOption_h_ Up | Main Page | Generated at Wed Aug 19 17:32:29 2009.
|
|
Copyright 2002 - 2009 by the XABSL developer team. See the licence for details. | |