Changeset 7271 for code/trunk
- Timestamp:
- Aug 30, 2010, 8:07:38 PM (14 years ago)
- Location:
- code/trunk/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/CorePrereqs.h
r7169 r7271 115 115 { 116 116 typedef std::string LanguageEntryLabel; 117 118 template <class T, class U> 119 T orxonox_cast(U*); 117 120 118 121 class ArgumentCompleter; -
code/trunk/src/libraries/core/Event.cc
r7163 r7271 103 103 { 104 104 // else cast the pointer to the desired class 105 void* cast edOriginator = event.originator_->getDerivedPointer(this->subclass_->getClassID());106 (*this->statefunction_)(event.activate_, cast edOriginator);105 void* castOriginator = event.originator_->getDerivedPointer(this->subclass_->getClassID()); 106 (*this->statefunction_)(event.activate_, castOriginator); 107 107 } 108 108 } -
code/trunk/src/libraries/core/Identifier.h
r7266 r7271 484 484 */ 485 485 template <class T, class U> 486 FORCEINLINE T orxonox_cast(U source)486 FORCEINLINE T orxonox_cast(U* source) 487 487 { 488 488 #ifdef ORXONOX_COMPILER_MSVC -
code/trunk/src/libraries/core/Iterator.h
r7268 r7271 32 32 33 33 The Iterator of a given class allows to iterate through an ObjectList. Objects in 34 this list are cast edto the template argument of the Iterator.34 this list are cast to the template argument of the Iterator. 35 35 36 36 Usage: … … 95 95 inline Iterator(ObjectListElement<O>* element) 96 96 { 97 this->element_ = (element) ? static_cast<ObjectListBaseElement*>(element) : 0;97 this->element_ = element; 98 98 this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects(); 99 99 this->list_->registerIterator(this); … … 107 107 inline Iterator(const ObjectListIterator<O>& other) 108 108 { 109 this->element_ = (other.element_) ? static_cast<ObjectListBaseElement*>(other.element_) : 0;109 this->element_ = other.element_; 110 110 this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects(); 111 111 this->list_->registerIterator(this); … … 162 162 this->list_->unregisterIterator(this); 163 163 164 this->element_ = (element) ? static_cast<ObjectListBaseElement*>(element) : 0;164 this->element_ = element; 165 165 this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects(); 166 166 this->list_->registerIterator(this); … … 179 179 this->list_->unregisterIterator(this); 180 180 181 this->element_ = (other.element_) ? static_cast<ObjectListBaseElement*>(other.element_) : 0;181 this->element_ = other.element_; 182 182 this->list_ = ClassIdentifier<O>::getIdentifier()->getObjects(); 183 183 this->list_->registerIterator(this); -
code/trunk/src/libraries/core/ObjectList.h
r5738 r7271 61 61 /** @brief Returns an Iterator to the first element in the list. @return The Iterator */ 62 62 inline static ObjectListElement<T>* begin() 63 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->begin().element_); } 63 { 64 ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects(); 65 return static_cast<ObjectListElement<T>*>(list->begin().element_); 66 } 64 67 65 68 /** @brief Returns an Iterator to the element after the last element in the list. @return The Iterator */ 66 69 inline static ObjectListElement<T>* end() 67 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->end().element_); } 70 { 71 ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects(); 72 return static_cast<ObjectListElement<T>*>(list->end().element_); 73 } 68 74 69 75 /** @brief Returns an Iterator to the last element in the list. @return The Iterator */ 70 76 inline static ObjectListElement<T>* rbegin() 71 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->rbegin().element_); } 77 { 78 ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects(); 79 return static_cast<ObjectListElement<T>*>(list->rbegin().element_); 80 } 72 81 73 82 /** @brief Returns an Iterator to the element before the first element in the list. @return The Iterator */ 74 83 inline static ObjectListElement<T>* rend() 75 { return ((ObjectListElement<T>*)ClassIdentifier<T>::getIdentifier()->getObjects()->rend().element_); } 84 { 85 ObjectListBase* list = ClassIdentifier<T>::getIdentifier()->getObjects(); 86 return static_cast<ObjectListElement<T>*>(list->rend().element_); 87 } 76 88 }; 77 89 } -
code/trunk/src/libraries/core/XMLPort.h
r7163 r7271 541 541 void callLoadExecutor(BaseObject* object, BaseObject* newObject) 542 542 { 543 T* cast edObject = orxonox_cast<T*>(object);544 assert(cast edObject);545 O* cast edNewObject = orxonox_cast<O*>(newObject);546 assert(cast edNewObject);547 548 (*this->loadexecutor_)(cast edObject, castedNewObject);543 T* castObject = orxonox_cast<T*>(object); 544 assert(castObject); 545 O* castNewObject = orxonox_cast<O*>(newObject); 546 assert(castNewObject); 547 548 (*this->loadexecutor_)(castObject, castNewObject); 549 549 } 550 550 -
code/trunk/src/libraries/core/input/InputDevice.h
r7174 r7271 132 132 { 133 133 oisDevice_ = static_cast<OISDeviceClass*>(oisInputManager_->createInputObject(OISDeviceValue, true)); 134 // Note: after the static_cast here, the cast edthis pointer becomes134 // Note: after the static_cast here, the cast this pointer becomes 135 135 // invalid right until the subclass has been constructed! 136 136 oisDevice_->setEventCallback(static_cast<DeviceClass*>(this)); -
code/trunk/src/modules/objects/triggers/MultiTrigger.h
r7163 r7271 82 82 'simultaniousTriggerers': The number of simultanious triggerers limits the number of object that are allowed to trigger the MultiTrigger at the same time. Or a little more precisely, the number of distinct objects the MultiTrigger has 'triggered' states for, at each point in time. 83 83 'mode': The mode describes how the MultiTrigger acts in relation to all the MultiTriggers, that are appended to it. There are 3 modes: 'and', meaning that the MultiTrigger can only be triggered if all the appended MultiTriggers are active. 'or', meaning that the MultiTrigger can only triggered if at least one of the appendend MultiTriggers is active. And 'xor', meaning that the MultiTrigger can only be triggered if one and only one appended MultiTrigger is active. Notice, that I wrote 'can only be active', that implies, that there is an addtitional condition to the activity of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the activity of a MultiTrigger is still coupled to the object that triggered it. The default is 'and'. 84 'broadcast' Broadcast is a bool, if true the MutliTrigger is in broadcast-mode, meaining, that all trigger events that are caused by no originator (originator is NULL) are broadcast edas having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger.84 'broadcast' Broadcast is a bool, if true the MutliTrigger is in broadcast-mode, meaining, that all trigger events that are caused by no originator (originator is NULL) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. 85 85 'target': The target describes the kind of objects that are allowed to trigger this MultiTrigger. The default is 'Pawn'. 86 86 Also there is the possibility of appending MultiTriggers to the MultiTrigger just by adding them as subobjects in the XML description of your MultiTrigger.
Note: See TracChangeset
for help on using the changeset viewer.