[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, |
---|
[8894] | 33 | const MultiType& param4, |
---|
| 34 | const MultiType& param5, |
---|
| 35 | const MultiType& param6) |
---|
[3365] | 36 | { |
---|
[7721] | 37 | this->setClassID(CL_EXECUTOR, "Executor"); |
---|
[5141] | 38 | |
---|
[7197] | 39 | // What Parameters have we got |
---|
| 40 | this->defaultValue[0] = param0; |
---|
| 41 | this->defaultValue[1] = param1; |
---|
| 42 | this->defaultValue[2] = param2; |
---|
| 43 | this->defaultValue[3] = param3; |
---|
| 44 | this->defaultValue[4] = param4; |
---|
[8894] | 45 | this->defaultValue[5] = param5; |
---|
| 46 | this->defaultValue[6] = param6; |
---|
[5148] | 47 | |
---|
[7199] | 48 | this->paramCount = 0; |
---|
[7300] | 49 | for (unsigned int i = 0; i <= FUNCTOR_MAX_ARGUMENTS; i++) |
---|
[5659] | 50 | { |
---|
[7300] | 51 | if (this->defaultValue[i] == MT_NULL || i == FUNCTOR_MAX_ARGUMENTS) |
---|
[7197] | 52 | { |
---|
| 53 | this->paramCount = i; |
---|
| 54 | break; |
---|
| 55 | } |
---|
[5659] | 56 | } |
---|
[5068] | 57 | } |
---|
[4320] | 58 | |
---|
[5166] | 59 | /** |
---|
[5632] | 60 | * deconstructs a Executor |
---|
[5166] | 61 | */ |
---|
[5632] | 62 | Executor::~Executor() |
---|
[7197] | 63 | {} |
---|
[1853] | 64 | |
---|
[5166] | 65 | /** |
---|
[5641] | 66 | * clones this element into executor. |
---|
| 67 | */ |
---|
| 68 | void Executor::cloning(Executor* executor) const |
---|
| 69 | { |
---|
| 70 | executor->functorType = this->functorType; |
---|
| 71 | executor->paramCount = this->paramCount; |
---|
| 72 | for (unsigned int i = 0; i < this->paramCount; i++) |
---|
[5659] | 73 | executor->defaultValue[i] = this->defaultValue[i]; |
---|
[5641] | 74 | } |
---|
| 75 | |
---|
| 76 | /** |
---|
[7198] | 77 | * @brief set the default values of the executor |
---|
| 78 | * @param value0 the first default value |
---|
| 79 | * @param value1 the second default value |
---|
| 80 | * @param value2 the third default value |
---|
| 81 | * @param value3 the fourth default value |
---|
| 82 | * @param value4 the fifth default value |
---|
[5207] | 83 | * @returns itself |
---|
| 84 | */ |
---|
[7198] | 85 | Executor* Executor::defaultValues(const MultiType& value0, |
---|
| 86 | const MultiType& value1, |
---|
| 87 | const MultiType& value2, |
---|
| 88 | const MultiType& value3, |
---|
[8894] | 89 | const MultiType& value4, |
---|
| 90 | const MultiType& value5, |
---|
| 91 | const MultiType& value6) |
---|
[5207] | 92 | { |
---|
| 93 | if (this == NULL) |
---|
| 94 | return NULL; |
---|
| 95 | |
---|
[7198] | 96 | const MultiType* value[5]; |
---|
| 97 | value[0] = &value0; |
---|
| 98 | value[1] = &value1; |
---|
| 99 | value[2] = &value2; |
---|
| 100 | value[3] = &value3; |
---|
| 101 | value[4] = &value4; |
---|
[8894] | 102 | value[5] = &value5; |
---|
| 103 | value[6] = &value6; |
---|
[7198] | 104 | for (unsigned int i = 0; i < this->paramCount; i++) |
---|
[5207] | 105 | { |
---|
[7198] | 106 | if (*value[i] != MT_NULL) |
---|
[7200] | 107 | { |
---|
[7221] | 108 | this->defaultValue[i].setValueOf(*value[i]); |
---|
[7200] | 109 | } |
---|
[5207] | 110 | } |
---|
| 111 | return this; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | /** |
---|
[7742] | 115 | * @brief prints out nice information about the Executor |
---|
[5166] | 116 | */ |
---|
[5632] | 117 | void Executor::debug() |
---|
[5148] | 118 | { |
---|
| 119 | |
---|
| 120 | } |
---|