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

Utility class to restore a snapshot as a whole. 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_snapshot_loader (registry_type &source) noexcept
 Constructs an instance that is bound to a given registry.
 
 basic_snapshot_loader (basic_snapshot_loader &&) noexcept=default
 Default move constructor.
 
basic_snapshot_loaderoperator= (basic_snapshot_loader &&) noexcept=default
 Default move assignment operator.
 
template<typename Type , typename Archive >
basic_snapshot_loaderget (Archive &archive, const id_type id=type_hash< Type >::value())
 Restores all elements of a type with associated identifiers.
 
basic_snapshot_loaderorphans ()
 Destroys those entities that have no components.
 

Detailed Description

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

Utility class to restore a snapshot as a whole.

A snapshot loader requires that the destination registry be empty and loads all the data at once while keeping intact the identifiers that the entities originally had.
An example of use is the implementation of a save/restore utility.

Template Parameters
RegistryBasic registry type.

Definition at line 150 of file snapshot.hpp.

Member Typedef Documentation

◆ entity_type

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

Underlying entity identifier.

Definition at line 158 of file snapshot.hpp.

◆ registry_type

template<typename Registry >
using entt::basic_snapshot_loader< Registry >::registry_type = Registry

Basic registry type.

Definition at line 156 of file snapshot.hpp.

Constructor & Destructor Documentation

◆ basic_snapshot_loader()

template<typename Registry >
entt::basic_snapshot_loader< Registry >::basic_snapshot_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 164 of file snapshot.hpp.

Member Function Documentation

◆ get()

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

Restores all elements of a type with associated identifiers.

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 185 of file snapshot.hpp.

◆ operator=()

template<typename Registry >
basic_snapshot_loader & entt::basic_snapshot_loader< Registry >::operator= ( basic_snapshot_loader< Registry > &&  )
defaultnoexcept

Default move assignment operator.

Returns
This loader.

◆ orphans()

template<typename Registry >
basic_snapshot_loader & entt::basic_snapshot_loader< Registry >::orphans ( )
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 function helps to identify and destroy those entities.

Returns
A valid loader to continue restoring data.

Definition at line 236 of file snapshot.hpp.


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