Changeset 5641 in orxonox.OLD for trunk/src/lib/util/executor
- Timestamp:
- Nov 18, 2005, 9:22:23 PM (19 years ago)
- Location:
- trunk/src/lib/util/executor
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/util/executor/executor.cc
r5636 r5641 32 32 // SHELL COMMAND BASE // 33 33 //////////////////////// 34 // empty constructor 35 Executor::Executor() 36 { 37 this->defaultValue = NULL; 38 } 39 34 40 /** 35 41 * constructs and registers a new Command … … 63 69 delete[] this->defaultValue; 64 70 } 71 72 /** 73 * clones this element into executor. 74 */ 75 void Executor::cloning(Executor* executor) const 76 { 77 executor->functorType = this->functorType; 78 executor->paramCount = this->paramCount; 79 executor->defaultValue = new MultiType[this->paramCount]; 80 for (unsigned int i = 0; i < this->paramCount; i++) 81 executor->defaultValue[i] = this->defaultValue[i]; 82 } 83 84 65 85 66 86 /** -
trunk/src/lib/util/executor/executor.h
r5636 r5641 22 22 typedef enum { 23 23 Executor_Objective = 1, 24 Executor_Static = 2,24 Executor_Static = 2, 25 25 } Executor_Type; 26 26 … … 32 32 { 33 33 public: 34 virtual ~Executor(); 35 36 virtual Executor* clone () const = 0; 37 34 38 Executor* defaultValues(unsigned int count, ...); 35 39 Executor* defaultValues(unsigned int count, va_list values); … … 38 42 virtual void execute (BaseObject* object, const char* parameters) = 0; 39 43 44 /** @returns the Type of this Function (either static or objective) */ 45 inline Executor_Type getType() const { return this->functorType; }; 46 40 47 static void debug(); 41 48 42 49 protected: 50 Executor(); 43 51 Executor(unsigned int paramCount, ...); 44 ~Executor(); 45 46 /** @returns the Type of this Function (either static or objective) */ 47 inline Executor_Type getType() { return this->functorType; }; 52 53 void cloning(Executor* executor) const; 48 54 49 55 protected: … … 51 57 unsigned int paramCount; //!< the count of parameters. 52 58 MultiType* defaultValue; //!< Default Values. 53 54 private:55 59 }; 56 60 … … 226 230 template<class T> class ExecutorObjective : public Executor 227 231 { 228 229 232 public: 233 ExecutorObjective() : Executor() { }; 234 // COPY constuctor (virtual version) 235 virtual Executor* clone () const 236 { 237 ExecutorObjective<T>* executor = new ExecutorObjective<T>(); 238 this->cloning(executor); 239 executor->fp = this->fp; 240 return executor; 241 } 242 230 243 //! FUNCTOR_LIST is the List of CommandConstructors 231 244 #define FUNCTOR_LIST(x) ExecutorConstructor ## x … … 279 292 { 280 293 public: 294 ExecutorStatic() : Executor() { }; 295 // COPY constuctor 296 virtual Executor* clone () const 297 { 298 ExecutorStatic<T>* executor = new ExecutorStatic<T>(); 299 this->cloning(executor); 300 executor->fp = this->fp; 301 return executor; 302 } 303 281 304 //! FUNCTOR_LIST is the List of CommandConstructors 282 305 #define FUNCTOR_LIST(x) ExecutorConstructor ## x … … 303 326 }; 304 327 305 //! A Class, that handles aliases.306 class ExecutorAlias307 {308 friend class ExecutorBase;309 public:310 /** @returns the Name of the Alias. */311 const char* getName() const { return this->aliasName; };312 /** @returns the Command, this Alias is asociated with */313 ExecutorBase* getCommand() const { return this->command; };314 315 private:316 /** @param aliasName the name of the Alias @param command the Command, to associate this alias with */317 ExecutorAlias(const char* aliasName, ExecutorBase* command) { this->aliasName = aliasName; this->command = command; };318 319 private:320 const char* aliasName; //!< the name of the Alias321 ExecutorBase* command; //!< a pointer to the command, this alias executes.322 };323 324 328 #endif /* _EXECUTOR_H */
Note: See TracChangeset
for help on using the changeset viewer.