i6engine  1.0
MessagingFacade.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_MESSAGINGFACADE_H__
26 #define __I6ENGINE_API_MESSAGINGFACADE_H__
27 
30 
31 #include "boost/bind.hpp"
32 
33 #define ISIXE_REGISTERMESSAGETYPE(msgType, method, owner) i6e::api::EngineController::GetSingletonPtr()->getMessagingFacade()->registerMessageType(msgType, this, boost::bind(&method, owner, _1))
34 #define ISIXE_UNREGISTERMESSAGETYPE(msgType) i6e::api::EngineController::GetSingletonPtr()->getMessagingFacade()->unregisterMessageType(msgType, this)
35 
36 namespace i6e {
37 namespace core {
38  class MessageSubscriber;
39  class MessagingController;
40 } /* namespace core */
41 namespace api {
42 
47  friend class EngineController;
48 
49  public:
54 
58  ~MessagingFacade();
59 
63  void deliverMessage(const GameMessage::Ptr & msg);
64 
73  void registerMessageType(uint16_t msgType, core::MessageSubscriber * objMessageSubscriber, const boost::function<void(GameMessage::Ptr)> & ptrMessageMethod);
74 
80  void unregisterMessageType(uint16_t msgType, core::MessageSubscriber * objMessageSubscriber);
81 
82  private:
83  core::MessagingController * _messagingController;
84 
88  void registerMessagingController(core::MessagingController * ctrl);
89 
93  MessagingFacade(const MessagingFacade &) = delete;
94 
98  MessagingFacade & operator=(const MessagingFacade &) = delete;
99  };
100 
101 } /* namespace api */
102 } /* namespace i6e */
103 
104 #endif /* __I6ENGINE_API_MESSAGINGFACADE_H__ */
105 
This class is used as the Controller for the whole engine Create an instance of this class and use th...
#define ISIXE_MODULES_API
boost::shared_ptr< Message > Ptr
Definition: Message.h:66
Interface for every class that wants to subscribe to the messaging system.
Central controller for messaging between subsystems and subsystems of different clients.