OpenCPN Partial API docs
Loading...
Searching...
No Matches
comm_appmsg_bus.h
1
2/***************************************************************************
3 *
4 * Project: OpenCPN
5 * Purpose: Decoded messages send/receive support. This file represents the
6 * top layer in the three layer model drivers, raw messages and
7 * decoded messages.
8 *
9 * Message definitions are in comm_appmsg.h
10 *
11 * Author: David Register, Alec Leamas
12 *
13 ***************************************************************************
14 * Copyright (C) 2022 by David Register, Alec Leamas *
15 * *
16 * This program is free software; you can redistribute it and/or modify *
17 * it under the terms of the GNU General Public License as published by *
18 * the Free Software Foundation; either version 2 of the License, or *
19 * (at your option) any later version. *
20 * *
21 * This program is distributed in the hope that it will be useful, *
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
24 * GNU General Public License for more details. *
25 * *
26 * You should have received a copy of the GNU General Public License *
27 * along with this program; if not, write to the *
28 * Free Software Foundation, Inc., *
29 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
30 **************************************************************************/
31
32#ifndef _APP_MSG_BUS_H
33#define _APP_MSG_BUS_H
34
35#include <memory>
36
37#include <wx/event.h>
38
39#include "model/comm_appmsg.h"
40
42class AppMsgBus {
43public:
45 void Notify(std::shared_ptr<const AppMsg> msg);
46
51 void set_priority(AppMsg::Type data, const NavAddr& src, unsigned prio);
52
53 static AppMsgBus& GetInstance();
54};
55
56#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(std::shared_ptr< const AppMsg > msg)
Send message to everyone listening to given message type.
Where messages are sent to or received from.