Policy‐based implementation of ObserverContainerBase.

Synopsis

Declared in <folly/ObserverContainer.h>

template<
    typename ObserverInterface,
    typename Observed,
    typename ContainerPolicy,
    typename StorePolicy = ObserverContainerStorePolicyDefault<>,
    std::size_t MaxConstructorCallbacks = 4>
class ObserverContainer
    : public ObserverContainerBase<ObserverInterface, Observed, ContainerPolicy>

Base Classes

Name

Description

ObserverContainerBase<ObserverInterface, Observed, ContainerPolicy>

Base ObserverContainer and definition of Observers.

Types

Name

Description

ManagedObserver

Helper class for observers that attach to single object / container.

Observer

Observer interface.

ObserverBase

Observer base interface.

ObserverEventSet

EventSet is used to keep track of the observer events that are enabled.

Type Aliases

Name

Description

ContainerBase

Base container type.

ContainerConstructorCallbackList

Constructor callback list type for the observed object.

EventEnum

Enum of events that observers can subscribe to.

EventEnumIntT

Integer type underlying EventEnum.

Observer

Observer type stored in this container.

StoreBase

Base store interface type.

interface_type

Observer interface type.

observed_type

Type of the observed object.

policy_type

Container policy type.

Member Functions

Name

Description

ObserverContainer [constructor]

Constructors

~ObserverContainer [destructor]

Destroy the container, notifying observers that the object is destroyed.

operator=

Assignment operators

addObserver

Adds an observer to the container.

findObservers

Get a list of observers in the container of type T.

getObject

Returns the object associated with the container (e.g., observed object).

getObservers

Get all observers.

hasObserversForEvent

Returns if any observer in the container is subscribed to a given event.

invokeInterfaceMethod

Invokes an observer interface method on observers subscribed to an event.

invokeInterfaceMethodAllObservers

Invokes an observer interface method on all observers.

numObservers

Get number of observers in container.

removeObserver

Removes an observer from the container.

Static Member Functions

Name

Description

addConstructorCallback

Add a callback fired each time obj of the observed type is constructed.

Using Declarations

Protected Member Functions

Name

Description

getStore [virtual]

Return the underlying observer store.

getStoreConst [virtual]

Return the underlying observer store, const overload.

invokeInterfaceMethodImpl

Invoke an interface method on each subscribed observer.

Created with MrDocs