OpenCPN Partial API docs
Loading...
Searching...
No Matches
json_event.h
Go to the documentation of this file.
1/**************************************************************************
2 * Copyright (C) 2022 Alec Leamas *
3 * Copyright (C) 2022 David Register *
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
25#ifndef JSON_EVT_H_
26#define JSON_EVT_H_
27
28#include <memory>
29#include <string>
30
31#include <wx/event.h>
32
33#include "observable_evtvar.h"
34
36class JsonEvent {
37public:
38 static JsonEvent& getInstance() {
39 static JsonEvent instance;
40 return instance;
41 }
42
43 void Notify(const std::string& message, std::shared_ptr<void> msg_root) {
44 event.Notify(msg_root, message, 0);
45 }
46
47private:
48 EventVar event;
49};
50
51#endif
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
Handle sending of wxJson messages to all plugins.
Definition json_event.h:36
A common variable shared between producer and consumer which supports Listen() and Notify().