Template Class EntityCollection

Inheritance Relationships

Base Type

  • public std::unordered_map< const EntityKeyType *, CollectionEntry< EntityValueType > >

Class Documentation

template<typename EntityKeyType, typename EntityValueType>
class EntityCollection : public std::unordered_map<const EntityKeyType*, CollectionEntry<EntityValueType>>

A collection of entities, indexed by their corresponding handles.

Public Types

using Key = const EntityKeyType*

Key type of the map.

using EntityWeakPtr = typename EntityValueType::WeakPtr

Weak pointer to entity type.

using EntitySharedPtr = typename EntityValueType::SharedPtr

Shared pointer to entity type.

Public Functions

inline void update(const EntityCollection<EntityKeyType, EntityValueType> &other, std::function<void(const EntitySharedPtr&)> on_added, std::function<void(const EntitySharedPtr&)> on_removed)

Update this collection based on the contents of another collection.

Update the internal state of this collection, firing callbacks when entities have been added or removed.

Parameters:
  • other[in] Collection to compare to

  • on_added[in] Callback for when entities have been added

  • on_removed[in] Callback for when entities have been removed