Open 3D Engine Multiplayer Gem API Reference  24.09
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
Multiplayer::ConstNetworkEntityHandle Class Reference

This class provides a wrapping around handle ids. It is optimized to avoid using the hashmap lookup unless the hashmap has had an item removed. More...

#include <NetworkEntityHandle.h>

Inherited by Multiplayer::NetworkEntityHandle.

Public Member Functions

 ConstNetworkEntityHandle ()=default
 Constructs a nullptr handle.
 
 ConstNetworkEntityHandle (AZ::Entity *entity, const NetworkEntityTracker *entityTracker=nullptr)
 
 ConstNetworkEntityHandle (const ConstNetworkEntityHandle &)=default
 
bool operator< (const ConstNetworkEntityHandle &rhs) const
 
 operator bool () const
 
void Reset ()
 Resets the handle to a nullptr state.
 
void Reset (const ConstNetworkEntityHandle &handle)
 
NetEntityId GetNetEntityId () const
 
NetBindComponentGetNetBindComponent () const
 
const AZ::Component * FindComponent (const AZ::TypeId &typeId) const
 
template<typename Component >
const Component * FindComponent () const
 
template<class ComponentType >
const ComponentType * FindComponent () const
 
bool Exists () const
 
AZ::Entity * GetEntity ()
 
const AZ::Entity * GetEntity () const
 

Static Public Member Functions

static bool Compare (const ConstNetworkEntityHandle &lhs, const ConstNetworkEntityHandle &rhs)
 Helper function for sorting EntityHandles by netEntityId.
 

Protected Attributes

uint32_t m_changeDirty = 0
 
AZ::Entity * m_entity = nullptr
 
NetBindComponentm_netBindComponent = nullptr
 
const NetworkEntityTrackerm_networkEntityTracker = nullptr
 
NetEntityId m_netEntityId = InvalidNetEntityId
 
bool operator== (const ConstNetworkEntityHandle &rhs) const
 
bool operator!= (const ConstNetworkEntityHandle &rhs) const
 
bool operator== (const ConstNetworkEntityHandle &lhs, AZStd::nullptr_t)
 
bool operator== (AZStd::nullptr_t, const ConstNetworkEntityHandle &rhs)
 
bool operator!= (const ConstNetworkEntityHandle &lhs, AZStd::nullptr_t)
 
bool operator!= (AZStd::nullptr_t, const ConstNetworkEntityHandle &rhs)
 
bool operator== (const ConstNetworkEntityHandle &lhs, const AZ::Entity *rhs)
 
bool operator== (const AZ::Entity *lhs, const ConstNetworkEntityHandle &rhs)
 
bool operator!= (const ConstNetworkEntityHandle &lhs, const AZ::Entity *rhs)
 
bool operator!= (const AZ::Entity *lhs, const ConstNetworkEntityHandle &rhs)
 

Detailed Description

This class provides a wrapping around handle ids. It is optimized to avoid using the hashmap lookup unless the hashmap has had an item removed.

Constructor & Destructor Documentation

◆ ConstNetworkEntityHandle()

Multiplayer::ConstNetworkEntityHandle::ConstNetworkEntityHandle ( AZ::Entity *  entity,
const NetworkEntityTracker entityTracker = nullptr 
)

Constructs a ConstNetworkEntityHandle given an entity, an entity tracker

Parameters
entitypointer to the entity to construct a ConstNetworkEntityHandle for
entityTrackerpointer to the entity tracker that tracks the entity can optionally be null in which case the entity tracker will be looked up

Member Function Documentation

◆ Exists()

bool Multiplayer::ConstNetworkEntityHandle::Exists ( ) const

Access the AZ::Entity if it safely exists, nullptr or false is returned if the entity does not exist.

◆ FindComponent() [1/2]

template<typename Component >
const Component* Multiplayer::ConstNetworkEntityHandle::FindComponent ( ) const

Returns a specific component on of entity by class type.

Returns
pointer to the requested component, or nullptr if it doesn't exist on the entity

◆ FindComponent() [2/2]

const AZ::Component* Multiplayer::ConstNetworkEntityHandle::FindComponent ( const AZ::TypeId &  typeId) const

Returns a specific component on of entity given a typeId.

Parameters
typeIdthe typeId of the component to find and return
Returns
pointer to the requested component, or nullptr if it doesn't exist on the entity

◆ GetNetBindComponent()

NetBindComponent* Multiplayer::ConstNetworkEntityHandle::GetNetBindComponent ( ) const

Returns the cached netBindComponent for this entity, or nullptr if it doesn't exist.

Returns
the cached netBindComponent for this entity, or nullptr if it doesn't exist

◆ GetNetEntityId()

NetEntityId Multiplayer::ConstNetworkEntityHandle::GetNetEntityId ( ) const
inline

Returns the networkEntityId of the entity this handle points to.

Returns
the networkEntityId of the entity this handle points to

◆ operator==()

bool Multiplayer::ConstNetworkEntityHandle::operator== ( const ConstNetworkEntityHandle rhs) const

Operators providing pointer semantics.


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