[4744] | 1 | /* |
---|
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
[5068] | 12 | main-programmer: Benjamin Grauer |
---|
[1855] | 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[3955] | 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
[1853] | 17 | |
---|
[5632] | 18 | #include "executor.h" |
---|
[1853] | 19 | |
---|
[5552] | 20 | //////////////////////// |
---|
| 21 | // SHELL COMMAND BASE // |
---|
| 22 | //////////////////////// |
---|
[5170] | 23 | /** |
---|
[7714] | 24 | * @brief constructs and registers a new Command |
---|
[5166] | 25 | * @param commandName the name of the Command |
---|
| 26 | * @param className the name of the class to apply this command to |
---|
| 27 | * @param paramCount the count of parameters this command takes |
---|
| 28 | */ |
---|
[7197] | 29 | Executor::Executor(const MultiType& param0, |
---|
| 30 | const MultiType& param1, |
---|
| 31 | const MultiType& param2, |
---|
| 32 | const MultiType& param3, |
---|
| 33 | const MultiType& param4) |
---|
[3365] | 34 | { |
---|
[7721] | 35 | this->setClassID(CL_EXECUTOR, "Executor"); |
---|
[5141] | 36 | |
---|
[7197] | 37 | // What Parameters have we got |
---|
| 38 | this->defaultValue[0] = param0; |
---|
| 39 | this->defaultValue[1] = param1; |
---|
| 40 | this->defaultValue[2] = param2; |
---|
| 41 | this->defaultValue[3] = param3; |
---|
| 42 | this->defaultValue[4] = param4; |
---|
[5148] | 43 | |
---|
[7199] | 44 | this->paramCount = 0; |
---|
[7300] | 45 | for (unsigned int i = 0; i <= FUNCTOR_MAX_ARGUMENTS; i++) |
---|
[5659] | 46 | { |
---|
[7300] | 47 | if (this->defaultValue[i] == MT_NULL || i == FUNCTOR_MAX_ARGUMENTS) |
---|
[7197] | 48 | { |
---|
| 49 | this->paramCount = i; |
---|
| 50 | break; |
---|
| 51 | } |
---|
[5659] | 52 | } |
---|
[5068] | 53 | } |
---|
[4320] | 54 | |
---|
[5166] | 55 | /** |
---|
[5632] | 56 | * deconstructs a Executor |
---|
[5166] | 57 | */ |
---|
[5632] | 58 | Executor::~Executor() |
---|
[7197] | 59 | {} |
---|
[1853] | 60 | |
---|
[5166] | 61 | /** |
---|
[5641] | 62 | * clones this element into executor. |
---|
| 63 | */ |
---|
| 64 | void Executor::cloning(Executor* executor) const |
---|
| 65 | { |
---|
| 66 | executor->functorType = this->functorType; |
---|
| 67 | executor->paramCount = this->paramCount; |
---|
| 68 | for (unsigned int i = 0; i < this->paramCount; i++) |
---|
[5659] | 69 | executor->defaultValue[i] = this->defaultValue[i]; |
---|
[5641] | 70 | } |
---|
| 71 | |
---|
| 72 | /** |
---|
[7198] | 73 | * @brief set the default values of the executor |
---|
| 74 | * @param value0 the first default value |
---|
| 75 | * @param value1 the second default value |
---|
| 76 | * @param value2 the third default value |
---|
| 77 | * @param value3 the fourth default value |
---|
| 78 | * @param value4 the fifth default value |
---|
[5207] | 79 | * @returns itself |
---|
| 80 | */ |
---|
[7198] | 81 | Executor* Executor::defaultValues(const MultiType& value0, |
---|
| 82 | const MultiType& value1, |
---|
| 83 | const MultiType& value2, |
---|
| 84 | const MultiType& value3, |
---|
| 85 | const MultiType& value4) |
---|
[5207] | 86 | { |
---|
| 87 | if (this == NULL) |
---|
| 88 | return NULL; |
---|
| 89 | |
---|
[7198] | 90 | const MultiType* value[5]; |
---|
| 91 | value[0] = &value0; |
---|
| 92 | value[1] = &value1; |
---|
| 93 | value[2] = &value2; |
---|
| 94 | value[3] = &value3; |
---|
| 95 | value[4] = &value4; |
---|
[5207] | 96 | |
---|
[7198] | 97 | for (unsigned int i = 0; i < this->paramCount; i++) |
---|
[5207] | 98 | { |
---|
[7198] | 99 | if (*value[i] != MT_NULL) |
---|
[7200] | 100 | { |
---|
[7221] | 101 | this->defaultValue[i].setValueOf(*value[i]); |
---|
[7200] | 102 | } |
---|
[5207] | 103 | } |
---|
| 104 | return this; |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | /** |
---|
[7742] | 108 | * @brief prints out nice information about the Executor |
---|
[5166] | 109 | */ |
---|
[5632] | 110 | void Executor::debug() |
---|
[5148] | 111 | { |
---|
| 112 | |
---|
| 113 | } |
---|