1 // Copyright (C) 2014-2019 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef Events_Message_H_
21 #define Events_Message_H_
27 * \brief Identifier of the event kind.
29 * Each event ID is created in main Envent_Loop class
30 * that stores correspondence between the string-name of the
31 * identifier and the pointer to the static string that is really
32 * used as an identifier (this is useful for debugging of the events
33 * with log files and in debugger).
35 class EVENTS_EXPORT Events_ID
37 /// pointer to the text-identifier of the event, unique pointer for all events of such type
40 Events_ID(char* theID)
45 friend class Events_Loop;
47 /// Returns the text-identifier of the event (for debugging reasons)
48 char* eventText() const
52 /// Allows to compare identifiers
53 bool operator==(const Events_ID& theID) const
55 return myID == theID.myID;
59 /**\class Events_Message
61 * \brief Message for communication between sender and listener of event.
62 * Normally it is inherited by the higher-level
64 class EVENTS_EXPORT Events_Message
66 Events_ID myEventsId; ///< identifier of the event
67 void* mySender; ///< the sender object
71 //! Creates the message
72 Events_Message(const Events_ID theID, const void* theSender = 0)
74 mySender((void*) theSender)
77 //! do nothing in the destructor yet
78 virtual ~Events_Message()
82 //! Returns identifier of the message
83 const Events_ID& eventID() const
88 //! Returns sender of the message or NULL if it is anonymous message