SHAPER  9.12.0
Events_Message.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef Events_Message_H_
21 #define Events_Message_H_
22 
23 #include <Events.h>
24 
35 class EVENTS_EXPORT Events_ID
36 {
38  char* myID;
39 
40  Events_ID(char* theID)
41  {
42  myID = theID;
43  }
44 
45  friend class Events_Loop;
46  public:
48  char* eventText() const
49  {
50  return myID;
51  }
53  bool operator==(const Events_ID& theID) const
54  {
55  return myID == theID.myID;
56  }
57 };
58 
64 class EVENTS_EXPORT Events_Message
65 {
66  Events_ID myEventsId;
67  void* mySender;
68 
69  public:
70 
72  Events_Message(const Events_ID theID, const void* theSender = 0)
73  : myEventsId(theID),
74  mySender((void*) theSender)
75  {
76  }
78  virtual ~Events_Message()
79  {
80  }
81 
83  const Events_ID& eventID() const
84  {
85  return myEventsId;
86  }
87 
89  void* sender() const
90  {
91  return mySender;
92  }
93 };
94 
95 #endif
Identifier of the event kind.
Definition: Events_Message.h:36
bool operator==(const Events_ID &theID) const
Allows to compare identifiers.
Definition: Events_Message.h:53
char * eventText() const
Returns the text-identifier of the event (for debugging reasons)
Definition: Events_Message.h:48
Base class that manages the receiving and sending of all not Qt-events in the application.
Definition: Events_Loop.h:43
Message for communication between sender and listener of event.
Definition: Events_Message.h:65
Events_Message(const Events_ID theID, const void *theSender=0)
Creates the message.
Definition: Events_Message.h:72
virtual ~Events_Message()
do nothing in the destructor yet
Definition: Events_Message.h:78
const Events_ID & eventID() const
Returns identifier of the message.
Definition: Events_Message.h:83
void * sender() const
Returns sender of the message or NULL if it is anonymous message.
Definition: Events_Message.h:89