| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
* This file incorporates work covered by the following copyright and |
| 20 |
* permission notice (to be compatible with LGPLv2.1, |
| 21 |
* this code is available/released under GPLv3, |
| 22 |
* see https://www.gnu.org/licenses/gpl-faq.html#AllCompatibility): |
| 23 |
* |
| 24 |
* |
| 25 |
* Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). |
| 26 |
* Contact: http://www.qt-project.org/legal |
| 27 |
* |
| 28 |
* This file is part of the QtCore module of the Qt Toolkit. |
| 29 |
* |
| 30 |
* $QT_BEGIN_LICENSE:LGPL$ |
| 31 |
* Commercial License Usage |
| 32 |
* Licensees holding valid commercial Qt licenses may use this file in |
| 33 |
* accordance with the commercial license agreement provided with the |
| 34 |
* Software or, alternatively, in accordance with the terms contained in |
| 35 |
* a written agreement between you and Digia. For licensing terms and |
| 36 |
* conditions see http://qt.digia.com/licensing. For further information |
| 37 |
* use the contact form at http://qt.digia.com/contact-us. |
| 38 |
* |
| 39 |
* GNU Lesser General Public License Usage |
| 40 |
* Alternatively, this file may be used under the terms of the GNU Lesser |
| 41 |
* General Public License version 2.1 as published by the Free Software |
| 42 |
* Foundation and appearing in the file LICENSE.LGPL included in the |
| 43 |
* packaging of this file. Please review the following information to |
| 44 |
* ensure the GNU Lesser General Public License version 2.1 requirements |
| 45 |
* will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
| 46 |
* |
| 47 |
* In addition, as a special exception, Digia gives you certain additional |
| 48 |
* rights. These rights are described in the Digia Qt LGPL Exception |
| 49 |
* version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
| 50 |
* |
| 51 |
* GNU General Public License Usage |
| 52 |
* Alternatively, this file may be used under the terms of the GNU |
| 53 |
* General Public License version 3.0 as published by the Free Software |
| 54 |
* Foundation and appearing in the file LICENSE.GPL included in the |
| 55 |
* packaging of this file. Please review the following information to |
| 56 |
* ensure the GNU General Public License version 3.0 requirements will be |
| 57 |
* met: http://www.gnu.org/copyleft/gpl.html. |
| 58 |
* |
| 59 |
* |
| 60 |
* $QT_END_LICENSE$ |
| 61 |
* |
| 62 |
* |
| 63 |
*/ |
| 64 |
|
| 65 |
#ifndef KONCLUDE_UTILITIES_CONTAINER_CQTMANAGEDRESTRICTEDMODIFICATIONMAPDATA_H |
| 66 |
#define KONCLUDE_UTILITIES_CONTAINER_CQTMANAGEDRESTRICTEDMODIFICATIONMAPDATA_H |
| 67 |
|
| 68 |
// Namespace includes |
| 69 |
#include "ContainerSettings.h" |
| 70 |
#include "CQtManagedRestrictedModificationMapBase.h" |
| 71 |
|
| 72 |
#ifdef KONCLUDE_EMPLOY_QT_MANAGED_RESTRICTED_MODIFICATION_MAP_CONTAINER |
| 73 |
|
| 74 |
// Library includes |
| 75 |
#include <QMap> |
| 76 |
|
| 77 |
// Other includes |
| 78 |
#include "Utilities/Memory/CMemoryAllocationManager.h" |
| 79 |
#include "Utilities/Memory/CObjectAllocator.h" |
| 80 |
#include "Utilities/Memory/CMemoryAllocator.h" |
| 81 |
|
| 82 |
// Logger includes |
| 83 |
#include "Logger/CLogger.h" |
| 84 |
|
| 85 |
|
| 86 |
namespace Konclude { |
| 87 |
|
| 88 |
namespace Utilities { |
| 89 |
|
| 90 |
using namespace Memory; |
| 91 |
|
| 92 |
namespace Container { |
| 93 |
|
| 94 |
|
| 95 |
/*! |
| 96 |
* |
| 97 |
* \class CQtManagedRestrictedModificationMapData |
| 98 |
* \author Andreas Steigmiller |
| 99 |
* \version 0.1 |
| 100 |
* \brief TODO |
| 101 |
* |
| 102 |
*/ |
| 103 |
|
| 104 |
|
| 105 |
struct CQtManagedRestrictedModificationMapData |
| 106 |
{ |
| 107 |
struct Node { |
| 108 |
Node *backward; |
| 109 |
Node *forward[1]; |
| 110 |
}; |
| 111 |
enum { LastLevel = 11, Sparseness = 3 }; |
| 112 |
|
| 113 |
CQtManagedRestrictedModificationMapData *backward; |
| 114 |
CQtManagedRestrictedModificationMapData *forward[CQtManagedRestrictedModificationMapData::LastLevel + 1]; |
| 115 |
//QBasicAtomicInt ref; |
| 116 |
CQtManagedRestrictedModificationMapBase *refMap; |
| 117 |
int topLevel; |
| 118 |
int size; |
| 119 |
uint randomBits; |
| 120 |
uint insertInOrder : 1; |
| 121 |
uint sharable : 1; |
| 122 |
uint strictAlignment : 1; |
| 123 |
uint reserved : 29; |
| 124 |
|
| 125 |
static CQtManagedRestrictedModificationMapData *createData(CQtManagedRestrictedModificationMapBase* referenceMap, CMemoryAllocationManager* memMan); // ### Qt5 remove me |
| 126 |
static CQtManagedRestrictedModificationMapData *createData(int alignment, CQtManagedRestrictedModificationMapBase* referenceMap, CMemoryAllocationManager* memMan); |
| 127 |
void continueFreeData(int offset, CMemoryAllocationManager* memMan); |
| 128 |
Node *node_create(Node *update[], int offset, CMemoryAllocationManager* memMan); // ### Qt5 remove me |
| 129 |
Node *node_create(Node *update[], int offset, int alignment, CMemoryAllocationManager* memMan); |
| 130 |
void node_delete(Node *update[], int offset, Node *node, CMemoryAllocationManager* memMan); |
| 131 |
#ifdef KONCLUDE_CQTMANAGEDRESTRICTEDMODIFICATIONMAP_DEBUG |
| 132 |
uint adjust_ptr(Node *node); |
| 133 |
void dump(); |
| 134 |
#endif |
| 135 |
|
| 136 |
static CQtManagedRestrictedModificationMapData shared_null; |
| 137 |
}; |
| 138 |
|
| 139 |
|
| 140 |
}; // end namespace Container |
| 141 |
|
| 142 |
}; // end namespace Utilities |
| 143 |
|
| 144 |
}; // end namespace Konclude |
| 145 |
|
| 146 |
|
| 147 |
#endif // KONCLUDE_EMPLOY_QT_MANAGED_RESTRICTED_MODIFICATION_MAP_CONTAINER |
| 148 |
|
| 149 |
#endif // KONCLUDE_UTILITIES_CONTAINER_CQTMANAGEDRESTRICTEDMODIFICATIONMAPDATA_H |