Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/tutoriallevel2/src/orxonox/interfaces/NotificationListener.h @ 8374

Last change on this file since 8374 was 8374, checked in by dafrick, 13 years ago

Changes in notifications module structure. Notifications can now be sent through the NotificationListener, meaning, they can be sent from anywhere within orxonox (and the modules of course).

  • Property svn:eol-style set to native
File size: 2.7 KB
Line 
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 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29/**
30    @file NotificationListener.h
31    @brief Definition of the NotificationListener class.
32    @ingroup Notifications
33*/
34
35#ifndef _NotificationListener_H__
36#define _NotificationListener_H__
37
38#include "OrxonoxPrereqs.h"
39
40#include <ctime>
41#include <set>
42#include <string>
43
44#include "util/StringUtils.h"
45
46#include "core/OrxonoxClass.h"
47
48namespace orxonox
49{
50    class Notification;
51
52    /**
53    @brief
54        NotificationListener interface.
55
56        The NotificationListener interface presents a means to being informed when @ref orxonox::Notification "Notifications" in the target set of this NotificationListener change. (e.g. @ref orxonox::Notification "Notifications" were added or removed)
57        When inheriting from a NotificationListener it is important to register (in the constructor) and unregister (in the destructor) it to and from the @ref orxonox::NotificationManager "NotificationManager".
58
59    @author
60        Fabian 'x3n' Landau
61
62    @ingroup Notifications
63    */
64    class _OrxonoxExport NotificationListener : virtual public OrxonoxClass
65    {
66        public:
67            NotificationListener();
68            virtual ~NotificationListener() {}
69           
70            static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners.
71            static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener.
72           
73            static void sendNotification(const std::string& message, unsigned int clientId, const std::string& sender = NotificationListener::NONE, bool isLocal = false);
74           
75            virtual bool registerNotification(const std::string& message, const std::string& sender)
76                { return false; }
77    };
78}
79
80#endif /* _NotificationListener_H__ */
Note: See TracBrowser for help on using the repository browser.