1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef Events_Message_H_
22 #define Events_Message_H_
28 * \brief Identifier of the event kind.
30 * Each event ID is created in main Envent_Loop class
31 * that stores correspondence between the string-name of the
32 * identifier and the pointer to the static string that is really
33 * used as an identifier (this is useful for debugging of the events
34 * with log files and in debugger).
36 class EVENTS_EXPORT Events_ID
38 /// pointer to the text-identifier of the event, unique pointer for all events of such type
41 Events_ID(char* theID)
46 friend class Events_Loop;
48 /// Returns the text-identifier of the event (for debugging reasons)
49 char* eventText() const
53 /// Allows to compare identifiers
54 bool operator==(const Events_ID& theID) const
56 return myID == theID.myID;
60 /**\class Events_Message
62 * \brief Message for communication between sender and listener of event.
63 * Normally it is inherited by the higher-level
65 class EVENTS_EXPORT Events_Message
67 Events_ID myEventsId; ///< identifier of the event
68 void* mySender; ///< the sender object
72 //! Creates the message
73 Events_Message(const Events_ID theID, const void* theSender = 0)
75 mySender((void*) theSender)
78 //! do nothing in the destructor yet
79 virtual ~Events_Message()
83 //! Returns identifier of the message
84 const Events_ID& eventID() const
89 //! Returns sender of the message or NULL if it is anonymous message