OpenLexocad  27.1
entt::basic_snapshot_loader< Entity > Class Template Reference

Utility class to restore a snapshot as a whole. More...

#include <entt.hpp>

Public Member Functions

 basic_snapshot_loader (basic_snapshot_loader &&)=default
 Default move constructor. More...
 
basic_snapshot_loaderoperator= (basic_snapshot_loader &&)=default
 Default move assignment operator. More...
 
template<typename Archive >
const basic_snapshot_loaderentities (Archive &archive) const
 Restores entities that were in use during serialization. More...
 
template<typename Archive >
const basic_snapshot_loaderdestroyed (Archive &archive) const
 Restores entities that were destroyed during serialization. More...
 
template<typename... Component, typename Archive >
const basic_snapshot_loadercomponent (Archive &archive) const
 Restores components and assigns them to the right entities. More...
 
const basic_snapshot_loaderorphans () const
 Destroys those entities that have no components. More...
 

Friends

class basic_registry< Entity >
 A registry is allowed to create snapshot loaders. More...
 

Detailed Description

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

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
EntityA valid entity type (see entt_traits for more details).

Constructor & Destructor Documentation

◆ basic_snapshot_loader()

template<typename Entity >
entt::basic_snapshot_loader< Entity >::basic_snapshot_loader ( basic_snapshot_loader< Entity > &&  )
default

Default move constructor.

Member Function Documentation

◆ component()

template<typename Entity >
template<typename... Component, typename Archive >
const basic_snapshot_loader& entt::basic_snapshot_loader< Entity >::component ( Archive &  archive) const
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 it with the version it originally had.

Template Parameters
ComponentTypes of components to restore.
ArchiveType of input archive.
Parameters
archiveA valid reference to an input archive.
Returns
A valid loader to continue restoring data.

◆ destroyed()

template<typename Entity >
template<typename Archive >
const basic_snapshot_loader& entt::basic_snapshot_loader< Entity >::destroyed ( Archive &  archive) const
inline

Restores entities that were destroyed during serialization.

This function restores the entities that were destroyed during serialization and gives them the versions they originally had.

Template Parameters
ArchiveType of input archive.
Parameters
archiveA valid reference to an input archive.
Returns
A valid loader to continue restoring data.

◆ entities()

template<typename Entity >
template<typename Archive >
const basic_snapshot_loader& entt::basic_snapshot_loader< Entity >::entities ( Archive &  archive) const
inline

Restores entities that were in use during serialization.

This function restores the entities that were in use during serialization and gives them the versions they originally had.

Template Parameters
ArchiveType of input archive.
Parameters
archiveA valid reference to an input archive.
Returns
A valid loader to continue restoring data.

◆ operator=()

template<typename Entity >
basic_snapshot_loader& entt::basic_snapshot_loader< Entity >::operator= ( basic_snapshot_loader< Entity > &&  )
default

Default move assignment operator.

Returns
This loader.

◆ orphans()

template<typename Entity >
const basic_snapshot_loader& entt::basic_snapshot_loader< Entity >::orphans ( ) const
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.

Returns
A valid loader to continue restoring data.

Friends And Related Function Documentation

◆ basic_registry< Entity >

template<typename Entity >
friend class basic_registry< Entity >
friend

A registry is allowed to create snapshot loaders.


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