Ignition Physics

API Reference

5.1.0
EntityPtr< EntityT > Class Template Reference

#include <Entity.hh>

Public Member Functions

 EntityPtr ()=default
 
 EntityPtr (EntityPtr &&)=default
 
 EntityPtr (const EntityPtr &)
 
 EntityPtr (std::nullptr_t)
 Create an EntityPtr that points to an invalid Entity. More...
 
 EntityPtr (std::nullopt_t)
 Create an EntityPtr that points to an invalid Entity. More...
 
template<typename Pimpl >
 EntityPtr (const std::shared_ptr< Pimpl > &_pimpl, const Identity &_identity)
 Create an EntityPtr that points to the Entity tied to _identity. More...
 
template<typename OtherEntityT >
 EntityPtr (const EntityPtr< OtherEntityT > &_other)
 Create a new reference to another entity. More...
 
 ~EntityPtr ()=default
 
std::size_t Hash () const
 Produces a hash for the Entity that this EntityPtr is referring to. This function allows EntityPtr instances to be used as values in a std::unordered_set or keys in a std::unordered_map. Using this function directly should not normally be necessary. More...
 
 operator bool () const
 Implicitly cast this EntityPtr to a boolean. More...
 
template<typename OtherEntityT >
bool operator!= (const EntityPtr< OtherEntityT > &_other) const
 Comparison operator. More...
 
EntityT & operator* () const
 Dereference operator. Access a reference to the Entity being pointed to. This does NOT check whether the Entity is valid before trying to provide it. If the validity of the Entity is in doubt, check IsEmpty() or simply operator bool() before attempting to use this operator. More...
 
EntityT * operator-> () const
 Drill operator. Access members of the Entity being pointed to. This does NOT check whether the Entity is valid before trying to use it. If the validity of the Entity is in doubt, check Valid() or simply operator bool() before attempting to use this operator. More...
 
template<typename OtherEntityT >
bool operator< (const EntityPtr< OtherEntityT > &_other) const
 Comparison operator. More...
 
template<typename OtherEntityT >
bool operator<= (const EntityPtr< OtherEntityT > &_other) const
 Comparison operator. More...
 
EntityPtroperator= (EntityPtr &&)=default
 
EntityPtroperator= (const EntityPtr &)
 
EntityPtroperator= (std::nullptr_t)
 Assign this to point to an invalid Entity. More...
 
EntityPtroperator= (std::nullopt_t)
 Assign this to point to an invalid Entity. More...
 
template<typename OtherEntityT >
EntityPtroperator= (const EntityPtr< OtherEntityT > &_other)
 Assign this to point at another compatible Entity. More...
 
template<typename OtherEntityT >
bool operator== (const EntityPtr< OtherEntityT > &_other) const
 Comparison operator. More...
 
template<typename OtherEntityT >
bool operator> (const EntityPtr< OtherEntityT > &_other) const
 Comparison operator. More...
 
template<typename OtherEntityT >
bool operator>= (const EntityPtr< OtherEntityT > &_other) const
 Comparison operator. More...
 
bool Valid () const
 Check whether this is pointing at a valid Entity. More...
 

Constructor & Destructor Documentation

◆ EntityPtr() [1/7]

EntityPtr ( )
default

◆ EntityPtr() [2/7]

EntityPtr ( EntityPtr< EntityT > &&  )
default

◆ ~EntityPtr()

~EntityPtr ( )
default

◆ EntityPtr() [3/7]

EntityPtr ( const EntityPtr< EntityT > &  )

◆ EntityPtr() [4/7]

Create an EntityPtr that points to an invalid Entity.

◆ EntityPtr() [5/7]

EntityPtr ( std::nullopt_t  )

Create an EntityPtr that points to an invalid Entity.

◆ EntityPtr() [6/7]

EntityPtr ( const std::shared_ptr< Pimpl > &  _pimpl,
const Identity &  _identity 
)

Create an EntityPtr that points to the Entity tied to _identity.

Parameters
[in]_pimplPointer to the implementation for this entity
[in]_identityThe identity of the Entity that this should point to

◆ EntityPtr() [7/7]

EntityPtr ( const EntityPtr< OtherEntityT > &  _other)

Create a new reference to another entity.

Parameters
[in]_otherAnother entity reference with a compatible type and compatible set of features

Member Function Documentation

◆ Hash()

std::size_t Hash ( ) const

Produces a hash for the Entity that this EntityPtr is referring to. This function allows EntityPtr instances to be used as values in a std::unordered_set or keys in a std::unordered_map. Using this function directly should not normally be necessary.

Returns
A hash of the underlying Entity.

◆ operator bool()

operator bool ( ) const

Implicitly cast this EntityPtr to a boolean.

Returns
True if this is pointing to a valid Entity, otherwise false.

◆ operator!=()

bool operator!= ( const EntityPtr< OtherEntityT > &  _other) const

Comparison operator.

Parameters
[in]_otherEntity to compare to.
Remarks
Entities are uniquely identified by their underlying ID which is assigned by the physics engine. This may produce unintuitive results depending on how the physics engine organizes its Entities.
Returns
True if the ID of this Entity is not equal to the ID of _other, otherwise returns false.

◆ operator*()

EntityT& operator* ( ) const

Dereference operator. Access a reference to the Entity being pointed to. This does NOT check whether the Entity is valid before trying to provide it. If the validity of the Entity is in doubt, check IsEmpty() or simply operator bool() before attempting to use this operator.

Returns
A reference to the underlying entity

◆ operator->()

EntityT* operator-> ( ) const

Drill operator. Access members of the Entity being pointed to. This does NOT check whether the Entity is valid before trying to use it. If the validity of the Entity is in doubt, check Valid() or simply operator bool() before attempting to use this operator.

Returns
The ability to call a member function on the underlying Entity

◆ operator<()

bool operator< ( const EntityPtr< OtherEntityT > &  _other) const

Comparison operator.

Parameters
[in]_otherEntity to compare to.
Remarks
Entities are uniquely identified by their underlying ID which is assigned by the physics engine. This may produce unintuitive results depending on how the physics engine organizes its Entities.
Returns
True if the ID of this Entity is less than the ID of _other, otherwise returns false.

◆ operator<=()

bool operator<= ( const EntityPtr< OtherEntityT > &  _other) const

Comparison operator.

Parameters
[in]_otherEntity to compare to.
Remarks
Entities are uniquely identified by their underlying ID which is assigned by the physics engine. This may produce unintuitive results depending on how the physics engine organizes its Entities.
Returns
True if the ID of this Entity is less than or equal to the ID of _other, otherwise returns false.

◆ operator=() [1/5]

EntityPtr& operator= ( EntityPtr< EntityT > &&  )
default

◆ operator=() [2/5]

EntityPtr& operator= ( const EntityPtr< EntityT > &  )

◆ operator=() [3/5]

EntityPtr& operator= ( std::nullptr_t  )

Assign this to point to an invalid Entity.

◆ operator=() [4/5]

EntityPtr& operator= ( std::nullopt_t  )

Assign this to point to an invalid Entity.

◆ operator=() [5/5]

EntityPtr& operator= ( const EntityPtr< OtherEntityT > &  _other)

Assign this to point at another compatible Entity.

Parameters
[in]_otherAnother entity reference with a compatible type and compatible set of features.

◆ operator==()

bool operator== ( const EntityPtr< OtherEntityT > &  _other) const

Comparison operator.

Parameters
[in]_otherEntity to compare to.
Remarks
Entities are uniquely identified by their underlying ID which is assigned by the physics engine. This may produce unintuitive results depending on how the physics engine organizes its Entities.
Returns
True if the ID of this Entity is equal to the ID of _other, otherwise returns false.

◆ operator>()

bool operator> ( const EntityPtr< OtherEntityT > &  _other) const

Comparison operator.

Parameters
[in]_otherEntity to compare to.
Remarks
Entities are uniquely identified by their underlying ID which is assigned by the physics engine. This may produce unintuitive results depending on how the physics engine organizes its Entities.
Returns
True if the ID of this Entity is greater than the ID of _other, otherwise returns false.

◆ operator>=()

bool operator>= ( const EntityPtr< OtherEntityT > &  _other) const

Comparison operator.

Parameters
[in]_otherEntity to compare to.
Remarks
Entities are uniquely identified by their underlying ID which is assigned by the physics engine. This may produce unintuitive results depending on how the physics engine organizes its Entities.
Returns
True if the ID of this Entity is greater than or equal to the ID of _other, otherwise returns false.

◆ Valid()

bool Valid ( ) const

Check whether this is pointing at a valid Entity.

Returns
True if this is pointing to a valid Entity, otherwise false.

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