Changeset 5883 for code/branches/core5/src/libraries/core
- Timestamp:
- Oct 5, 2009, 10:50:19 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/BaseObject.cc
r5882 r5883 356 356 { 357 357 if (this->mainStateFunctor_) 358 (*this->mainStateFunctor_)(state); 358 { 359 if (this->mainStateFunctor_->getParamCount() == 0) 360 { 361 if (state) 362 (*this->mainStateFunctor_)(); 363 } 364 else 365 { 366 (*this->mainStateFunctor_)(state); 367 } 368 } 359 369 else 360 370 COUT(2) << "Warning: No MainState defined in object \"" << this->getName() << "\" (" << this->getIdentifier()->getName() << ")" << std::endl; … … 366 376 void BaseObject::changedMainStateName() 367 377 { 368 this->registerEventStates();369 370 378 this->mainStateFunctor_ = 0; 371 372 std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(this->mainStateName_); 373 if (it != this->eventStates_.end() && it->second->getFunctor() && it->second->getFunctor()->getParamCount() == 1) 374 this->mainStateFunctor_ = it->second->getFunctor(); 375 else 376 COUT(2) << "Warning: \"" << this->mainStateName_ << "\" is not a valid MainState." << std::endl; 379 380 if (this->mainStateName_ != "") 381 { 382 this->registerEventStates(); 383 384 std::map<std::string, EventState*>::const_iterator it = this->eventStates_.find(this->mainStateName_); 385 if (it != this->eventStates_.end() && it->second->getFunctor()) 386 { 387 if (it->second->getFunctor()->getParamCount() <= 1) 388 this->mainStateFunctor_ = it->second->getFunctor(); 389 else 390 COUT(2) << "Warning: Can't use \"" << this->mainStateName_ << "\" as MainState because it needs a second argument." << std::endl; 391 } 392 else 393 COUT(2) << "Warning: \"" << this->mainStateName_ << "\" is not a valid MainState." << std::endl; 394 } 377 395 } 378 396
Note: See TracChangeset
for help on using the changeset viewer.