Skip to content

Commit f568932

Browse files
author
nitrocaster
committed
Tweak vertex manager templates.
1 parent b5904e0 commit f568932

9 files changed

+60
-58
lines changed

src/xrAICore/Navigation/builder_allocator_constructor.h

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,28 @@
99
#pragma once
1010

1111
template <
12-
typename _path_builder,
13-
typename _vertex_allocator
12+
template <typename _T> class _vertex,
13+
typename _path_builder,
14+
typename _vertex_allocator
1415
>
15-
struct CBuilderAllocatorConstructor {
16-
template <template <typename _T> class _vertex>
17-
class CDataStorage :
18-
public _path_builder::template CDataStorage<_vertex>,
19-
public _vertex_allocator::template CDataStorage<typename _path_builder::template CDataStorage<_vertex>::CGraphVertex>
20-
{
21-
public:
22-
typedef typename _path_builder::template CDataStorage<_vertex> CDataStorageBase;
23-
typedef typename _vertex_allocator::template CDataStorage<
24-
typename _path_builder::template CDataStorage<
25-
_vertex
26-
>::CGraphVertex
27-
> CDataStorageAllocator;
28-
typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
29-
typedef typename CGraphVertex::_index_type _index_type;
16+
class BuilderAllocatorDataStorage :
17+
public _path_builder::template CDataStorage<_vertex>,
18+
public _vertex_allocator::template CDataStorage<typename _path_builder::template CDataStorage<_vertex>::CGraphVertex>
19+
{
20+
public:
21+
typedef typename _path_builder::template CDataStorage<_vertex> CDataStorageBase;
22+
typedef typename _vertex_allocator::template CDataStorage<
23+
typename _path_builder::template CDataStorage<
24+
_vertex
25+
>::CGraphVertex
26+
> CDataStorageAllocator;
27+
typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
28+
typedef typename CGraphVertex::_index_type _index_type;
3029

31-
public:
32-
IC CDataStorage (const u32 vertex_count);
33-
virtual ~CDataStorage ();
34-
IC void init ();
35-
};
30+
public:
31+
IC BuilderAllocatorDataStorage(const u32 vertex_count);
32+
virtual ~BuilderAllocatorDataStorage();
33+
IC void init ();
3634
};
3735

3836
#include "xrAICore/Navigation/builder_allocator_constructor_inline.h"

src/xrAICore/Navigation/builder_allocator_constructor_inline.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,19 @@
99
#pragma once
1010

1111
#define TEMPLATE_SPECIALIZATION \
12-
template <typename _1,typename _2>\
13-
template <template <typename _T> class _vertex>
12+
template <template <typename _T> class _vertex, typename _1,typename _2>
1413

15-
#define CConstructorBuilderAllocator CBuilderAllocatorConstructor<_1,_2>::CDataStorage<_vertex>
14+
#define CConstructorBuilderAllocator BuilderAllocatorDataStorage<_vertex,_1,_2>
1615

1716
TEMPLATE_SPECIALIZATION
18-
IC CConstructorBuilderAllocator::CDataStorage (const u32 vertex_count) :
17+
IC CConstructorBuilderAllocator::BuilderAllocatorDataStorage(const u32 vertex_count) :
1918
CDataStorageBase (vertex_count),
2019
CDataStorageAllocator ()
2120
{
2221
}
2322

2423
TEMPLATE_SPECIALIZATION
25-
CConstructorBuilderAllocator::~CDataStorage ()
24+
CConstructorBuilderAllocator::~BuilderAllocatorDataStorage()
2625
{
2726
}
2827

src/xrAICore/Navigation/data_storage_constructor.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ template <typename T1, typename T2> class CEmptyClassTemplate2 {};
1414
#include "xrAICore/Navigation/manager_builder_allocator_constructor.h"
1515

1616
template <
17-
typename _algorithm,
18-
typename _manager,
19-
typename _builder,
20-
typename _allocator,
17+
typename _algorithm, // CDataStorageBucketList|CDataStorageBinaryHeap
18+
typename _manager, // CVertexManagerFixed|CVertexManagerHashFixed
19+
typename _builder, // CEdgePath|CVertexPath
20+
typename _allocator, // CVertexAllocatorFixed
2121
template <typename _T> class _vertex = CEmptyClassTemplate
2222
>
23-
struct CDataStorageConstructor :
23+
struct CDataStorageConstructor : // CDataStorageBucketList::CDataStorage<CManagerBuilderAllocatorConstructor<manager, path, allocator> >
2424
public _algorithm::template CDataStorage<
2525
CManagerBuilderAllocatorConstructor<_manager, _builder, _allocator>, _vertex>
2626
{

src/xrAICore/Navigation/dijkstra.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ template <
4848

4949

5050
typedef CDataStorageConstructor<
51-
_priority_queue,
52-
_vertex_manager,
53-
_data_storage_base,
54-
_vertex_allocator,
51+
_priority_queue, // algorithm
52+
_vertex_manager, // manager
53+
_data_storage_base, // builder
54+
_vertex_allocator, // allocator
5555
_Vertex
5656
> CDataStorage;
5757

src/xrAICore/Navigation/manager_builder_allocator_constructor.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
template <
1414
typename _manager,
15-
typename _builder,
15+
typename _builder, // CVertexPath
1616
typename _allocator
1717
>
1818
struct CManagerBuilderAllocatorConstructor {
@@ -22,13 +22,14 @@ struct CManagerBuilderAllocatorConstructor {
2222
>
2323
class CDataStorage :
2424
public _manager::template CDataStorage<
25+
_builder,
26+
_allocator,
2527
_vertex,
26-
_index_vertex,
27-
CBuilderAllocatorConstructor<_builder, _allocator>
28+
_index_vertex
2829
>
2930
{
3031
public:
31-
typedef typename _manager::template CDataStorage<_vertex, _index_vertex, CBuilderAllocatorConstructor<_builder, _allocator>> inherited;
32+
typedef typename _manager::template CDataStorage<_builder, _allocator, _vertex, _index_vertex> inherited;
3233
typedef typename inherited::inherited inherited_allocator;
3334
typedef typename inherited::CGraphVertex CGraphVertex;
3435
typedef typename CGraphVertex::_index_type _index_type;

src/xrAICore/Navigation/vertex_manager_fixed.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ struct CVertexManagerFixed {
3636
};
3737

3838
template <
39+
typename _builder,
40+
typename _allocator,
3941
template <typename _T> class _vertex = CEmptyClassTemplate,
40-
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2,
41-
typename _data_storage = CBuilderAllocatorConstructor
42+
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2
4243
>
43-
class CDataStorage : public _data_storage::template CDataStorage<VertexManager<_vertex>::_vertex> {
44+
class CDataStorage : public BuilderAllocatorDataStorage<VertexManager<_vertex>::_vertex, _builder, _allocator>
45+
{
4446
public:
45-
typedef typename _data_storage::template CDataStorage<
46-
VertexManager<_vertex>::_vertex
47+
typedef BuilderAllocatorDataStorage<
48+
VertexManager<_vertex>::_vertex, _builder, _allocator
4749
> inherited;
4850
typedef typename inherited::CGraphVertex CGraphVertex;
4951
typedef typename CGraphVertex::_index_type _index_type;

src/xrAICore/Navigation/vertex_manager_fixed_inline.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@
1515
u8 mask\
1616
>\
1717
template <\
18+
typename _builder,\
19+
typename _allocator,\
1820
template <typename _T> class _vertex,\
19-
template <typename _T1, typename _T2> class _index_vertex,\
20-
typename _data_storage\
21+
template <typename _T1, typename _T2> class _index_vertex\
2122
>
2223

23-
#define CFixedVertexManager CVertexManagerFixed<_path_id_type,_index_type,mask>::CDataStorage<_vertex,_index_vertex,_data_storage>
24+
#define CFixedVertexManager CVertexManagerFixed<_path_id_type,_index_type,mask>::CDataStorage<_builder,_allocator,_vertex,_index_vertex>
2425

2526
TEMPLATE_SPECIALIZATION
2627
IC CFixedVertexManager::CDataStorage (const u32 vertex_count) :

src/xrAICore/Navigation/vertex_manager_hash_fixed.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,16 @@ struct CVertexManagerHashFixed {
4747
};
4848

4949
template <
50+
typename _builder,
51+
typename _allocator,
5052
template <typename _T> class _vertex = CEmptyClassTemplate,
51-
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2,
52-
typename _data_storage = CBuilderAllocatorConstructor
53+
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2
5354
>
54-
class CDataStorage : public _data_storage::template CDataStorage<VertexManager<_vertex>::_vertex> {
55+
class CDataStorage : public BuilderAllocatorDataStorage<VertexManager<_vertex>::_vertex, _builder, _allocator>
56+
{
5557
public:
56-
typedef typename _data_storage::template CDataStorage<
57-
VertexManager<
58-
_vertex
59-
>::_vertex
58+
typedef BuilderAllocatorDataStorage<
59+
VertexManager<_vertex>::_vertex, _builder, _allocator
6060
> inherited;
6161
typedef typename inherited::CGraphVertex CGraphVertex;
6262
typedef typename CGraphVertex::_index_type _index_type;

src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,13 @@
1616
u32 fix_size\
1717
>\
1818
template <\
19+
typename _builder,\
20+
typename _allocator,\
1921
template <typename _T> class _vertex,\
20-
template <typename _T1, typename _T2> class _index_vertex,\
21-
typename _data_storage\
22+
template <typename _T1, typename _T2> class _index_vertex\
2223
>
2324

24-
#define CHashFixedVertexManager CVertexManagerHashFixed<_path_id_type,_index_type,hash_size,fix_size>::CDataStorage<_vertex,_index_vertex,_data_storage>
25+
#define CHashFixedVertexManager CVertexManagerHashFixed<_path_id_type,_index_type,hash_size,fix_size>::CDataStorage<_builder,_allocator,_vertex,_index_vertex>
2526

2627
TEMPLATE_SPECIALIZATION
2728
IC CHashFixedVertexManager::CDataStorage (const u32 vertex_count) :

0 commit comments

Comments
 (0)