OpenCPN Partial API docs
Loading...
Searching...
No Matches
comm_appmsg_bus.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2022 by David Register *
3 * Copyright (C) 2022 Alec Leamas *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program 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 *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, see <https://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
29#ifndef APP_MSG_BUS_H
30#define APP_MSG_BUS_H
31
32#include <memory>
33
34#include <wx/event.h>
35
36#include "model/comm_appmsg.h"
37
39class AppMsgBus {
40public:
41 static AppMsgBus& GetInstance();
42
43 AppMsgBus(const AppMsgBus&) = delete;
44 AppMsgBus& operator=(const AppMsgBus&) = delete;
45
47 void Notify(const std::shared_ptr<const AppMsg>& msg);
48
53 void set_priority(AppMsg::Type data, const NavAddr& src, unsigned prio);
54
55private:
56 AppMsgBus() = default;
57};
58
59#endif // APP_MSG_BUS_H
Application layer messaging, a singleton.
void set_priority(AppMsg::Type data, const NavAddr &src, unsigned prio)
Set the priority for a given data source providing data.
void Notify(const std::shared_ptr< const AppMsg > &msg)
Send message to everyone listening to given message type.
Where messages are sent to or received from.
Decoded messages definitions.