- Timestamp:
- Mar 27, 2008, 4:42:53 AM (17 years ago)
- Location:
- code/branches/core2/src/orxonox/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core2/src/orxonox/core/Executor.cc
r931 r932 29 29 #include "Executor.h" 30 30 #include "Language.h" 31 #include "util/String.h"32 31 33 32 namespace orxonox … … 64 63 if (paramCount == 0) 65 64 { 65 COUT(5) << "Calling Executor " << this->name_ << " through parser without parameters." << std::endl; 66 66 (*this->functor_)(); 67 67 } 68 68 else if (paramCount == 1) 69 69 { 70 (*this->functor_)(MultiTypeMath(params)); 70 std::string temp = getStripped(params); 71 if ((temp != "") && (temp.size() != 0)) 72 { 73 COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; 74 (*this->functor_)(MultiTypeMath(params)); 75 } 76 else if (this->bAddedDefaultValue_[0]) 77 { 78 COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using default value: " << this->defaultValue_[0] << std::endl; 79 (*this->functor_)(this->defaultValue_[0]); 80 } 81 else 82 { 83 COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given." << std::endl; 84 return false; 85 } 71 86 } 72 87 else … … 75 90 76 91 for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++) 92 { 77 93 if (!this->bAddedDefaultValue_[i]) 94 { 95 COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given." << std::endl; 78 96 return false; 97 } 98 } 79 99 80 100 MultiTypeMath param[paramCount]; 101 COUT(5) << "Calling Executor " << this->name_ << " through parser with " << paramCount << " parameters, using " << tokens.size() << " tokens ("; 81 102 for (unsigned int i = 0; i < tokens.size(); i++) 103 { 82 104 param[i] = tokens[i]; 105 if (i != 0) 106 { 107 COUT(5) << ", "; 108 } 109 COUT(5) << tokens[i]; 110 } 111 COUT(5) << ") and " << (paramCount - tokens.size()) << " default values ("; 83 112 for (unsigned int i = tokens.size(); i < paramCount; i++) 113 { 84 114 param[i] = this->defaultValue_[i]; 115 if (i != 0) 116 { 117 COUT(5) << ", "; 118 } 119 COUT(5) << this->defaultValue_[i]; 120 } 121 COUT(5) << ")." << std::endl; 85 122 86 123 switch(paramCount) -
code/branches/core2/src/orxonox/core/Executor.h
r931 r932 32 32 #include "CorePrereqs.h" 33 33 #include "Functor.h" 34 #include "Debug.h" 34 35 #include "util/SubString.h" 35 36 #include "util/String.h" 36 37 37 38 namespace orxonox … … 160 161 if (paramCount == 0) 161 162 { 163 COUT(5) << "Calling Executor " << this->name_ << " through parser without parameters." << std::endl; 162 164 (*((FunctorMember<T>*)this->functor_))(object); 163 165 } 164 166 else if (paramCount == 1) 165 167 { 166 (*((FunctorMember<T>*)this->functor_))(object, MultiTypeMath(params)); 168 std::string temp = getStripped(params); 169 if ((temp != "") && (temp.size() != 0)) 170 { 171 COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; 172 (*((FunctorMember<T>*)this->functor_))(object, MultiTypeMath(params)); 173 } 174 else if (this->bAddedDefaultValue_[0]) 175 { 176 COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using default value: " << this->defaultValue_[0] << std::endl; 177 (*((FunctorMember<T>*)this->functor_))(object, this->defaultValue_[0]); 178 } 179 else 180 { 181 COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given." << std::endl; 182 return false; 183 } 167 184 } 168 185 else … … 171 188 172 189 for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++) 190 { 173 191 if (!this->bAddedDefaultValue_[i]) 192 { 193 COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given." << std::endl; 174 194 return false; 195 } 196 } 175 197 176 198 MultiTypeMath param[paramCount]; 199 COUT(5) << "Calling Executor " << this->name_ << " through parser with " << paramCount << " parameters, using " << tokens.size() << " tokens ("; 177 200 for (unsigned int i = 0; i < tokens.size(); i++) 201 { 178 202 param[i] = tokens[i]; 203 if (i != 0) 204 { 205 COUT(5) << ", "; 206 } 207 COUT(5) << tokens[i]; 208 } 209 COUT(5) << ") and " << (paramCount - tokens.size()) << " default values ("; 179 210 for (unsigned int i = tokens.size(); i < paramCount; i++) 211 { 180 212 param[i] = this->defaultValue_[i]; 213 if (i != 0) 214 { 215 COUT(5) << ", "; 216 } 217 COUT(5) << this->defaultValue_[i]; 218 } 219 COUT(5) << ")." << std::endl; 181 220 182 221 switch(paramCount) … … 206 245 if (paramCount == 0) 207 246 { 247 COUT(5) << "Calling Executor " << this->name_ << " through parser without parameters." << std::endl; 208 248 (*((FunctorMember<T>*)this->functor_))(object); 209 249 } 210 250 else if (paramCount == 1) 211 251 { 212 (*((FunctorMember<T>*)this->functor_))(object, MultiTypeMath(params)); 252 std::string temp = getStripped(params); 253 if ((temp != "") && (temp.size() != 0)) 254 { 255 COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using whole string: " << params << std::endl; 256 (*((FunctorMember<T>*)this->functor_))(object, MultiTypeMath(params)); 257 } 258 else if (this->bAddedDefaultValue_[0]) 259 { 260 COUT(5) << "Calling Executor " << this->name_ << " through parser with one parameter, using default value: " << this->defaultValue_[0] << std::endl; 261 (*((FunctorMember<T>*)this->functor_))(object, this->defaultValue_[0]); 262 } 263 else 264 { 265 COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given." << std::endl; 266 return false; 267 } 213 268 } 214 269 else … … 217 272 218 273 for (unsigned int i = tokens.size(); i < this->functor_->getParamCount(); i++) 274 { 219 275 if (!this->bAddedDefaultValue_[i]) 276 { 277 COUT(2) << "Warning: Can't call executor " << this->name_ << " through parser: Not enough parameters or default values given." << std::endl; 220 278 return false; 279 } 280 } 221 281 222 282 MultiTypeMath param[paramCount]; 283 COUT(5) << "Calling Executor " << this->name_ << " through parser with " << paramCount << " parameters, using " << tokens.size() << " tokens ("; 223 284 for (unsigned int i = 0; i < tokens.size(); i++) 285 { 224 286 param[i] = tokens[i]; 287 if (i != 0) 288 { 289 COUT(5) << ", "; 290 } 291 COUT(5) << tokens[i]; 292 } 293 COUT(5) << ") and " << (paramCount - tokens.size()) << " default values ("; 225 294 for (unsigned int i = tokens.size(); i < paramCount; i++) 295 { 226 296 param[i] = this->defaultValue_[i]; 297 if (i != 0) 298 { 299 COUT(5) << ", "; 300 } 301 COUT(5) << this->defaultValue_[i]; 302 } 303 COUT(5) << ")." << std::endl; 227 304 228 305 switch(paramCount)
Note: See TracChangeset
for help on using the changeset viewer.