Changeset 5888 for code/branches/core5/src/libraries/core
- Timestamp:
- Oct 6, 2009, 4:56:42 AM (15 years ago)
- Location:
- code/branches/core5/src/libraries/core
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/BaseObject.cc
r5887 r5888 300 300 @brief Fires an event (without a state). 301 301 */ 302 void BaseObject::fireEvent( )303 { 304 this->fireEvent(true );305 this->fireEvent(false );302 void BaseObject::fireEvent(const std::string& name) 303 { 304 this->fireEvent(true, name); 305 this->fireEvent(false, name); 306 306 } 307 307 … … 309 309 @brief Fires an event which activates or deactivates a state. 310 310 */ 311 void BaseObject::fireEvent(bool activate )312 { 313 this->fireEvent(activate, this );311 void BaseObject::fireEvent(bool activate, const std::string& name) 312 { 313 this->fireEvent(activate, this, name); 314 314 } 315 315 … … 317 317 @brief Fires an event which activates or deactivates a state with agiven originator (the object which triggered the event). 318 318 */ 319 void BaseObject::fireEvent(bool activate, BaseObject* originator )320 { 321 Event event(activate, originator );319 void BaseObject::fireEvent(bool activate, BaseObject* originator, const std::string& name) 320 { 321 Event event(activate, originator, name); 322 322 323 323 for (std::set<BaseObject*>::iterator it = this->eventListeners_.begin(); it != this->eventListeners_.end(); ++it) -
code/branches/core5/src/libraries/core/BaseObject.h
r5887 r5888 161 161 BaseObject* getEventListener(unsigned int index) const; 162 162 163 void fireEvent( );164 void fireEvent(bool activate );165 void fireEvent(bool activate, BaseObject* originator );163 void fireEvent(const std::string& name = ""); 164 void fireEvent(bool activate, const std::string& name = ""); 165 void fireEvent(bool activate, BaseObject* originator, const std::string& name = ""); 166 166 void fireEvent(Event& event); 167 167 -
code/branches/core5/src/libraries/core/Event.h
r5879 r5888 40 40 struct _CoreExport Event 41 41 { 42 Event(bool activate, BaseObject* originator ) : activate_(activate), originator_(originator) {}42 Event(bool activate, BaseObject* originator, const std::string& name) : activate_(activate), originator_(originator), name_(name) {} 43 43 44 44 bool activate_; //!< True if this is an activating event (the event source was inactive before and just triggered the event) - false otherwise 45 45 std::string statename_; //!< The name of the state this event affects 46 46 BaseObject* originator_; //!< The object which triggered this event 47 std::string name_; //!< The name of this event 47 48 }; 48 49 -
code/branches/core5/src/libraries/core/EventIncludes.h
r5879 r5888 68 68 static orxonox::ExecutorMember<classname>* xmlgetfunctor##name = (orxonox::ExecutorMember<classname>*)&orxonox::createExecutor(orxonox::createFunctor(&classname::getEventSource), std::string( #classname ) + "::" + "getEventSource" + "(" + statename + ")")->setDefaultValue(1, statename); \ 69 69 XMLPortObjectGeneric(xmlport##name, classname, orxonox::BaseObject, statename, xmlsetfunctor##name, xmlgetfunctor##name, xmlelement, mode, false, true) 70 71 72 /** 73 @brief Defines a new event name for a class. Named events can only have names which were defined with this macro. 74 75 @param classname The name of the class 76 @param name The name of the event 77 */ 78 #define CreateEventName(classname, name) \ 79 static std::string eventname##classname##name = #name 80 81 /** 82 @brief This macro is needed to fire an event with this name. The event name must previously be declared with @ref CreateEventName. 83 */ 84 #define EventName(classname, name) \ 85 eventname##classname##name 70 86 71 87 #endif /* _EventIncludes_H__ */
Note: See TracChangeset
for help on using the changeset viewer.