Skip to content

Commit d78563d

Browse files
author
nitrocaster
committed
Inline BuilderAllocatorDataStorage.
1 parent 5c12997 commit d78563d

9 files changed

+31
-67
lines changed

src/xrAICore/Navigation/builder_allocator_constructor.h

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/xrAICore/Navigation/data_storage_constructor.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ template <typename T> class CEmptyClassTemplate {};
1212
template <typename T1, typename T2> class CEmptyClassTemplate2 {};
1313

1414
#include "xrAICore/Navigation/manager_builder_allocator_constructor.h"
15-
15+
// instantiated in CDijkstra
1616
template <
1717
typename _algorithm, // CDataStorageBucketList|CDataStorageBinaryHeap
1818
typename _manager, // CVertexManagerFixed|CVertexManagerHashFixed
1919
typename _builder, // CEdgePath|CVertexPath
2020
typename _allocator, // CVertexAllocatorFixed
21-
template <typename _T> class _vertex = CEmptyClassTemplate // _Vertex
21+
template <typename _T> class _vertex = CEmptyClassTemplate // _Vertex -- dijkstra vertex
2222
>
2323
struct CDataStorageConstructor : // CDataStorageBucketList::CDataStorage<CManagerBuilderAllocatorConstructor<manager, path, allocator> >
2424
public _algorithm::template CDataStorage<
@@ -30,8 +30,7 @@ struct CDataStorageConstructor : // CDataStorageBucketList::CDataStorage<CManage
3030
typedef typename inherited::CGraphVertex CGraphVertex;
3131
typedef typename CGraphVertex::_index_type _index_type;
3232

33-
IC CDataStorageConstructor (const u32 vertex_count) :
34-
inherited(vertex_count)
35-
{
36-
}
33+
CDataStorageConstructor (const u32 vertex_count) :
34+
inherited(vertex_count)
35+
{}
3736
};

src/xrAICore/Navigation/manager_builder_allocator_constructor.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88

99
#pragma once
1010

11-
#include "xrAICore/Navigation/builder_allocator_constructor.h"
12-
1311
template <
1412
typename _manager,
1513
typename _builder, // CVertexPath
@@ -30,7 +28,7 @@ struct CManagerBuilderAllocatorConstructor {
3028
{
3129
public:
3230
typedef typename _manager::template CDataStorage<_builder, _allocator, _vertex, _index_vertex> inherited;
33-
typedef typename inherited::inherited inherited_allocator;
31+
typedef typename inherited::CDataStorageAllocator inherited_allocator;
3432
typedef typename inherited::CGraphVertex CGraphVertex;
3533
typedef typename CGraphVertex::_index_type _index_type;
3634

src/xrAICore/Navigation/vertex_manager_fixed.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ struct CVertexManagerFixed {
4141
template <typename _T> class _vertex = CEmptyClassTemplate,
4242
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2
4343
>
44-
class CDataStorage : public BuilderAllocatorDataStorage<VertexManager<_vertex>::_vertex, _builder, _allocator>
44+
class CDataStorage :
45+
public _builder::template CDataStorage<VertexManager<_vertex>::_vertex>,
46+
public _allocator::template CDataStorage<typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex>::CGraphVertex>
4547
{
4648
public:
47-
typedef BuilderAllocatorDataStorage<
48-
VertexManager<_vertex>::_vertex, _builder, _allocator
49-
> inherited;
50-
typedef typename inherited::CGraphVertex CGraphVertex;
51-
typedef typename CGraphVertex::_index_type _index_type;
49+
typedef typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex> CDataStorageBase;
50+
typedef typename _allocator::template CDataStorage<
51+
typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex>::CGraphVertex> CDataStorageAllocator;
52+
typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
53+
typedef typename CGraphVertex::_index_type _index_type;
54+
//using inherited = CDataStorageAllocator;
5255

5356
#pragma pack(push,1)
5457
template <typename _path_id_type>

src/xrAICore/Navigation/vertex_manager_fixed_inline.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525

2626
TEMPLATE_SPECIALIZATION
2727
IC CFixedVertexManager::CDataStorage (const u32 vertex_count) :
28-
inherited (vertex_count)
28+
CDataStorageBase(vertex_count),
29+
CDataStorageAllocator()
2930
{
3031
m_current_path_id = _path_id_type(0);
3132
m_max_node_count = vertex_count;
@@ -48,7 +49,8 @@ CFixedVertexManager::~CDataStorage ()
4849
TEMPLATE_SPECIALIZATION
4950
IC void CFixedVertexManager::init ()
5051
{
51-
inherited::init ();
52+
CDataStorageBase::init();
53+
CDataStorageAllocator::init();
5254
++m_current_path_id;
5355
if (!m_current_path_id) {
5456
ZeroMemory (m_indexes,(m_max_node_count)*sizeof(CGraphIndexVertex));

src/xrAICore/Navigation/vertex_manager_hash_fixed.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,15 @@ struct CVertexManagerHashFixed {
5252
template <typename _T> class _vertex = CEmptyClassTemplate,
5353
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2
5454
>
55-
class CDataStorage : public BuilderAllocatorDataStorage<VertexManager<_vertex>::_vertex, _builder, _allocator>
55+
class CDataStorage :
56+
public _builder::template CDataStorage<VertexManager<_vertex>::_vertex>,
57+
public _allocator::template CDataStorage<typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex>::CGraphVertex>
5658
{
5759
public:
58-
typedef BuilderAllocatorDataStorage<
59-
VertexManager<_vertex>::_vertex, _builder, _allocator
60-
> inherited;
61-
typedef typename inherited::CGraphVertex CGraphVertex;
60+
typedef typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex> CDataStorageBase;
61+
typedef typename _allocator::template CDataStorage<
62+
typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex>::CGraphVertex> CDataStorageAllocator;
63+
typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
6264
typedef typename CGraphVertex::_index_type _index_type;
6365

6466
#pragma pack(push,1)

src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626

2727
TEMPLATE_SPECIALIZATION
2828
IC CHashFixedVertexManager::CDataStorage (const u32 vertex_count) :
29-
inherited (vertex_count),
30-
m_current_path_id (_path_id_type(0))
29+
CDataStorageBase(vertex_count),
30+
CDataStorageAllocator(),
31+
m_current_path_id(_path_id_type(0))
3132
{
3233
u32 memory_usage = 0;
3334
u32 byte_count;
@@ -53,7 +54,8 @@ CHashFixedVertexManager::~CDataStorage ()
5354
TEMPLATE_SPECIALIZATION
5455
IC void CHashFixedVertexManager::init ()
5556
{
56-
inherited::init ();
57+
CDataStorageBase::init();
58+
CDataStorageAllocator::init();
5759
++m_current_path_id;
5860
m_vertex_count = 0;
5961
if (!m_current_path_id) {

src/xrAICore/xrAICore.vcxproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@
261261
<ClInclude Include="Navigation\ai_object_location_inline.h" />
262262
<ClInclude Include="Navigation\a_star.h" />
263263
<ClInclude Include="Navigation\a_star_inline.h" />
264-
<ClInclude Include="Navigation\builder_allocator_constructor.h" />
265264
<ClInclude Include="Navigation\data_storage_binary_heap.h" />
266265
<ClInclude Include="Navigation\data_storage_binary_heap_inline.h" />
267266
<ClInclude Include="Navigation\data_storage_bucket_list.h" />

src/xrAICore/xrAICore.vcxproj.filters

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,6 @@
180180
<ClInclude Include="Navigation\dijkstra_inline.h">
181181
<Filter>AI\Navigation\Pathfinding\Algorithms\Dijkstra</Filter>
182182
</ClInclude>
183-
<ClInclude Include="Navigation\builder_allocator_constructor.h">
184-
<Filter>AI\Navigation\Pathfinding\DataStorages\Constructors</Filter>
185-
</ClInclude>
186183
<ClInclude Include="Navigation\data_storage_constructor.h">
187184
<Filter>AI\Navigation\Pathfinding\DataStorages\Constructors</Filter>
188185
</ClInclude>

0 commit comments

Comments
 (0)