Changeset 5929 for code/trunk/src/libraries/core/Event.h
- Timestamp:
- Oct 12, 2009, 8:20:07 PM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/core5 (added) merged: 5768-5769,5772,5775-5780,5783-5785,5791-5792,5795-5807,5809-5814,5816-5832,5836-5839,5842-5853,5855-5899,5904-5922,5924-5928
- Property svn:mergeinfo changed
-
code/trunk/src/libraries/core/Event.h
r5781 r5929 35 35 namespace orxonox 36 36 { 37 /** 38 @brief The Event struct contains information about a fired Event. 39 */ 37 40 struct _CoreExport Event 38 41 { 39 Event(bool activate, BaseObject* originator) : activate_(activate), originator_(originator), castedOriginator_(0) {}42 Event(bool activate, BaseObject* originator, const std::string& name) : activate_(activate), originator_(originator), name_(name) {} 40 43 41 bool activate_;42 BaseObject* originator_;43 void* castedOriginator_;44 std::string sectionname_;44 bool activate_; //!< True if this is an activating event (the event source was inactive before and just triggered the event) - false otherwise 45 std::string statename_; //!< The name of the state this event affects 46 BaseObject* originator_; //!< The object which triggered this event 47 std::string name_; //!< The name of this event 45 48 }; 46 49 47 class _CoreExport EventContainer 50 /** 51 @brief The EventState contains information about an event state. 52 53 An event state is a state of an object, which can be changed by events. 54 Event states are changed through functions. Possible functions headers for set event states are: 55 - memoryless state: function() 56 - boolean state: function(bool state) 57 - individual state: function(bool state, SomeClass originator) 58 59 Note that SomeClass may be any class deriving from BaseObject. You will not receive events from originators of other classes. 60 The actual class for SomeClass must be specified as the second argument of the XMLPortEventState macro. 61 62 The this pointer of the affected object is hidden in the functors, because the events are processed in the BaseObject, but some 63 statefunctions may be from child-classes. 64 */ 65 class _CoreExport EventState 48 66 { 49 67 public: 50 Event Container(const std::string& eventname, Executor* eventfunction, Identifier* subclass) : bActive_(false), eventname_(eventname), eventfunction_(eventfunction), subclass_(subclass), activeEvents_(0) {}51 virtual ~Event Container();68 EventState(Functor* statefunction, Identifier* subclass) : bProcessingEvent_(false), activeEvents_(0), statefunction_(statefunction), subclass_(subclass) {} 69 virtual ~EventState(); 52 70 53 void process(BaseObject* object, const Event& event); 71 void process(const Event& event, BaseObject* object); 72 73 Functor* getFunctor() const 74 { return this->statefunction_; } 54 75 55 76 private: 56 bool bActive_; 57 std::string eventname_; 58 Executor* eventfunction_; 59 Identifier* subclass_; 60 61 int activeEvents_; 77 bool bProcessingEvent_; //!< This becomes true while the container processes an event (used to prevent loops) 78 int activeEvents_; //!< The number of events which affect this state and are currently active 79 Functor* statefunction_; //!< A functor to set the state 80 Identifier* subclass_; //!< Originators must be an instance of this class (usually BaseObject, but some statefunctions allow a second argument with an originator of a specific class) 62 81 }; 63 82 }
Note: See TracChangeset
for help on using the changeset viewer.