Skip to content

Commit

Permalink
namespace -> Ubpa::UECS
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubpa committed Jul 30, 2020
1 parent fefdb7b commit aef787a
Show file tree
Hide file tree
Showing 62 changed files with 80 additions and 72 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)

project(UECS VERSION 0.9.7)
project(UECS VERSION 0.9.8)
message(STATUS "[Project] ${PROJECT_NAME}")

include(cmake/InitUCMake.cmake)
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/CmptPtr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <cassert>

namespace Ubpa {
namespace Ubpa::UECS {
// CmptType + void*
class CmptPtr {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/CmptTag.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <UTemplate/Typelist.h>

namespace Ubpa {
namespace Ubpa::UECS {
namespace CmptTag {
// LastFrame -> Write -> Latest

Expand Down
2 changes: 1 addition & 1 deletion include/UECS/CmptType.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <UTemplate/TypeID.h>

namespace Ubpa {
namespace Ubpa::UECS {
// Component Type
// use a hashcode to distinguish different type
class CmptType {
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/Entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "detail/Util.h"

namespace Ubpa {
namespace Ubpa::UECS {
// index + version
class Entity {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/EntityFilter.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <set>

namespace Ubpa {
namespace Ubpa::UECS {
// filter Archetype with All, Any and None
class EntityFilter {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/EntityLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <set>

namespace Ubpa {
namespace Ubpa::UECS {
// locate components in function's argument list for Archetype
class EntityLocator {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/EntityMngr.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <mutex>

namespace Ubpa {
namespace Ubpa::UECS {
class World;

class IListener;
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/EntityQuery.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include "EntityFilter.h"
#include "EntityLocator.h"

namespace Ubpa {
namespace Ubpa::UECS {
// EntityFilter + EntityLocator
class EntityQuery {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/IListener.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <string_view>

namespace Ubpa {
namespace Ubpa::UECS {
class World;
class SystemMngr;
class EntityMngr;
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/RTDCmptTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <unordered_map>
#include <functional>

namespace Ubpa {
namespace Ubpa::UECS {
// run-time dynamic component traits, singleton
// size (> 0) is neccessary
// optional
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/RTDCmptsView.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <set>

namespace Ubpa {
namespace Ubpa::UECS {
class EntityLocator;

// use RTDCmptsView::Iterator to read CmptPtr
Expand Down
4 changes: 2 additions & 2 deletions include/UECS/Schedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

#include <map>

namespace Ubpa::detail::Schedule_ {
namespace Ubpa::UECS::detail::Schedule_ {
struct Compiler;
}

namespace Ubpa {
namespace Ubpa::UECS {
class EntityMngr;
class SystemMngr;

Expand Down
2 changes: 1 addition & 1 deletion include/UECS/SystemFunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <functional>

namespace Ubpa {
namespace Ubpa::UECS {
// [description]
// system function registered by Schedule in <System>::OnUpdate(Schedule&)
// name + query + function<...>
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/SystemMngr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <UContainer/xSTL/xMap.h>

namespace Ubpa{
namespace Ubpa::UECS{
class IListener;

// System Manager
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <UGraphviz/UGraphviz.h>

namespace Ubpa {
namespace Ubpa::UECS {
class IListener;

// SystemMngr + EntityMngr
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/Archetype.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include <map>

namespace Ubpa {
namespace Ubpa::UECS {
class EntityMngr;

// Entity is a special Component
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/Archetype.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <cassert>

namespace Ubpa {
namespace Ubpa::UECS {
template<typename... Cmpts>
Archetype::Archetype(TypeList<Cmpts...>)
: types(TypeList<Entity, Cmpts...>{})
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/Chunk.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <tuple>
#include <vector>

namespace Ubpa {
namespace Ubpa::UECS {
using byte = uint8_t;
static_assert(sizeof(byte) == 1);
struct alignas(128) Chunk {
Expand Down
4 changes: 2 additions & 2 deletions include/UECS/detail/CmptTag.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include <type_traits>

namespace Ubpa {
namespace Ubpa::UECS {
class Entity;
class EntityLocator;
}

namespace Ubpa::CmptTag {
namespace Ubpa::UECS::CmptTag {
template<typename Cmpt> struct RemoveTag<const Cmpt*> : IType<Cmpt> {};
template<typename Cmpt> struct RemoveTag<Cmpt*> : IType<Cmpt> {};
template<typename Cmpt> struct RemoveTag<LastFrame<Cmpt>> : IType<Cmpt> {};
Expand Down
4 changes: 2 additions & 2 deletions include/UECS/detail/CmptType.inl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace std {
struct hash;

template<>
struct hash<Ubpa::CmptType> {
constexpr size_t operator()(const Ubpa::CmptType& t) const noexcept {
struct hash<Ubpa::UECS::CmptType> {
constexpr size_t operator()(const Ubpa::UECS::CmptType& t) const noexcept {
return t.HashCode();
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/CmptTypeSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#include <set>

namespace Ubpa {
namespace Ubpa::UECS {
class CmptTypeSet : std::set<CmptType> {
public:
CmptTypeSet() : hashcode{ TypeID<CmptTypeSet> } {}
Expand Down
6 changes: 3 additions & 3 deletions include/UECS/detail/CmptTypeSet.inl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

namespace Ubpa {
namespace Ubpa::UECS {
inline CmptTypeSet::CmptTypeSet(const CmptType* types, size_t num) {
assert(types != nullptr && num != 0);
for (size_t i = 0; i < num; i++)
Expand Down Expand Up @@ -106,8 +106,8 @@ namespace Ubpa {

namespace std {
template<>
struct hash<Ubpa::CmptTypeSet> {
size_t operator()(const Ubpa::CmptTypeSet& types) const noexcept {
struct hash<Ubpa::UECS::CmptTypeSet> {
size_t operator()(const Ubpa::UECS::CmptTypeSet& types) const noexcept {
return types.HashCode();
}
};
Expand Down
6 changes: 3 additions & 3 deletions include/UECS/detail/EntityFilter.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Util.h"

namespace Ubpa {
namespace Ubpa::UECS {
template<typename... AllCmpts, typename... AnyCmpts, typename... NoneCmpts>
EntityFilter::EntityFilter(TypeList<AllCmpts...>, TypeList<AnyCmpts...>, TypeList<NoneCmpts...>)
: allCmptTypes{ CmptType::Of<AllCmpts>... },
Expand Down Expand Up @@ -125,8 +125,8 @@ namespace std {
template<typename T>
struct hash;
template<>
struct hash<Ubpa::EntityFilter> {
size_t operator()(const Ubpa::EntityFilter& filter) const noexcept {
struct hash<Ubpa::UECS::EntityFilter> {
size_t operator()(const Ubpa::UECS::EntityFilter& filter) const noexcept {
return filter.HashCode();
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/EntityLocator.inl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

#include <UTemplate/Func.h>

namespace Ubpa {
namespace Ubpa::UECS {
template<typename TaggedCmptList>
EntityLocator::EntityLocator(TaggedCmptList)
: EntityLocator{ Filter_t<TaggedCmptList, CmptTag::IsLastFrame>{},
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/EntityMngr.inl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <UTemplate/Typelist.h>
#include <UTemplate/Func.h>

namespace Ubpa {
namespace Ubpa::UECS {
template<typename... Cmpts>
Archetype* EntityMngr::GetOrCreateArchetypeOf() {
static_assert(IsSet_v<TypeList<Entity, Cmpts...>>,
Expand Down
6 changes: 3 additions & 3 deletions include/UECS/detail/EntityQuery.inl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

namespace Ubpa {
namespace Ubpa::UECS {
template<typename... AllCmpts, typename... AnyCmpts, typename... NoneCmpts, typename... Cmpts>
EntityQuery::EntityQuery(TypeList<AllCmpts...>, TypeList<AnyCmpts...>, TypeList<NoneCmpts...>, TypeList<Cmpts...>)
: filter{ TypeList<AllCmpts...>{}, TypeList<AnyCmpts...>{}, TypeList<NoneCmpts...>{} },
Expand All @@ -13,8 +13,8 @@ namespace std {
template<typename T>
struct hash;
template<>
struct hash<Ubpa::EntityQuery> {
size_t operator()(const Ubpa::EntityQuery& query) const noexcept {
struct hash<Ubpa::UECS::EntityQuery> {
size_t operator()(const Ubpa::UECS::EntityQuery& query) const noexcept {
return query.HashCode();
}
};
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/Job.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "_deps/taskflow/taskflow.hpp"

namespace Ubpa {
namespace Ubpa::UECS {
using Job = tf::Taskflow;
using JobHandle = tf::Task;

Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/RTDCmptTraits.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "../RTDCmptTraits.h"

namespace Ubpa {
namespace Ubpa::UECS {
inline RTDCmptTraits& RTDCmptTraits::Instance() noexcept {
static RTDCmptTraits instance;
return instance;
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/RTSCmptTraits.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <unordered_map>
#include <functional>

namespace Ubpa {
namespace Ubpa::UECS {
// run-time static component traits
class RTSCmptTraits {
public:
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/RTSCmptTraits.inl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#include <stdexcept>

namespace Ubpa {
namespace Ubpa::UECS {
inline size_t RTSCmptTraits::Sizeof(CmptType type) const {
assert(sizeofs.find(type) != sizeofs.end());
return sizeofs.find(type)->second;
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/Schedule.inl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

namespace Ubpa {
namespace Ubpa::UECS {
template<typename Func>
Schedule& Schedule::Register(Func&& func, std::string name, EntityFilter filter) {
Request(std::forward<Func>(func), std::move(name), std::move(filter));
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/SysFuncGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <unordered_set>
#include <vector>

namespace Ubpa {
namespace Ubpa::UECS {
class SystemFunc;
class SysFuncGraph {
public:
Expand Down
6 changes: 3 additions & 3 deletions include/UECS/detail/SystemFunc.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include <_deps/nameof.hpp>

namespace Ubpa::detail::System_ {
namespace Ubpa::UECS::detail::System_ {
template<typename Func>
auto Pack(Func&& func) noexcept;
}

namespace Ubpa {
namespace Ubpa::UECS {
template<typename Func>
SystemFunc::SystemFunc(Func&& func, std::string name, EntityLocator locator, EntityFilter filter)
: isJob{ IsEmpty_v<FuncTraits_ArgList<Func>> },
Expand Down Expand Up @@ -40,7 +40,7 @@ namespace Ubpa {
}
}

namespace Ubpa::detail::System_ {
namespace Ubpa::UECS::detail::System_ {
template<typename DecayedArgList, typename SortedCmptList>
struct Packer;

Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/SystemMngr.inl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

namespace Ubpa {
namespace Ubpa::UECS {
template<typename System>
void SystemMngr::RegisterOne() {
Register(std::string{ nameof::nameof_type<System>() }, &System::OnUpdate);
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <array>
#include <string_view>

namespace Ubpa {
namespace Ubpa::UECS {
static constexpr size_t size_t_invalid = static_cast<size_t>(-1);

inline constexpr size_t hash_combine(size_t x, size_t y) noexcept;
Expand Down
2 changes: 1 addition & 1 deletion include/UECS/detail/Util.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include <UTemplate/TypeID.h>

namespace Ubpa {
namespace Ubpa::UECS {
constexpr size_t hash_combine(size_t x, size_t y) noexcept {
return x ^ (y + 0x9e3779b9 + (x << 6) + (x >> 2));
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Archetype.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <UECS/detail/Archetype.h>

using namespace Ubpa;
using namespace Ubpa::UECS;
using namespace std;

void Archetype::SetLayout() {
Expand Down
Loading

0 comments on commit aef787a

Please sign in to comment.