OpenLexocad
27.0
|
Utility class for continuous loading. More...
#include <entt.hpp>
Public Types | |
using | entity_type = Entity |
Underlying entity identifier. More... | |
Public Member Functions | |
basic_continuous_loader (basic_registry< entity_type > &source) ENTT_NOEXCEPT | |
Constructs a loader that is bound to a given registry. More... | |
basic_continuous_loader (basic_continuous_loader &&)=default | |
Default move constructor. More... | |
basic_continuous_loader & | operator= (basic_continuous_loader &&)=default |
Default move assignment operator. More... | |
template<typename Archive > | |
basic_continuous_loader & | entities (Archive &archive) |
Restores entities that were in use during serialization. More... | |
template<typename Archive > | |
basic_continuous_loader & | destroyed (Archive &archive) |
Restores entities that were destroyed during serialization. More... | |
template<typename... Component, typename Archive , typename... Type, typename... Member> | |
basic_continuous_loader & | component (Archive &archive, Member Type::*... member) |
Restores components and assigns them to the right entities. More... | |
basic_continuous_loader & | shrink () |
Helps to purge entities that no longer have a conterpart. More... | |
basic_continuous_loader & | orphans () |
Destroys those entities that have no components. More... | |
bool | has (entity_type entt) const ENTT_NOEXCEPT |
Tests if a loader knows about a given entity. More... | |
entity_type | map (entity_type entt) const ENTT_NOEXCEPT |
Returns the identifier to which an entity refers. More... | |
Utility class for continuous loading.
A continuous loader is designed to load data from a source registry to a (possibly) non-empty destination. The loader can accomodate in a registry more than one snapshot in a sort of continuous loading that updates the destination one step at a time.
Identifiers that entities originally had are not transferred to the target. Instead, the loader maps remote identifiers to local ones while restoring a snapshot.
An example of use is the implementation of a client-server applications with the requirement of transferring somehow parts of the representation side to side.
Entity | A valid entity type (see entt_traits for more details). |
using entt::basic_continuous_loader< Entity >::entity_type = Entity |
Underlying entity identifier.
|
inline |
Constructs a loader that is bound to a given registry.
source | A valid reference to a registry. |
|
default |
Default move constructor.
|
inline |
Restores components and assigns them to the right entities.
The template parameter list must be exactly the same used during serialization. In the event that the entity to which the component is assigned doesn't exist yet, the loader will take care to create a local counterpart for it.
Members can be either data members of type entity_type or containers of entities. In both cases, the loader will visit them and update the entities by replacing each one with its local counterpart.
Component | Type of component to restore. |
Archive | Type of input archive. |
Type | Types of components to update with local counterparts. |
Member | Types of members to update with their local counterparts. |
archive | A valid reference to an input archive. |
member | Members to update with their local counterparts. |
|
inline |
Restores entities that were destroyed during serialization.
This function restores the entities that were destroyed during serialization and creates local counterparts for them if required.
Archive | Type of input archive. |
archive | A valid reference to an input archive. |
|
inline |
Restores entities that were in use during serialization.
This function restores the entities that were in use during serialization and creates local counterparts for them if required.
Archive | Type of input archive. |
archive | A valid reference to an input archive. |
|
inline |
Tests if a loader knows about a given entity.
entt | An entity identifier. |
entity
is managed by the loader, false otherwise.
|
inline |
Returns the identifier to which an entity refers.
entt | An entity identifier. |
|
default |
Default move assignment operator.
|
inline |
Destroys those entities that have no components.
In case all the entities were serialized but only part of the components was saved, it could happen that some of the entities have no components once restored.
This functions helps to identify and destroy those entities.
|
inline |
Helps to purge entities that no longer have a conterpart.
Users should invoke this member function after restoring each snapshot, unless they know exactly what they are doing.