Changeset 9727 in orxonox.OLD for branches/new_class_id/src/lib/util/executor/executor.h
- Timestamp:
- Sep 14, 2006, 5:24:31 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/new_class_id/src/lib/util/executor/executor.h
r9715 r9727 18 18 Executor_Objective = 1, 19 19 Executor_Static = 2, 20 21 Executor_NoLoadString = 8,22 20 } Executor_Type; 23 21 … … 36 34 * Functions with many types (@see functor_list.h) 37 35 */ 38 class Executor : public BaseObject36 class ExecutorBase : public BaseObject 39 37 { 40 ObjectListDeclaration(Executor );41 42 virtual ~Executor();38 ObjectListDeclaration(ExecutorBase); 39 public: 40 // virtual bool operator==(const Executor* executor) const = 0; 43 41 44 virtual Executor* clone () const = 0;45 // virtual bool operator==(const Executor* executor) const = 0;42 /** @param i the i'th defaultValue, @returns reference to the MultiType */ 43 inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; }; 46 44 47 // SETTING up the EXECUTOR 48 Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL, 49 const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL, 50 const MultiType& value4 = MT_NULL, const MultiType& param5 = MT_NULL, 51 const MultiType& param6 = MT_NULL); 52 /** @param i the i'th defaultValue, @returns reference to the MultiType */ 53 inline MultiType& getDefaultValue(unsigned int i) { return defaultValue[i]; }; 45 // EXECUTE 46 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 47 // virtual void operator()(BaseObject* object, int& count, void* values) const = 0; 48 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */ 49 // virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0; 54 50 55 // EXECUTE 56 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 57 virtual void operator()(BaseObject* object, int& count, void* values) const = 0; 58 /** executes a Command @param object the object to apply this to @param parameters the parameters the command takes */ 59 virtual void operator()(BaseObject* object, const SubString& sub = SubString()) const = 0; 51 // RETRIEVE INFORMATION 52 /** @returns the Type of this Function (either static or objective) */ 53 inline long getType() const { return this->functorType; }; 54 /** @returns the Count of Parameters this Executor takes */ 55 inline unsigned int getParamCount() const { return this->paramCount; }; 56 /** @returns true if the Executor has a return Value. */ 57 inline bool hasRetVal() const { return bRetVal; }; 60 58 61 // RETRIEVE INFORMATION 62 /** @returns the Type of this Function (either static or objective) */ 63 inline long getType() const { return this->functorType; }; 64 /** @returns the Count of Parameters this Executor takes */ 65 inline unsigned int getParamCount() const { return this->paramCount; }; 59 static void debug(); 66 60 67 static void debug(); 61 protected: 62 ExecutorBase(bool hasRetVal = false, 63 const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL, 64 const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL, 65 const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL, 66 const MultiType& param6 = MT_NULL); 68 67 69 protected:70 Executor(const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL,71 const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL,72 const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL,73 const MultiType& param6 = MT_NULL);68 // SETTING up the EXECUTOR 69 void defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL, 70 const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL, 71 const MultiType& value4 = MT_NULL, const MultiType& param5 = MT_NULL, 72 const MultiType& param6 = MT_NULL); 74 73 75 void cloning(Executor* executor) const;74 void cloning(ExecutorBase* executor) const; 76 75 77 protected: 78 short functorType; //!< The type of Function we've got (either static or objective). 79 unsigned int paramCount; //!< the count of parameters. 80 MultiType defaultValue[7]; //!< Default Values. 76 protected: 77 short functorType; //!< The type of Function we've got (either static or objective). 78 unsigned int paramCount; //!< the count of parameters. 79 MultiType defaultValue[7]; //!< Default Values. 80 81 bool bRetVal; //!< True if the Executor has a return Value. 81 82 }; 83 84 template <typename CallType> class Executor : public ExecutorBase 85 { 86 public: 87 virtual Executor<CallType>* clone () const = 0; 88 89 /** executes a Command. @param objec the Object, @param count how many values, @param values the Values */ 90 virtual void operator()(BaseObject* object, CallType& values) const = 0; 91 92 /** 93 * @brief set the default values of the executor 94 * @param value0 the first default value 95 * @param value1 the second default value 96 * @param value2 the third default value 97 * @param value3 the fourth default value 98 * @param value4 the fifth default value 99 * @returns itself 100 * @note: THIS FUNCTION WILL BE REPLACED BY A CONFIGURATOR (most probably). 101 */ 102 Executor* defaultValues(const MultiType& value0 = MT_NULL, const MultiType& value1 = MT_NULL, 103 const MultiType& value2 = MT_NULL, const MultiType& value3 = MT_NULL, 104 const MultiType& value4 = MT_NULL, const MultiType& value5 = MT_NULL, 105 const MultiType& value6 = MT_NULL) 106 { 107 this->ExecutorBase::defaultValues(value0, value1, value2, value3, value4, value5, value6); 108 return this; 109 } 110 111 112 113 protected: 114 Executor(bool hasRetVal, 115 const MultiType& param0 = MT_NULL, const MultiType& param1 = MT_NULL, 116 const MultiType& param2 = MT_NULL, const MultiType& param3 = MT_NULL, 117 const MultiType& param4 = MT_NULL, const MultiType& param5 = MT_NULL, 118 const MultiType& param6 = MT_NULL) 119 : ExecutorBase(hasRetVal, param0, param1, param2, param3, param4, param5, param6) 120 {} 121 }; 122 123 82 124 83 125 #include "executor/executor_functional.h"
Note: See TracChangeset
for help on using the changeset viewer.