1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Events_Message.hxx
4 // Created: Thu Mar 13 2014
5 // Author: Mikhail PONIKAROV
7 #ifndef Events_Message_H_
8 #define Events_Message_H_
14 * \brief Identifier of the event kind.
16 * Each event ID is created in main Envent_Loop class
17 * that stores correspondence between the string-name of the
18 * identifier and the pointer to the static string that is really
19 * used as an identifier (this is useful for debugging of the events
20 * with log files and in debugger).
22 class EVENTS_EXPORT Events_ID
24 /// pointer to the text-identifier of the event, unique pointer for all events of such type
27 Events_ID(char* theID)
32 friend class Events_Loop;
34 /// Returns the text-identifier of the event (for debugging reasons)
35 char* eventText() const
39 /// Allows to compare identifiers
40 bool operator==(const Events_ID& theID) const
42 return myID == theID.myID;
46 /**\class Events_Message
48 * \brief Message for communication between sender and listener of event.
49 * Normally it is inherited by the higher-level
51 class EVENTS_EXPORT Events_Message
53 Events_ID myEventsId; ///< identifier of the event
54 void* mySender; ///< the sender object
58 //! Creates the message
59 Events_Message(const Events_ID theID, const void* theSender = 0)
61 mySender((void*) theSender)
64 //! do nothing in the destructor yet
65 virtual ~Events_Message()
69 //! Returns identifier of the message
70 const Events_ID& eventID() const
75 //! Returns sender of the message or NULL if it is anonymous message