FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
fge::ObjectContainerHashMap Class Reference

A hash map to have direct access to an Object in a Scene. More...

#include <C_scene.hpp>

Public Types

using Map = std::unordered_map<ObjectSid, ObjectContainer::iterator>
 

Public Member Functions

 ObjectContainerHashMap (ObjectContainer &objects)
 
 ObjectContainerHashMap (ObjectContainerHashMap const &r)=delete
 
 ObjectContainerHashMap (ObjectContainerHashMap &&r) noexcept=default
 
ObjectContainerHashMapoperator= (ObjectContainerHashMap const &r)=delete
 
ObjectContainerHashMapoperator= (ObjectContainerHashMap &&r) noexcept=default
 
void clear ()
 
void reMap (ObjectContainer &objects)
 
bool newSid (ObjectSid oldSid, ObjectSid newSid)
 Announce a new SID for an Object.
 
bool newObject (ObjectSid sid, ObjectContainer::iterator it)
 Announce a new Object in the hash map.
 
void delObject (ObjectSid sid)
 Announce the deletion of an Object.
 
std::optional< ObjectContainer::iterator > find (ObjectSid sid)
 
std::optional< ObjectContainer::const_iterator > find (ObjectSid sid) const
 
fge::ObjectContainer::value_type retrieve (ObjectSid sid) const
 
bool contains (ObjectSid sid) const
 
std::size_t size () const
 

Detailed Description

A hash map to have direct access to an Object in a Scene.

Member Function Documentation

◆ delObject()

void fge::ObjectContainerHashMap::delObject ( ObjectSid sid)

Announce the deletion of an Object.

Parameters
sidThe SID of the Object

◆ newObject()

bool fge::ObjectContainerHashMap::newObject ( ObjectSid sid,
ObjectContainer::iterator it )
nodiscard

Announce a new Object in the hash map.

If return false, the Scene will call the reMap method as something went wrong.

Parameters
sidThe SID of the Object
itA valid iterator of the Object from the ObjectContainer
Returns
true if the Object is added, false otherwise

◆ newSid()

bool fge::ObjectContainerHashMap::newSid ( ObjectSid oldSid,
ObjectSid newSid )
nodiscard

Announce a new SID for an Object.

If return false, the Scene will call the reMap method as something went wrong.

Parameters
oldSidThe old SID of the Object
newSidThe new SID of the Object
Returns
true if the SID is changed, false otherwise

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