Skip to content

Commit

Permalink
refactor(ecs): move storages to component dir
Browse files Browse the repository at this point in the history
  • Loading branch information
RiscadoA committed Oct 2, 2023
1 parent 72483ce commit f65b241
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion core/include/cubos/core/ecs/component/manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <shared_mutex>
#include <typeindex>

#include <cubos/core/ecs/storage.hpp>
#include <cubos/core/ecs/component/storage.hpp>

namespace cubos::core::ecs
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
/// @file
/// @brief Class @ref cubos::core::ecs::MapStorage.
/// @ingroup core-ecs
/// @ingroup core-ecs-component

#pragma once

#include <cubos/core/ecs/storage.hpp>
#include <cubos/core/ecs/component/storage.hpp>

namespace cubos::core::ecs
{

/// @brief Storage implementation that uses an `std::unordered_map`.
/// @tparam T Component type.
/// @ingroup core-ecs
/// @ingroup core-ecs-component
template <typename T>
class MapStorage : public Storage<T>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
/// @file
/// @brief Class @ref cubos::core::ecs::NullStorage.
/// @ingroup core-ecs
/// @ingroup core-ecs-component

#pragma once

#include <cubos/core/ecs/storage.hpp>
#include <cubos/core/ecs/component/storage.hpp>

namespace cubos::core::ecs
{

/// @brief Storage implementation that doesn't keep any data, made for
/// zero-sized components.
/// @tparam T Component type.
/// @ingroup core-ecs
/// @ingroup core-ecs-component
template <typename T>
class NullStorage : public Storage<T>
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// @file
/// @brief Class @ref cubos::core::ecs::Storage and related types.
/// @ingroup core-ecs
/// @ingroup core-ecs-component

#pragma once

Expand All @@ -15,7 +15,7 @@ namespace cubos::core::ecs
/// Necessary to provide a type-erased interface for erasing and packaging/unpackaging
/// components.
///
/// @ingroup core-ecs
/// @ingroup core-ecs-component
class IStorage
{
public:
Expand Down Expand Up @@ -45,7 +45,7 @@ namespace cubos::core::ecs

/// @brief Abstract container for a component type @p T.
/// @tparam T Component type.
/// @ingroup core-ecs
/// @ingroup core-ecs-component
template <typename T>
class Storage : public IStorage
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
/// @file
/// @brief Class @ref cubos::core::ecs::VecStorage.
/// @ingroup core-ecs
/// @ingroup core-ecs-component

#pragma once

#include <cubos/core/ecs/storage.hpp>
#include <cubos/core/ecs/component/storage.hpp>

namespace cubos::core::ecs
{
/// @brief Storage implementation that uses a `std::vector`.
/// @tparam T Component type.
/// @ingroup core-ecs
/// @ingroup core-ecs-component
template <typename T>
class VecStorage : public Storage<T>
{
Expand Down
6 changes: 3 additions & 3 deletions core/samples/ecs/general/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

#include <cubos/core/ecs/blueprint.hpp>
#include <cubos/core/ecs/commands.hpp>
#include <cubos/core/ecs/component/map_storage.hpp>
#include <cubos/core/ecs/component/null_storage.hpp>
#include <cubos/core/ecs/component/registry.hpp>
#include <cubos/core/ecs/component/vec_storage.hpp>
#include <cubos/core/ecs/dispatcher.hpp>
#include <cubos/core/ecs/map_storage.hpp>
#include <cubos/core/ecs/null_storage.hpp>
#include <cubos/core/ecs/system.hpp>
#include <cubos/core/ecs/vec_storage.hpp>
#include <cubos/core/ecs/world.hpp>

using namespace cubos::core;
Expand Down
2 changes: 1 addition & 1 deletion core/tests/ecs/registry.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include <doctest/doctest.h>

#include <cubos/core/ecs/component/registry.hpp>
#include <cubos/core/ecs/vec_storage.hpp>
#include <cubos/core/ecs/component/vec_storage.hpp>

#include "utils.hpp"

Expand Down
6 changes: 3 additions & 3 deletions tools/quadrados-gen/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -792,9 +792,9 @@ static bool generate(const GenerateOptions& options)
file << "/// Do not edit this file." << std::endl;
file << std::endl;
file << "#include <cubos/core/ecs/component/registry.hpp>" << std::endl;
file << "#include <cubos/core/ecs/vec_storage.hpp>" << std::endl;
file << "#include <cubos/core/ecs/map_storage.hpp>" << std::endl;
file << "#include <cubos/core/ecs/null_storage.hpp>" << std::endl;
file << "#include <cubos/core/ecs/component/vec_storage.hpp>" << std::endl;
file << "#include <cubos/core/ecs/component/map_storage.hpp>" << std::endl;
file << "#include <cubos/core/ecs/component/null_storage.hpp>" << std::endl;
file << std::endl;

// Include all the component headers.
Expand Down

0 comments on commit f65b241

Please sign in to comment.