Skip to content

Commit

Permalink
Tweak vertex manager templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Dec 10, 2015
1 parent b5904e0 commit f568932
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 58 deletions.
42 changes: 20 additions & 22 deletions src/xrAICore/Navigation/builder_allocator_constructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,28 @@
#pragma once

template <
typename _path_builder,
typename _vertex_allocator
template <typename _T> class _vertex,
typename _path_builder,
typename _vertex_allocator
>
struct CBuilderAllocatorConstructor {
template <template <typename _T> class _vertex>
class CDataStorage :
public _path_builder::template CDataStorage<_vertex>,
public _vertex_allocator::template CDataStorage<typename _path_builder::template CDataStorage<_vertex>::CGraphVertex>
{
public:
typedef typename _path_builder::template CDataStorage<_vertex> CDataStorageBase;
typedef typename _vertex_allocator::template CDataStorage<
typename _path_builder::template CDataStorage<
_vertex
>::CGraphVertex
> CDataStorageAllocator;
typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
class BuilderAllocatorDataStorage :
public _path_builder::template CDataStorage<_vertex>,
public _vertex_allocator::template CDataStorage<typename _path_builder::template CDataStorage<_vertex>::CGraphVertex>
{
public:
typedef typename _path_builder::template CDataStorage<_vertex> CDataStorageBase;
typedef typename _vertex_allocator::template CDataStorage<
typename _path_builder::template CDataStorage<
_vertex
>::CGraphVertex
> CDataStorageAllocator;
typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;

public:
IC CDataStorage (const u32 vertex_count);
virtual ~CDataStorage ();
IC void init ();
};
public:
IC BuilderAllocatorDataStorage(const u32 vertex_count);
virtual ~BuilderAllocatorDataStorage();
IC void init ();
};

#include "xrAICore/Navigation/builder_allocator_constructor_inline.h"
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@
#pragma once

#define TEMPLATE_SPECIALIZATION \
template <typename _1,typename _2>\
template <template <typename _T> class _vertex>
template <template <typename _T> class _vertex, typename _1,typename _2>

#define CConstructorBuilderAllocator CBuilderAllocatorConstructor<_1,_2>::CDataStorage<_vertex>
#define CConstructorBuilderAllocator BuilderAllocatorDataStorage<_vertex,_1,_2>

TEMPLATE_SPECIALIZATION
IC CConstructorBuilderAllocator::CDataStorage (const u32 vertex_count) :
IC CConstructorBuilderAllocator::BuilderAllocatorDataStorage(const u32 vertex_count) :
CDataStorageBase (vertex_count),
CDataStorageAllocator ()
{
}

TEMPLATE_SPECIALIZATION
CConstructorBuilderAllocator::~CDataStorage ()
CConstructorBuilderAllocator::~BuilderAllocatorDataStorage()
{
}

Expand Down
10 changes: 5 additions & 5 deletions src/xrAICore/Navigation/data_storage_constructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ template <typename T1, typename T2> class CEmptyClassTemplate2 {};
#include "xrAICore/Navigation/manager_builder_allocator_constructor.h"

template <
typename _algorithm,
typename _manager,
typename _builder,
typename _allocator,
typename _algorithm, // CDataStorageBucketList|CDataStorageBinaryHeap
typename _manager, // CVertexManagerFixed|CVertexManagerHashFixed
typename _builder, // CEdgePath|CVertexPath
typename _allocator, // CVertexAllocatorFixed
template <typename _T> class _vertex = CEmptyClassTemplate
>
struct CDataStorageConstructor :
struct CDataStorageConstructor : // CDataStorageBucketList::CDataStorage<CManagerBuilderAllocatorConstructor<manager, path, allocator> >
public _algorithm::template CDataStorage<
CManagerBuilderAllocatorConstructor<_manager, _builder, _allocator>, _vertex>
{
Expand Down
8 changes: 4 additions & 4 deletions src/xrAICore/Navigation/dijkstra.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ template <


typedef CDataStorageConstructor<
_priority_queue,
_vertex_manager,
_data_storage_base,
_vertex_allocator,
_priority_queue, // algorithm
_vertex_manager, // manager
_data_storage_base, // builder
_vertex_allocator, // allocator
_Vertex
> CDataStorage;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

template <
typename _manager,
typename _builder,
typename _builder, // CVertexPath
typename _allocator
>
struct CManagerBuilderAllocatorConstructor {
Expand All @@ -22,13 +22,14 @@ struct CManagerBuilderAllocatorConstructor {
>
class CDataStorage :
public _manager::template CDataStorage<
_builder,
_allocator,
_vertex,
_index_vertex,
CBuilderAllocatorConstructor<_builder, _allocator>
_index_vertex
>
{
public:
typedef typename _manager::template CDataStorage<_vertex, _index_vertex, CBuilderAllocatorConstructor<_builder, _allocator>> inherited;
typedef typename _manager::template CDataStorage<_builder, _allocator, _vertex, _index_vertex> inherited;
typedef typename inherited::inherited inherited_allocator;
typedef typename inherited::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
Expand Down
12 changes: 7 additions & 5 deletions src/xrAICore/Navigation/vertex_manager_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ struct CVertexManagerFixed {
};

template <
typename _builder,
typename _allocator,
template <typename _T> class _vertex = CEmptyClassTemplate,
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2,
typename _data_storage = CBuilderAllocatorConstructor
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2
>
class CDataStorage : public _data_storage::template CDataStorage<VertexManager<_vertex>::_vertex> {
class CDataStorage : public BuilderAllocatorDataStorage<VertexManager<_vertex>::_vertex, _builder, _allocator>
{
public:
typedef typename _data_storage::template CDataStorage<
VertexManager<_vertex>::_vertex
typedef BuilderAllocatorDataStorage<
VertexManager<_vertex>::_vertex, _builder, _allocator
> inherited;
typedef typename inherited::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
Expand Down
7 changes: 4 additions & 3 deletions src/xrAICore/Navigation/vertex_manager_fixed_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
u8 mask\
>\
template <\
typename _builder,\
typename _allocator,\
template <typename _T> class _vertex,\
template <typename _T1, typename _T2> class _index_vertex,\
typename _data_storage\
template <typename _T1, typename _T2> class _index_vertex\
>

#define CFixedVertexManager CVertexManagerFixed<_path_id_type,_index_type,mask>::CDataStorage<_vertex,_index_vertex,_data_storage>
#define CFixedVertexManager CVertexManagerFixed<_path_id_type,_index_type,mask>::CDataStorage<_builder,_allocator,_vertex,_index_vertex>

TEMPLATE_SPECIALIZATION
IC CFixedVertexManager::CDataStorage (const u32 vertex_count) :
Expand Down
14 changes: 7 additions & 7 deletions src/xrAICore/Navigation/vertex_manager_hash_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ struct CVertexManagerHashFixed {
};

template <
typename _builder,
typename _allocator,
template <typename _T> class _vertex = CEmptyClassTemplate,
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2,
typename _data_storage = CBuilderAllocatorConstructor
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2
>
class CDataStorage : public _data_storage::template CDataStorage<VertexManager<_vertex>::_vertex> {
class CDataStorage : public BuilderAllocatorDataStorage<VertexManager<_vertex>::_vertex, _builder, _allocator>
{
public:
typedef typename _data_storage::template CDataStorage<
VertexManager<
_vertex
>::_vertex
typedef BuilderAllocatorDataStorage<
VertexManager<_vertex>::_vertex, _builder, _allocator
> inherited;
typedef typename inherited::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
Expand Down
7 changes: 4 additions & 3 deletions src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
u32 fix_size\
>\
template <\
typename _builder,\
typename _allocator,\
template <typename _T> class _vertex,\
template <typename _T1, typename _T2> class _index_vertex,\
typename _data_storage\
template <typename _T1, typename _T2> class _index_vertex\
>

#define CHashFixedVertexManager CVertexManagerHashFixed<_path_id_type,_index_type,hash_size,fix_size>::CDataStorage<_vertex,_index_vertex,_data_storage>
#define CHashFixedVertexManager CVertexManagerHashFixed<_path_id_type,_index_type,hash_size,fix_size>::CDataStorage<_builder,_allocator,_vertex,_index_vertex>

TEMPLATE_SPECIALIZATION
IC CHashFixedVertexManager::CDataStorage (const u32 vertex_count) :
Expand Down

0 comments on commit f568932

Please sign in to comment.