Developer documentation
Version 3.0.3-105-gd3941f44
interprocesscommunicator.h
Go to the documentation of this file.
1/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 *
7 * Covered Software is provided under this License on an "as is"
8 * basis, without warranty of any kind, either expressed, implied, or
9 * statutory, including, without limitation, warranties that the
10 * Covered Software is free of defects, merchantable, fit for a
11 * particular purpose or non-infringing.
12 * See the Mozilla Public License v. 2.0 for more details.
13 *
14 * For more details, see http://www.mrtrix.org/.
15 */
16#ifndef __sync_interprocesscommunicator_h__
17#define __sync_interprocesscommunicator_h__
18
19#include <qlocalsocket.h>
20
23
24
25// maximum number of inter process syncers that are allowed. This can be
26// raised, but may reduce performance when new IPS are created.
27#define MAX_NO_ALLOWED 32
28
29namespace MR
30{
31 namespace GUI
32 {
33 namespace MRView
34 {
35 namespace Sync
36 {
37
41 class InterprocessCommunicator : public QObject
43 Q_OBJECT
44
45 public:
47 static void Int32ToChar(char a[], int n);
48 static int CharTo32bitNum(char a[]);
49 bool SendData(QByteArray data);//sends data to be synced
50
51 private slots:
52 void OnNewIncomingConnection();
53 void OnDataReceived(vector<std::shared_ptr<QByteArray>> dat);
54
55 signals:
56 void SyncDataReceived(vector<std::shared_ptr<QByteArray>> data); //fires when data is received which is for syncing. It is up to listeners to validate and store this value
57
58 private:
59 int id;//id which is unique between mrview processes
61 QLocalServer *receiver;//listens for information
62 void TryConnectTo(int connectToId);//tries to connect with another interprocesscommunicator
63
64
65 };
66
67 }
68 }
69 }
70}
71#endif
static void Int32ToChar(char a[], int n)
void SyncDataReceived(vector< std::shared_ptr< QByteArray > > data)
#define NOMEMALIGN
Definition: memory.h:22
Definition: base.h:24