Orxonox  0.0.5 Codename: Arcturus
NotificationDispatcher.h
Go to the documentation of this file.
1 /*
2  * ORXONOX - the hottest 3D action shooter ever to exist
3  * > www.orxonox.net <
4  *
5  *
6  * License notice:
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21  *
22  * Author:
23  * Damian 'Mozork' Frick
24  * Co-authors:
25  * ...
26  *
27  */
28 
35 #ifndef _NotificationDispatcher_H__
36 #define _NotificationDispatcher_H__
37 
39 
40 #include <string>
41 
42 #include "core/BaseObject.h"
44 
45 namespace orxonox
46 {
47 
76  {
77  public:
79  virtual ~NotificationDispatcher();
80 
81  virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
82  virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override;
83 
88  const std::string& getSender(void) const
89  { return this->sender_; }
94  void setSender(const std::string& sender)
95  { this->sender_ = sender; }
96 
101  bool isBroadcasting(void) const
102  { return this->bBroadcast_; }
107  void setBroadcasting(bool v)
108  { this->bBroadcast_ = v; }
109 
110  void broadcast(void);
111  void broadcastHelper(void);
112  void dispatch(unsigned int clientId);
113  bool trigger(bool triggered, BaseObject* trigger);
114 
115  protected:
117  bool bBroadcast_;
118 
119  void registerVariables(void);
120 
127  { return BLANKSTRING; }
128 
129  };
130 
131 }
132 
133 #endif /* _NotificationDispatcher_H__ */
The BaseObject is the parent of all classes representing an instance in the game. ...
Definition: BaseObject.h:63
std::string BLANKSTRING
A blank string (""). Used to return a blank string by reference.
Definition: StringUtils.cc:46
This class is the base class of all the Objects in the universe that need to be synchronised over the...
Definition: Synchronisable.h:142
virtual const std::string & createNotificationMessage(void)
Creates the notification message that should be sent upon the NotificationDispatcher triggering...
Definition: NotificationDispatcher.h:126
void setSender(const std::string &sender)
Set the sender of the Notification dispatched by this NotificationDispatcher.
Definition: NotificationDispatcher.h:94
::std::string string
Definition: gtest-port.h:756
A NotificationDispatcher is an entity that, upon being triggered, dispatches (or sends) a specified N...
Definition: NotificationDispatcher.h:75
const std::string & getSender(void) const
Get the sender of the Notification dispatched by this NotificationDispatcher.
Definition: NotificationDispatcher.h:88
bool bBroadcast_
Whether the NotificationDispatcher is broadcasting.
Definition: NotificationDispatcher.h:117
void setBroadcasting(bool v)
Set the NotificationDispatcher to broadcast.
Definition: NotificationDispatcher.h:107
#define _NotificationsExport
Definition: NotificationsPrereqs.h:60
std::string sender_
The name of the sender of the Notification dispatched by this NotificationDispatcher.
Definition: NotificationDispatcher.h:116
bool isBroadcasting(void) const
Check whether the NotificationDispatcher is set to broadcast.
Definition: NotificationDispatcher.h:101
xmlelement
Definition: Super.h:519
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
Shared library macros, enums, constants and forward declarations for the questsystem module ...
Mode
Definition: CorePrereqs.h:102
Declaration of BaseObject, the base class of all objects in Orxonox.
Definition: Context.h:45