Menu
Lumberyard
C++ API Reference (Version 1.10)

AZ::BusInternal::EBusEventEnumerator< Bus, Traits > Struct Template Reference

Open 3D Engine (O3DE), the successor to Lumberyard, is now available in Developer Preview. Download O3DE or visit the AWS Game Tech blog to learn more.

Provides functionality that requires enumerating over handlers that are connected to an EBus . More...

Inherited by AZ::BusInternal::EBusImpl< Bus, Traits, BusIdType > .

Public Types

using BusIdType
The type of ID that is used to address the EBus . More...
using BusPtr
Pointer to an address on the bus. More...

Static Public Member Functions

template<class Callback >
static void EnumerateHandlers (Callback callback)
Calls a user-defined function on all handlers that are connected to the EBus . More...
template<class Callback >
static void EnumerateHandlersId (const BusIdType &id, Callback callback)
Calls a user-defined function on handlers that are connected to a specific address on the EBus . More...
template<class Callback >
static void EnumerateHandlersPtr (const BusPtr &ptr, Callback callback)
Calls a user-defined function on handlers at a cached address. More...
static Traits::InterfaceType * FindFirstHandler (const BusIdType &id)
Finds the first handler that is connected to a specific address on the EBus . More...
static Traits::InterfaceType * FindFirstHandler (const BusPtr &ptr)
Finds the first handler at a cached address on the EBus . More...
static size_t GetNumOfEventHandlers (const BusIdType &id)
Returns the total number of event handlers that are connected to a specific address on the EBus . More...

Detailed Description

template<class Bus, class Traits>
struct AZ::BusInternal::EBusEventEnumerator< Bus, Traits >

Provides functionality that requires enumerating over handlers that are connected to an EBus .

It can enumerate over all handlers or just the handlers that are connected to a specific address on an EBus .

Template Parameters
Bus The EBus type.
Traits A class that inherits from EBusTraits and configures the EBus . This parameter may be left unspecified if the Interface class inherits from EBusTraits .

Member Typedef Documentation

BusIdType

template<class Bus, class Traits>
using AZ::BusInternal::EBusEventEnumerator < Bus, Traits >:: BusIdType = typename Traits::BusIdType

The type of ID that is used to address the EBus .

Used only when the address policy is AZ::EBusAddressPolicy::ById or AZ::EBusAddressPolicy::ByIdAndOrdered . The type must support AZStd::hash<ID> and bool operator==(const ID&, const ID&) .

BusPtr

template<class Bus, class Traits>
using AZ::BusInternal::EBusEventEnumerator < Bus, Traits >:: BusPtr = typename Traits::BusPtr

Pointer to an address on the bus.

Member Function Documentation

EnumerateHandlers()

template<class Bus , class Traits >
template<class Callback >
void AZ::BusInternal::EBusEventEnumerator < Bus, Traits >::EnumerateHandlers ( Callback callback )
static

Calls a user-defined function on all handlers that are connected to the EBus .

The function signature must be bool callback(InterfaceType* handler) . The function must return true to continue enumerating handlers, or return false to stop.

Parameters
callback Function to call.

EnumerateHandlersId()

template<class Bus , class Traits >
template<class Callback >
void AZ::BusInternal::EBusEventEnumerator < Bus, Traits >::EnumerateHandlersId ( const BusIdType & id ,
Callback callback
)
static

Calls a user-defined function on handlers that are connected to a specific address on the EBus .

The function signature must be bool callback(InterfaceType* handler) . The function must return true to continue enumerating handlers, or return false to stop.

Parameters
id Address ID. Function will be called on handlers that are connected to this ID.
callback Function to call.

EnumerateHandlersPtr()

template<class Bus , class Traits >
template<class Callback >
void AZ::BusInternal::EBusEventEnumerator < Bus, Traits >::EnumerateHandlersPtr ( const BusPtr & ptr ,
Callback callback
)
static

Calls a user-defined function on handlers at a cached address.

The function signature must be bool callback(InterfaceType* handler) . The function must return true to continue enumerating handlers, or return false to stop.

Parameters
ptr Cached address ID. Handlers that are connected to this ID will receive the event.
callback Function to call.

FindFirstHandler() [1/2]

template<class Bus , class Traits >
Traits::InterfaceType * AZ::BusInternal::EBusEventEnumerator < Bus, Traits >::FindFirstHandler ( const BusIdType & id )
static

Finds the first handler that is connected to a specific address on the EBus .

This function is only for special cases where you know that a particular component's handler is guaranteed to exist. Even if the returned pointer is valid (not null), it might point to a handler that was deleted. Prefer dispatching events using EBusEventer .

Parameters
id Address ID.
Returns
A pointer to the first handler on the EBus , even if the handler was deleted.

FindFirstHandler() [2/2]

template<class Bus , class Traits >
Traits::InterfaceType * AZ::BusInternal::EBusEventEnumerator < Bus, Traits >::FindFirstHandler ( const BusPtr & ptr )
static

Finds the first handler at a cached address on the EBus .

This function is only for special cases where you know that a particular component's handler is guaranteed to exist. Even if the returned pointer is valid (not null), it might point to a handler that was deleted. Prefer dispatching events using EBusEventer .

Parameters
ptr Cached address ID.
Returns
A pointer to the first handler on the specified EBus address, even if the handler was deleted.

GetNumOfEventHandlers()

template<class Bus , class Traits >
size_t AZ::BusInternal::EBusEventEnumerator < Bus, Traits >::GetNumOfEventHandlers ( const BusIdType & id )
static

Returns the total number of event handlers that are connected to a specific address on the EBus .

Parameters
id Address ID.
Returns
The total number of handlers that are connected to the EBus address.

The documentation for this struct was generated from the following file:
  • C:/lumberyard-root/dev/Code/Framework/AzCore/AzCore/EBus/ BusImpl.h