CustusX
22.04-rc5
An IGT application
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
cxSharedMemory.h
Go to the documentation of this file.
1
/*=========================================================================
2
This file is part of CustusX, an Image Guided Therapy Application.
3
4
Copyright (c) SINTEF Department of Medical Technology.
5
All rights reserved.
6
7
CustusX is released under a BSD 3-Clause license.
8
9
See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10
=========================================================================*/
11
12
#ifndef CXSHAREDMEMORY_H_
13
#define CXSHAREDMEMORY_H_
14
15
#include "cxResourceExport.h"
16
17
#include <QSharedMemory>
18
#include <QDateTime>
19
20
namespace
cx
21
{
22
28
40
class
cxResource_EXPORT
SharedMemoryServer
41
{
42
private
:
43
QSharedMemory mBuffer;
44
int
mSize;
45
int
mBuffers;
46
int
mCurrentBuffer;
47
QDateTime mLastTimestamp;
48
49
public
:
59
SharedMemoryServer
(QString key,
int
buffers,
int
sizeEach, QObject *parent = 0);
60
~
SharedMemoryServer
();
61
int
size
() {
return
mSize; }
62
int
buffers
() {
return
mBuffers; }
63
QString
key
() {
return
mBuffer.key(); }
64
void
*buffer();
65
void
release();
66
69
QDateTime
lastTimestamp
() {
return
mLastTimestamp; }
73
bool
hasBuffer
() {
return
mCurrentBuffer != -1; }
74
private
:
75
void
internalRelease(
bool
lock);
76
};
77
84
class
cxResource_EXPORT
SharedMemoryClient
85
{
86
private
:
87
QSharedMemory mBuffer;
88
int
mSize;
89
int
mBuffers;
90
int
mCurrentBuffer;
91
QDateTime mTimestamp;
92
93
public
:
94
SharedMemoryClient
(QObject *parent = 0);
95
~
SharedMemoryClient
();
96
bool
attach(
const
QString &key);
97
bool
detach();
98
int
size
() {
return
mSize; }
99
int
buffers
() {
return
mBuffers; }
100
QString
key
() {
return
mBuffer.key(); }
101
const
void
*buffer(
bool
onlyNew=
false
);
102
void
release();
103
const
void
*isNew();
104
QDateTime
timestamp
() {
return
mTimestamp; }
105
};
106
107
}
108
109
#endif
cx::SharedMemoryServer
Shared Memory Server.
Definition:
cxSharedMemory.h:40
cx::SharedMemoryClient::buffers
int buffers()
Definition:
cxSharedMemory.h:99
cx::SharedMemoryServer::lastTimestamp
QDateTime lastTimestamp()
Definition:
cxSharedMemory.h:69
cx::SharedMemoryClient::key
QString key()
Definition:
cxSharedMemory.h:100
cx::SharedMemoryServer::size
int size()
Definition:
cxSharedMemory.h:61
cx::SharedMemoryClient::timestamp
QDateTime timestamp()
Definition:
cxSharedMemory.h:104
cx::SharedMemoryClient
Shared Memory Client.
Definition:
cxSharedMemory.h:84
cx::SharedMemoryServer::key
QString key()
Definition:
cxSharedMemory.h:63
cx::SharedMemoryServer::buffers
int buffers()
Definition:
cxSharedMemory.h:62
cx::SharedMemoryClient::size
int size()
Definition:
cxSharedMemory.h:98
cx::SharedMemoryServer::hasBuffer
bool hasBuffer()
Definition:
cxSharedMemory.h:73
cx
Namespace for all CustusX production code.
Definition:
cx_dev_group_definitions.h:13
CX
source
resource
core
utilities
cxSharedMemory.h
Generated on Thu Jun 16 2022 21:30:02 for CustusX by
1.8.11