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 correspondance 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 usefull for debugging of the events
20 * with log files and in debugger).
22 class EVENTS_EXPORT Events_ID
24 char* myID; ///< pointer to the text-identifier of the event, unique pointer for all events of such type
26 Events_ID(char* theID)
31 friend class Events_Loop;
33 /// Returns the text-identifier of the event (for debugging reasons)
34 char* eventText() const
38 /// Allows to compare identifiers
39 bool operator==(const Events_ID& theID) const
41 return myID == theID.myID;
45 /**\class Events_Message
47 * \brief Message for communication between sender and listener of event.
48 * Normally it is inherited by the higher-level
50 class EVENTS_EXPORT Events_Message
52 Events_ID myEventsId; ///< identifier of the event
53 void* mySender; ///< the sender object
57 //! Creates the message
58 Events_Message(const Events_ID theID, const void* theSender = 0)
60 mySender((void*) theSender)
63 //! do nothing in the destructor yet
64 virtual ~Events_Message()
68 //! Returns identifier of the message
69 const Events_ID& eventID() const
74 //! Returns sender of the message or NULL if it is anonymous message