1// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB).
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QT3DCORE_QBACKENDNODE_H
5#define QT3DCORE_QBACKENDNODE_H
6
7#include <Qt3DCore/qnodeid.h>
8#include <Qt3DCore/qt3dcore_global.h>
9
10QT_BEGIN_NAMESPACE
11
12namespace Qt3DCore {
13
14class QNode;
15class QBackendNodePrivate;
16class QBackendNode;
17class QAspectEngine;
18
19#if defined(QT_BUILD_INTERNAL)
20class QBackendNodeTester;
21#endif
22
23class Q_3DCORESHARED_EXPORT QBackendNodeMapper
24{
25public:
26 virtual ~QBackendNodeMapper();
27 virtual QBackendNode *create(QNodeId id) const = 0;
28 virtual QBackendNode *get(QNodeId id) const = 0;
29 virtual void destroy(QNodeId id) const = 0;
30};
31
32typedef QSharedPointer<QBackendNodeMapper> QBackendNodeMapperPtr;
33
34class Q_3DCORESHARED_EXPORT QBackendNode
35{
36public:
37 enum Mode {
38 ReadOnly = 0,
39 ReadWrite
40 };
41
42 explicit QBackendNode(Mode mode = ReadOnly);
43 virtual ~QBackendNode();
44
45 QNodeId peerId() const noexcept;
46
47 void setEnabled(bool enabled) noexcept;
48 bool isEnabled() const noexcept;
49
50 Mode mode() const noexcept;
51
52 virtual void syncFromFrontEnd(const QNode *frontEnd, bool firstTime);
53
54protected:
55 Q_DECLARE_PRIVATE(QBackendNode)
56 explicit QBackendNode(QBackendNodePrivate &dd);
57
58 QBackendNodePrivate *d_ptr;
59
60private:
61 Q_DISABLE_COPY(QBackendNode)
62 void setPeerId(QNodeId id) noexcept;
63
64 friend class QAbstractAspectPrivate;
65#if defined(QT_BUILD_INTERNAL)
66 friend class QBackendNodeTester;
67#endif
68};
69
70} // namespace Qt3DCore
71
72QT_END_NAMESPACE
73
74#endif // QT3DCORE_QBACKENDNODE_H
75

source code of qt3d/src/core/nodes/qbackendnode.h