Skip to content

Commit

Permalink
Inline BuilderAllocatorDataStorage.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Dec 10, 2015
1 parent 5c12997 commit d78563d
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 67 deletions.
38 changes: 0 additions & 38 deletions src/xrAICore/Navigation/builder_allocator_constructor.h

This file was deleted.

11 changes: 5 additions & 6 deletions src/xrAICore/Navigation/data_storage_constructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ template <typename T> class CEmptyClassTemplate {};
template <typename T1, typename T2> class CEmptyClassTemplate2 {};

#include "xrAICore/Navigation/manager_builder_allocator_constructor.h"

// instantiated in CDijkstra
template <
typename _algorithm, // CDataStorageBucketList|CDataStorageBinaryHeap
typename _manager, // CVertexManagerFixed|CVertexManagerHashFixed
typename _builder, // CEdgePath|CVertexPath
typename _allocator, // CVertexAllocatorFixed
template <typename _T> class _vertex = CEmptyClassTemplate // _Vertex
template <typename _T> class _vertex = CEmptyClassTemplate // _Vertex -- dijkstra vertex
>
struct CDataStorageConstructor : // CDataStorageBucketList::CDataStorage<CManagerBuilderAllocatorConstructor<manager, path, allocator> >
public _algorithm::template CDataStorage<
Expand All @@ -30,8 +30,7 @@ struct CDataStorageConstructor : // CDataStorageBucketList::CDataStorage<CManage
typedef typename inherited::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;

IC CDataStorageConstructor (const u32 vertex_count) :
inherited(vertex_count)
{
}
CDataStorageConstructor (const u32 vertex_count) :
inherited(vertex_count)
{}
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@

#pragma once

#include "xrAICore/Navigation/builder_allocator_constructor.h"

template <
typename _manager,
typename _builder, // CVertexPath
Expand All @@ -30,7 +28,7 @@ struct CManagerBuilderAllocatorConstructor {
{
public:
typedef typename _manager::template CDataStorage<_builder, _allocator, _vertex, _index_vertex> inherited;
typedef typename inherited::inherited inherited_allocator;
typedef typename inherited::CDataStorageAllocator inherited_allocator;
typedef typename inherited::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;

Expand Down
15 changes: 9 additions & 6 deletions src/xrAICore/Navigation/vertex_manager_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ struct CVertexManagerFixed {
template <typename _T> class _vertex = CEmptyClassTemplate,
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2
>
class CDataStorage : public BuilderAllocatorDataStorage<VertexManager<_vertex>::_vertex, _builder, _allocator>
class CDataStorage :
public _builder::template CDataStorage<VertexManager<_vertex>::_vertex>,
public _allocator::template CDataStorage<typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex>::CGraphVertex>
{
public:
typedef BuilderAllocatorDataStorage<
VertexManager<_vertex>::_vertex, _builder, _allocator
> inherited;
typedef typename inherited::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
typedef typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex> CDataStorageBase;
typedef typename _allocator::template CDataStorage<
typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex>::CGraphVertex> CDataStorageAllocator;
typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
//using inherited = CDataStorageAllocator;

#pragma pack(push,1)
template <typename _path_id_type>
Expand Down
6 changes: 4 additions & 2 deletions src/xrAICore/Navigation/vertex_manager_fixed_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

TEMPLATE_SPECIALIZATION
IC CFixedVertexManager::CDataStorage (const u32 vertex_count) :
inherited (vertex_count)
CDataStorageBase(vertex_count),
CDataStorageAllocator()
{
m_current_path_id = _path_id_type(0);
m_max_node_count = vertex_count;
Expand All @@ -48,7 +49,8 @@ CFixedVertexManager::~CDataStorage ()
TEMPLATE_SPECIALIZATION
IC void CFixedVertexManager::init ()
{
inherited::init ();
CDataStorageBase::init();
CDataStorageAllocator::init();
++m_current_path_id;
if (!m_current_path_id) {
ZeroMemory (m_indexes,(m_max_node_count)*sizeof(CGraphIndexVertex));
Expand Down
12 changes: 7 additions & 5 deletions src/xrAICore/Navigation/vertex_manager_hash_fixed.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ struct CVertexManagerHashFixed {
template <typename _T> class _vertex = CEmptyClassTemplate,
template <typename _T1, typename _T2> class _index_vertex = CEmptyClassTemplate2
>
class CDataStorage : public BuilderAllocatorDataStorage<VertexManager<_vertex>::_vertex, _builder, _allocator>
class CDataStorage :
public _builder::template CDataStorage<VertexManager<_vertex>::_vertex>,
public _allocator::template CDataStorage<typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex>::CGraphVertex>
{
public:
typedef BuilderAllocatorDataStorage<
VertexManager<_vertex>::_vertex, _builder, _allocator
> inherited;
typedef typename inherited::CGraphVertex CGraphVertex;
typedef typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex> CDataStorageBase;
typedef typename _allocator::template CDataStorage<
typename _builder::template CDataStorage<VertexManager<_vertex>::_vertex>::CGraphVertex> CDataStorageAllocator;
typedef typename CDataStorageBase::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;

#pragma pack(push,1)
Expand Down
8 changes: 5 additions & 3 deletions src/xrAICore/Navigation/vertex_manager_hash_fixed_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@

TEMPLATE_SPECIALIZATION
IC CHashFixedVertexManager::CDataStorage (const u32 vertex_count) :
inherited (vertex_count),
m_current_path_id (_path_id_type(0))
CDataStorageBase(vertex_count),
CDataStorageAllocator(),
m_current_path_id(_path_id_type(0))
{
u32 memory_usage = 0;
u32 byte_count;
Expand All @@ -53,7 +54,8 @@ CHashFixedVertexManager::~CDataStorage ()
TEMPLATE_SPECIALIZATION
IC void CHashFixedVertexManager::init ()
{
inherited::init ();
CDataStorageBase::init();
CDataStorageAllocator::init();
++m_current_path_id;
m_vertex_count = 0;
if (!m_current_path_id) {
Expand Down
1 change: 0 additions & 1 deletion src/xrAICore/xrAICore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@
<ClInclude Include="Navigation\ai_object_location_inline.h" />
<ClInclude Include="Navigation\a_star.h" />
<ClInclude Include="Navigation\a_star_inline.h" />
<ClInclude Include="Navigation\builder_allocator_constructor.h" />
<ClInclude Include="Navigation\data_storage_binary_heap.h" />
<ClInclude Include="Navigation\data_storage_binary_heap_inline.h" />
<ClInclude Include="Navigation\data_storage_bucket_list.h" />
Expand Down
3 changes: 0 additions & 3 deletions src/xrAICore/xrAICore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@
<ClInclude Include="Navigation\dijkstra_inline.h">
<Filter>AI\Navigation\Pathfinding\Algorithms\Dijkstra</Filter>
</ClInclude>
<ClInclude Include="Navigation\builder_allocator_constructor.h">
<Filter>AI\Navigation\Pathfinding\DataStorages\Constructors</Filter>
</ClInclude>
<ClInclude Include="Navigation\data_storage_constructor.h">
<Filter>AI\Navigation\Pathfinding\DataStorages\Constructors</Filter>
</ClInclude>
Expand Down

0 comments on commit d78563d

Please sign in to comment.