EnTT 3.14.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
entt::basic_continuous_loader< Registry > Class Template Reference

Utility class for continuous loading. More...

#include <snapshot.hpp>

Public Types

using registry_type = Registry
 
using entity_type = typename registry_type::entity_type
 Underlying entity identifier.
 

Public Member Functions

 basic_continuous_loader (registry_type &source) noexcept
 Constructs an instance that is bound to a given registry.
 
 basic_continuous_loader (const basic_continuous_loader &)=delete
 Default copy constructor, deleted on purpose.
 
 basic_continuous_loader (basic_continuous_loader &&) noexcept=default
 Default move constructor.
 
 ~basic_continuous_loader ()=default
 Default destructor.
 
basic_continuous_loaderoperator= (const basic_continuous_loader &)=delete
 Default copy assignment operator, deleted on purpose.
 
basic_continuous_loaderoperator= (basic_continuous_loader &&) noexcept=default
 Default move assignment operator.
 
template<typename Type , typename Archive >
basic_continuous_loaderget (Archive &archive, const id_type id=type_hash< Type >::value())
 Restores all elements of a type with associated identifiers.
 
basic_continuous_loaderorphans ()
 Destroys those entities that have no elements.
 
bool contains (entity_type entt) const noexcept
 Tests if a loader knows about a given entity.
 
entity_type map (entity_type entt) const noexcept
 Returns the identifier to which an entity refers.
 

Detailed Description

template<typename Registry>
class entt::basic_continuous_loader< Registry >

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 accommodate 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 application with the requirement of transferring somehow parts of the representation side to side.

Template Parameters
RegistryBasic registry type.

Definition at line 303 of file snapshot.hpp.

Member Typedef Documentation

◆ entity_type

template<typename Registry >
using entt::basic_continuous_loader< Registry >::entity_type = typename registry_type::entity_type

Underlying entity identifier.

Definition at line 366 of file snapshot.hpp.

◆ registry_type

Basic registry type.

Definition at line 364 of file snapshot.hpp.

Constructor & Destructor Documentation

◆ basic_continuous_loader()

template<typename Registry >
entt::basic_continuous_loader< Registry >::basic_continuous_loader ( registry_type & source)
inlinenoexcept

Constructs an instance that is bound to a given registry.

Parameters
sourceA valid reference to a registry.

Definition at line 372 of file snapshot.hpp.

Member Function Documentation

◆ contains()

template<typename Registry >
bool entt::basic_continuous_loader< Registry >::contains ( entity_type entt) const
inlinenoexcept

Tests if a loader knows about a given entity.

Parameters
enttA valid identifier.
Returns
True if entity is managed by the loader, false otherwise.

Definition at line 484 of file snapshot.hpp.

◆ get()

template<typename Registry >
template<typename Type , typename Archive >
basic_continuous_loader & entt::basic_continuous_loader< Registry >::get ( Archive & archive,
const id_type id = type_hash<Type>::value() )
inline

Restores all elements of a type with associated identifiers.

It creates local counterparts for remote elements as needed.
Members are either data members of type entity_type or containers of entities. In both cases, a loader visits them and replaces entities with their local counterpart.

Template Parameters
TypeType of elements to restore.
ArchiveType of input archive.
Parameters
archiveA valid reference to an input archive.
idOptional name used to map the storage within the registry.
Returns
A valid loader to continue restoring data.

Definition at line 412 of file snapshot.hpp.

◆ map()

template<typename Registry >
entity_type entt::basic_continuous_loader< Registry >::map ( entity_type entt) const
inlinenoexcept

Returns the identifier to which an entity refers.

Parameters
enttA valid identifier.
Returns
The local identifier if any, the null entity otherwise.

Definition at line 494 of file snapshot.hpp.

◆ operator=() [1/2]

Default move assignment operator.

Returns
This loader.

◆ operator=() [2/2]

Default copy assignment operator, deleted on purpose.

Returns
This loader.

◆ orphans()

Destroys those entities that have no elements.

In case all the entities were serialized but only part of the elements was saved, it could happen that some of the entities have no elements once restored.
This function helps to identify and destroy those entities.

Returns
A non-const reference to this loader.

Definition at line 474 of file snapshot.hpp.


The documentation for this class was generated from the following files: