Class component_handle

Class Documentation

class legion::core::ecs::component_handle

Handle to components that allow safe component loading and storing.

Template Parameters
  • component_type: Type of targeted component.

Public Functions

inline component_handle()
inline component_handle(const component_handle &other)
inline component_handle(component_handle &&other)
inline component_handle(id_type entityId)

Creates component handle for the given entity.

inline component_handle &operator=(const component_handle &other)
inline component_handle &operator=(component_handle &&other)
inline bool operator==(const component_handle<component_type> &other) const
inline component_type read() const

Thread-safe read of component.

Return

component_type Current value of component.

Parameters
  • order: Memory order at which to load the component.

inline component_type write(component_type &&value)

Thread-safe write of component.

Return

component_type Current value of component.

Parameters
  • value: Value you wish to write.

inline component_type write(const component_type &value)

Thread-safe write of component.

Return

component_type Current value of component.

Parameters
  • value: Value you wish to write.

template<typename Func>
inline component_type read_modify_write(Func &&modifier)

Thread-safe read modify write with a custom modification on component.

Return

component_type Current value of component.

Parameters
  • value: Value you wish to add.

template<typename Func>
inline component_type read_modify_write(const Func &modifier)
inline component_type fetch_add(component_type &&value)

Thread-safe read modify write with add modification on component.

Return

component_type Current value of component.

Parameters
  • value: Value you wish to add.

inline component_type fetch_add(const component_type &value)

Thread-safe read modify write with add modification on component.

Return

component_type Current value of component.

Parameters
  • value: Value you wish to add.

inline component_type fetch_multiply(component_type &&value)

Thread-safe read modify write with multiply modification on component.

Return

component_type Current value of component.

Parameters
  • value: Value you wish to multiply by.

inline component_type fetch_multiply(const component_type &value)

Thread-safe read modify write with multiply modification on component.

Return

component_type Current value of component.

Parameters
  • value: Value you wish to multiply by.

inline void destroy()

Locks component family and destroys component. legion::core::ecs::component_pool::destroy_component.

inline virtual bool valid() const override

Checks if handle still points to a valid component.

Friends

friend class std::hash< component_handle< component_type > >