1 // File: Events_Message.hxx
2 // Created: Thu Mar 13 2014
3 // Author: Mikhail PONIKAROV
5 #ifndef Events_Message_HeaderFile
6 #define Events_Message_HeaderFile
12 * \brief Identifier of the event kind.
14 * Each event ID is created in main Envent_Loop class
15 * that stores correspondance between the string-name of the
16 * identifier and the pointer to the static string that is really
17 * used as an identifier (this is usefull for debugging of the events
18 * with log files and in debugger).
20 class EVENTS_EXPORT Events_ID {
21 char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type
23 Events_ID(char* theID) {myID = theID;}
25 friend class Events_Loop;
27 /// Returns the text-identifier of the event (for debugging reasons)
28 char* eventText() const {return myID;}
29 /// Allows to compare identifiers
30 bool operator==(const Events_ID& theID) const {return myID == theID.myID;}
33 /**\class Events_Message
35 * \brief Message for communication between sender and listener of event.
36 * Normally it is inherited by the higher-level
38 class EVENTS_EXPORT Events_Message {
39 Events_ID myEventsId; ///< identifier of the event
40 void* mySender; ///< the sender object
44 //! Creates the message
45 Events_Message(const Events_ID theID, const void* theSender = 0)
46 : myEventsId(theID), mySender((void*) theSender) {}
47 //! do nothing in the destructor yet
48 virtual ~Events_Message() {}
50 //! Returns identifier of the message
51 const Events_ID& eventID() const {return myEventsId;}
53 //! Returns sender of the message or NULL if it is anonymous message
54 void* sender() const {return mySender;}