Browse Source

minor changes

Michele Caini 7 years ago
parent
commit
65536febd5

+ 88 - 1
src/entt/entity/entity.hpp

@@ -3,12 +3,99 @@
 
 
 #include "../config/config.h"
-#include "entt_traits.hpp"
 
 
 namespace entt {
 
 
+/**
+ * @brief Entity traits.
+ *
+ * Primary template isn't defined on purpose. All the specializations give a
+ * compile-time error unless the template parameter is an accepted entity type.
+ */
+template<typename>
+struct entt_traits;
+
+
+/**
+ * @brief Entity traits for a 16 bits entity identifier.
+ *
+ * A 16 bits entity identifier guarantees:
+ *
+ * * 12 bits for the entity number (up to 4k entities).
+ * * 4 bit for the version (resets in [0-15]).
+ */
+template<>
+struct entt_traits<std::uint16_t> {
+    /*! @brief Underlying entity type. */
+    using entity_type = std::uint16_t;
+    /*! @brief Underlying version type. */
+    using version_type = std::uint8_t;
+    /*! @brief Difference type. */
+    using difference_type = std::int32_t;
+
+    /*! @brief Mask to use to get the entity number out of an identifier. */
+    static constexpr std::uint16_t entity_mask = 0xFFF;
+    /*! @brief Mask to use to get the version out of an identifier. */
+    static constexpr std::uint16_t version_mask = 0xF;
+    /*! @brief Extent of the entity number within an identifier. */
+    static constexpr auto entity_shift = 12;
+};
+
+
+/**
+ * @brief Entity traits for a 32 bits entity identifier.
+ *
+ * A 32 bits entity identifier guarantees:
+ *
+ * * 20 bits for the entity number (suitable for almost all the games).
+ * * 12 bit for the version (resets in [0-4095]).
+ */
+template<>
+struct entt_traits<std::uint32_t> {
+    /*! @brief Underlying entity type. */
+    using entity_type = std::uint32_t;
+    /*! @brief Underlying version type. */
+    using version_type = std::uint16_t;
+    /*! @brief Difference type. */
+    using difference_type = std::int64_t;
+
+    /*! @brief Mask to use to get the entity number out of an identifier. */
+    static constexpr std::uint32_t entity_mask = 0xFFFFF;
+    /*! @brief Mask to use to get the version out of an identifier. */
+    static constexpr std::uint32_t version_mask = 0xFFF;
+    /*! @brief Extent of the entity number within an identifier. */
+    static constexpr auto entity_shift = 20;
+};
+
+
+/**
+ * @brief Entity traits for a 64 bits entity identifier.
+ *
+ * A 64 bits entity identifier guarantees:
+ *
+ * * 32 bits for the entity number (an indecently large number).
+ * * 32 bit for the version (an indecently large number).
+ */
+template<>
+struct entt_traits<std::uint64_t> {
+    /*! @brief Underlying entity type. */
+    using entity_type = std::uint64_t;
+    /*! @brief Underlying version type. */
+    using version_type = std::uint32_t;
+    /*! @brief Difference type. */
+    using difference_type = std::int64_t;
+
+    /*! @brief Mask to use to get the entity number out of an identifier. */
+    static constexpr std::uint64_t entity_mask = 0xFFFFFFFF;
+    /*! @brief Mask to use to get the version out of an identifier. */
+    static constexpr std::uint64_t version_mask = 0xFFFFFFFF;
+    /*! @brief Extent of the entity number within an identifier. */
+    static constexpr auto entity_shift = 32;
+};
+
+
 /**
  * @cond TURN_OFF_DOXYGEN
  * Internal details not to be documented.

+ 0 - 102
src/entt/entity/entt_traits.hpp

@@ -1,102 +0,0 @@
-#ifndef ENTT_ENTITY_ENTT_TRAITS_HPP
-#define ENTT_ENTITY_ENTT_TRAITS_HPP
-
-
-#include <cstdint>
-
-
-namespace entt {
-
-
-/**
- * @brief Entity traits.
- *
- * Primary template isn't defined on purpose. All the specializations give a
- * compile-time error unless the template parameter is an accepted entity type.
- */
-template<typename>
-struct entt_traits;
-
-
-/**
- * @brief Entity traits for a 16 bits entity identifier.
- *
- * A 16 bits entity identifier guarantees:
- *
- * * 12 bits for the entity number (up to 4k entities).
- * * 4 bit for the version (resets in [0-15]).
- */
-template<>
-struct entt_traits<std::uint16_t> {
-    /*! @brief Underlying entity type. */
-    using entity_type = std::uint16_t;
-    /*! @brief Underlying version type. */
-    using version_type = std::uint8_t;
-    /*! @brief Difference type. */
-    using difference_type = std::int32_t;
-
-    /*! @brief Mask to use to get the entity number out of an identifier. */
-    static constexpr std::uint16_t entity_mask = 0xFFF;
-    /*! @brief Mask to use to get the version out of an identifier. */
-    static constexpr std::uint16_t version_mask = 0xF;
-    /*! @brief Extent of the entity number within an identifier. */
-    static constexpr auto entity_shift = 12;
-};
-
-
-/**
- * @brief Entity traits for a 32 bits entity identifier.
- *
- * A 32 bits entity identifier guarantees:
- *
- * * 20 bits for the entity number (suitable for almost all the games).
- * * 12 bit for the version (resets in [0-4095]).
- */
-template<>
-struct entt_traits<std::uint32_t> {
-    /*! @brief Underlying entity type. */
-    using entity_type = std::uint32_t;
-    /*! @brief Underlying version type. */
-    using version_type = std::uint16_t;
-    /*! @brief Difference type. */
-    using difference_type = std::int64_t;
-
-    /*! @brief Mask to use to get the entity number out of an identifier. */
-    static constexpr std::uint32_t entity_mask = 0xFFFFF;
-    /*! @brief Mask to use to get the version out of an identifier. */
-    static constexpr std::uint32_t version_mask = 0xFFF;
-    /*! @brief Extent of the entity number within an identifier. */
-    static constexpr auto entity_shift = 20;
-};
-
-
-/**
- * @brief Entity traits for a 64 bits entity identifier.
- *
- * A 64 bits entity identifier guarantees:
- *
- * * 32 bits for the entity number (an indecently large number).
- * * 32 bit for the version (an indecently large number).
- */
-template<>
-struct entt_traits<std::uint64_t> {
-    /*! @brief Underlying entity type. */
-    using entity_type = std::uint64_t;
-    /*! @brief Underlying version type. */
-    using version_type = std::uint32_t;
-    /*! @brief Difference type. */
-    using difference_type = std::int64_t;
-
-    /*! @brief Mask to use to get the entity number out of an identifier. */
-    static constexpr std::uint64_t entity_mask = 0xFFFFFFFF;
-    /*! @brief Mask to use to get the version out of an identifier. */
-    static constexpr std::uint64_t version_mask = 0xFFFFFFFF;
-    /*! @brief Extent of the entity number within an identifier. */
-    static constexpr auto entity_shift = 32;
-};
-
-
-}
-
-
-#endif // ENTT_ENTITY_ENTT_TRAITS_HPP

+ 6 - 6
src/entt/entity/registry.hpp

@@ -12,19 +12,19 @@
 #include <algorithm>
 #include <type_traits>
 #include "../config/config.h"
-#include "../core/algorithm.hpp"
 #include "../core/family.hpp"
+#include "../core/algorithm.hpp"
 #include "../core/hashed_string.hpp"
 #include "../core/type_traits.hpp"
 #include "../signal/sigh.hpp"
-#include "entt_traits.hpp"
-#include "entity.hpp"
-#include "fwd.hpp"
-#include "group.hpp"
 #include "runtime_view.hpp"
-#include "snapshot.hpp"
 #include "sparse_set.hpp"
+#include "snapshot.hpp"
+#include "entity.hpp"
+#include "group.hpp"
 #include "view.hpp"
+#include "pool.hpp"
+#include "fwd.hpp"
 
 
 namespace entt {

+ 1 - 1
src/entt/entity/runtime_view.hpp

@@ -8,8 +8,8 @@
 #include <utility>
 #include <algorithm>
 #include "../config/config.h"
-#include "entt_traits.hpp"
 #include "sparse_set.hpp"
+#include "entity.hpp"
 #include "fwd.hpp"
 
 

+ 0 - 1
src/entt/entity/snapshot.hpp

@@ -9,7 +9,6 @@
 #include <type_traits>
 #include <unordered_map>
 #include "../config/config.h"
-#include "entt_traits.hpp"
 #include "entity.hpp"
 #include "fwd.hpp"
 

+ 0 - 1
src/entt/entity/sparse_set.hpp

@@ -12,7 +12,6 @@
 #include <type_traits>
 #include "../config/config.h"
 #include "../core/algorithm.hpp"
-#include "entt_traits.hpp"
 #include "entity.hpp"
 
 

+ 1 - 1
src/entt/entity/view.hpp

@@ -9,8 +9,8 @@
 #include <algorithm>
 #include <type_traits>
 #include "../config/config.h"
-#include "entt_traits.hpp"
 #include "sparse_set.hpp"
+#include "entity.hpp"
 #include "fwd.hpp"
 
 

+ 0 - 1
src/entt/entt.hpp

@@ -7,7 +7,6 @@
 #include "core/utility.hpp"
 #include "entity/actor.hpp"
 #include "entity/entity.hpp"
-#include "entity/entt_traits.hpp"
 #include "entity/group.hpp"
 #include "entity/helper.hpp"
 #include "entity/prototype.hpp"

+ 1 - 1
test/entt/entity/registry.cpp

@@ -6,8 +6,8 @@
 #include <cstdint>
 #include <type_traits>
 #include <gtest/gtest.h>
-#include <entt/entity/entt_traits.hpp>
 #include <entt/entity/registry.hpp>
+#include <entt/entity/entity.hpp>
 
 ENTT_NAMED_TYPE(int)
 

+ 2 - 2
test/entt/signal/dispatcher.cpp

@@ -1,6 +1,6 @@
-#include <memory>
+#include <type_traits>
 #include <gtest/gtest.h>
-#include <entt/entity/entt_traits.hpp>
+#include <entt/core/type_traits.hpp>
 #include <entt/signal/dispatcher.hpp>
 
 struct an_event {};

+ 1 - 1
test/entt/signal/emitter.cpp

@@ -1,5 +1,5 @@
 #include <gtest/gtest.h>
-#include <entt/entity/entt_traits.hpp>
+#include <entt/core/type_traits.hpp>
 #include <entt/signal/emitter.hpp>
 
 struct test_emitter: entt::emitter<test_emitter> {};