EnTT  3.6.0
Public Types | Public Member Functions | List of all members
entt::basic_snapshot< Entity > Class Template Reference

Utility class to create snapshots from a registry. More...

#include <snapshot.hpp>

Public Types

using entity_type = Entity
 Underlying entity identifier.
 

Public Member Functions

 basic_snapshot (const basic_registry< entity_type > &source) noexcept
 Constructs an instance that is bound to a given registry. More...
 
 basic_snapshot (basic_snapshot &&)=default
 Default move constructor.
 
basic_snapshotoperator= (basic_snapshot &&)=default
 Default move assignment operator. More...
 
template<typename Archive >
const basic_snapshotentities (Archive &archive) const
 Puts aside all the entities from the underlying registry. More...
 
template<typename... Component, typename Archive >
const basic_snapshotcomponent (Archive &archive) const
 Puts aside the given components. More...
 
template<typename... Component, typename Archive , typename It >
const basic_snapshotcomponent (Archive &archive, It first, It last) const
 Puts aside the given components for the entities in a range. More...
 

Detailed Description

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

Utility class to create snapshots from a registry.

A snapshot can be either a dump of the entire registry or a narrower selection of components of interest.
This type can be used in both cases if provided with a correctly configured output archive.

Template Parameters
EntityA valid entity type (see entt_traits for more details).

Definition at line 34 of file snapshot.hpp.

Constructor & Destructor Documentation

◆ basic_snapshot()

template<typename Entity >
entt::basic_snapshot< Entity >::basic_snapshot ( const basic_registry< entity_type > &  source)
inlinenoexcept

Constructs an instance that is bound to a given registry.

Parameters
sourceA valid reference to a registry.

Definition at line 72 of file snapshot.hpp.

Member Function Documentation

◆ component() [1/2]

template<typename Entity >
template<typename... Component, typename Archive >
const basic_snapshot& entt::basic_snapshot< Entity >::component ( Archive &  archive) const
inline

Puts aside the given components.

Each instance is serialized together with the entity to which it belongs. Entities are serialized along with their versions.

Template Parameters
ComponentTypes of components to serialize.
ArchiveType of output archive.
Parameters
archiveA valid reference to an output archive.
Returns
An object of this type to continue creating the snapshot.

Definition at line 119 of file snapshot.hpp.

◆ component() [2/2]

template<typename Entity >
template<typename... Component, typename Archive , typename It >
const basic_snapshot& entt::basic_snapshot< Entity >::component ( Archive &  archive,
It  first,
It  last 
) const
inline

Puts aside the given components for the entities in a range.

Each instance is serialized together with the entity to which it belongs. Entities are serialized along with their versions.

Template Parameters
ComponentTypes of components to serialize.
ArchiveType of output archive.
ItType of input iterator.
Parameters
archiveA valid reference to an output archive.
firstAn iterator to the first element of the range to serialize.
lastAn iterator past the last element of the range to serialize.
Returns
An object of this type to continue creating the snapshot.

Definition at line 139 of file snapshot.hpp.

◆ entities()

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

Puts aside all the entities from the underlying registry.

Entities are serialized along with their versions. Destroyed entities are taken in consideration as well by this function.

Template Parameters
ArchiveType of output archive.
Parameters
archiveA valid reference to an output archive.
Returns
An object of this type to continue creating the snapshot.

Definition at line 93 of file snapshot.hpp.

◆ operator=()

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

Default move assignment operator.

Returns
This snapshot.

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