Skip to content

Commit

Permalink
Remove ManagerBuilderAllocatorConstructor.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Dec 10, 2015
1 parent 822594a commit b54aca7
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 65 deletions.
8 changes: 4 additions & 4 deletions src/xrAICore/Navigation/data_storage_binary_heap.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ struct CDataStorageBinaryHeap
struct VertexData
{};

template<typename _data_storage, typename TCompoundVertex>
class CDataStorage : public _data_storage::template CDataStorage<TCompoundVertex>
template<typename TManagerDataStorage>
class CDataStorage : public TManagerDataStorage
{
public:
typedef typename _data_storage::template CDataStorage<TCompoundVertex> inherited;
typedef TCompoundVertex CGraphVertex;
typedef TManagerDataStorage inherited;
typedef typename TManagerDataStorage::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_dist_type _dist_type;
typedef typename CGraphVertex::_index_type _index_type;

Expand Down
5 changes: 2 additions & 3 deletions src/xrAICore/Navigation/data_storage_binary_heap_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@

#pragma once

#define TEMPLATE_SPECIALIZATION \
template<typename _data_storage, typename TCompoundVertex>
#define TEMPLATE_SPECIALIZATION template<typename TManagerDataStorage>

#define CBinaryHeap CDataStorageBinaryHeap::CDataStorage<_data_storage,TCompoundVertex>
#define CBinaryHeap CDataStorageBinaryHeap::CDataStorage<TManagerDataStorage>

TEMPLATE_SPECIALIZATION
IC CBinaryHeap::CDataStorage (const u32 vertex_count) :
Expand Down
8 changes: 4 additions & 4 deletions src/xrAICore/Navigation/data_storage_bucket_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ struct CDataStorageBucketList
TCompoundVertex *&prev() { return _prev; }
};

template<typename _data_storage, typename TCompoundVertex>
class CDataStorage : public _data_storage::template CDataStorage<TCompoundVertex>
template<typename TManagerDataStorage>
class CDataStorage : public TManagerDataStorage
{
public:
typedef typename _data_storage::template CDataStorage<TCompoundVertex> inherited;
typedef TCompoundVertex CGraphVertex;
typedef TManagerDataStorage inherited;
typedef typename TManagerDataStorage::CGraphVertex CGraphVertex;
typedef typename CGraphVertex::_dist_type _dist_type;
typedef typename CGraphVertex::_index_type _index_type;

Expand Down
7 changes: 2 additions & 5 deletions src/xrAICore/Navigation/data_storage_bucket_list_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,9 @@
u32 bucket_count,\
bool clear_buckets\
>\
template <\
typename _data_storage,\
typename TCompoundVertex\
>
template<typename TManagerDataStorage>

#define CBucketList CDataStorageBucketList<_path_id_type,_bucket_id_type,bucket_count,clear_buckets>::CDataStorage<_data_storage,TCompoundVertex>
#define CBucketList CDataStorageBucketList<_path_id_type,_bucket_id_type,bucket_count,clear_buckets>::CDataStorage<TManagerDataStorage>

TEMPLATE_SPECIALIZATION
IC CBucketList::CDataStorage (const u32 vertex_count) :
Expand Down
66 changes: 21 additions & 45 deletions src/xrAICore/Navigation/data_storage_constructor.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,57 +7,33 @@
////////////////////////////////////////////////////////////////////////////

#pragma once
struct EmptyVertexData {};
template <typename T> class CEmptyClassTemplate {};
template <typename T1, typename T2> class CEmptyClassTemplate2 {};

template <
typename _manager,
typename _builder, // CVertexPath
typename _allocator
>
struct CManagerBuilderAllocatorConstructor
{
template<typename TCompoundVertex>
class CDataStorage :
public _manager::template CDataStorage<_builder, _allocator, TCompoundVertex>
{
public:
typedef typename _manager::template CDataStorage<_builder, _allocator, TCompoundVertex> inherited;
typedef typename inherited::CDataStorageAllocator inherited_allocator;
typedef TCompoundVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
struct EmptyVertexData
{};

public:
CDataStorage(const u32 vertex_count) :
inherited(vertex_count)
{}
virtual ~CDataStorage() {}
void init() { inherited::init(); }
CGraphVertex &create_vertex(const _index_type &vertex_id)
{ return inherited::create_vertex(inherited_allocator::create_vertex(), vertex_id); }
};
};
template<typename... Components>
struct CompoundVertex : Components::template VertexData<CompoundVertex<Components...>>...
{};

// instantiated in CDijkstra
template <
typename _algorithm, // CDataStorageBucketList|CDataStorageBinaryHeap
typename _manager, // CVertexManagerFixed|CVertexManagerHashFixed
typename _builder, // CEdgePath|CVertexPath
typename _allocator, // CVertexAllocatorFixed
typename TCompoundVertex // _Vertex -- dijkstra vertex
template<
typename TStorage, // CDataStorageBucketList|CDataStorageBinaryHeap
typename TVertexManager, // CVertexManagerFixed|CVertexManagerHashFixed
typename TPathBuilder, // CEdgePath|CVertexPath
typename TVertexAllocator, // CVertexAllocatorFixed
typename TCompoundVertex,
typename TManagerDataStorage = typename TVertexManager::template
CDataStorage<TPathBuilder, TVertexAllocator, TCompoundVertex>,
typename TDataStorageBase = typename TStorage::template CDataStorage<TManagerDataStorage>
>
struct CDataStorageConstructor : // CDataStorageBucketList::CDataStorage<CManagerBuilderAllocatorConstructor<manager, path, allocator> >
public _algorithm::template CDataStorage<
CManagerBuilderAllocatorConstructor<_manager, _builder, _allocator>, TCompoundVertex>
struct CDataStorageConstructor : public TDataStorageBase
{
typedef typename _algorithm::template CDataStorage<
CManagerBuilderAllocatorConstructor<_manager, _builder, _allocator>, TCompoundVertex> inherited;

typedef TDataStorageBase inherited;
typedef TCompoundVertex CGraphVertex;
typedef typename CGraphVertex::_index_type _index_type;
typedef typename CGraphVertex::_index_type _index_type;

CDataStorageConstructor (const u32 vertex_count) :
inherited(vertex_count)
CDataStorageConstructor(const u32 vertex_count) : inherited(vertex_count)
{}
void init() { inherited::init(); }
CGraphVertex &create_vertex(const _index_type &vertex_id)
{ return inherited::create_vertex(inherited::CDataStorageAllocator::create_vertex(), vertex_id); }
};
4 changes: 0 additions & 4 deletions src/xrAICore/Navigation/graph_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ using namespace GraphEngineSpace;
class CGraphEngine
{
public:
template<typename... Components>
struct CompoundVertex : Components::template VertexData<CompoundVertex<Components...>>...
{};

#ifndef AI_COMPILER
using CSolverPriorityQueue = CDataStorageBinaryHeap;
using CStringPriorityQueue = CDataStorageBinaryHeap;
Expand Down

0 comments on commit b54aca7

Please sign in to comment.