NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
ipc.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2020 Erik Haenel et al.
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 3 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 <http://www.gnu.org/licenses/>.
17******************************************************************************/
18#ifndef IPC_HPP
19#define IPC_HPP
20
21#include <wx/wx.h>
22#include <wx/ipc.h>
23
24#define DDE_TOPIC "NumeReIPC"
25#define DDE_SERVICE "NumeRe"
26
27// Forward declaration
28class NumeReWindow;
29
30// Interprocess communication namespace
31namespace DDE
32{
37 class Server : public wxServer
38 {
39 public:
40 Server(NumeReWindow* frame) : m_Frame(frame) {}
41 virtual wxConnectionBase* OnAcceptConnection(const wxString& topic) override;
42
43 private:
45 };
46
47
53 class Connection : public wxConnection
54 {
55 public:
56 Connection(NumeReWindow* frame) : m_Frame(frame) {}
57 virtual bool OnExecute(const wxString& topic, const void* data, size_t size, wxIPCFormat format) override;
58 virtual bool OnDisconnect() override;
59
60 private:
62 wxArrayString m_ArgV;
63 wxString m_fileToLoad;
64 };
65
66
71 class Client: public wxClient
72 {
73 public:
74 Client(void) {}
75 virtual wxConnectionBase* OnMakeConnection(void) override
76 {
77 return new DDE::Connection(nullptr);
78 }
79 };
80}
81
82
83#endif // IPC_HPP
84
85
86
This is the implementation of the DDE client of any secondary NumeRe instances.
Definition: ipc.hpp:72
virtual wxConnectionBase * OnMakeConnection(void) override
Definition: ipc.hpp:75
Client(void)
Definition: ipc.hpp:74
This class is an implementation of a DDE connection between DDE::Client and DDE::Server.
Definition: ipc.hpp:54
wxString m_fileToLoad
Definition: ipc.hpp:63
virtual bool OnExecute(const wxString &topic, const void *data, size_t size, wxIPCFormat format) override
Handles the interprocess communication between two NumeRe instances.
Definition: ipc.cpp:51
virtual bool OnDisconnect() override
Called, when the DDE::Server or the DDE::Client closes the connection. Will pass the gathered command...
Definition: ipc.cpp:117
Connection(NumeReWindow *frame)
Definition: ipc.hpp:56
NumeReWindow * m_Frame
Definition: ipc.hpp:61
wxArrayString m_ArgV
Definition: ipc.hpp:62
This class implements the DDE server for the first (main) NumeRe instance.
Definition: ipc.hpp:38
virtual wxConnectionBase * OnAcceptConnection(const wxString &topic) override
Creates a new DDEConnection, if the topic equals DDE_TOPIC.
Definition: ipc.cpp:34
Server(NumeReWindow *frame)
Definition: ipc.hpp:40
NumeReWindow * m_Frame
Definition: ipc.hpp:44
This class is the actual NumeRe main frame. The application's logic is implemented here.
Definition: NumeReWindow.h:177
Definition: ipc.cpp:25
auto format(const std::locale &loc, const CharT *fmt, const Streamable &tp) -> decltype(to_stream(std::declval< std::basic_ostream< CharT > & >(), fmt, tp), std::basic_string< CharT >{})
Definition: date.h:6249