Class EventCallbackManager

Class Documentation

class EventCallbackManager

The class used to manage event callbacks registered with a Writer or Reader.

Each implementation of the Writer and Reader interfaces should store one instance of this type. When new callbacks are registered, they should be passed to that instance using add_event_callback. When an event occurs, the callbacks registered for it can be called by calling the execute_callbacks method, passing in the event information.

Public Functions

template<typename EventCallbackT>
inline void add_event_callback(const EventCallbackT &callback, const BagEvent event)

Add an event callback.

Parameters:
  • callback – The callback that should be called for the event.

  • event – The event, one of the values of the BagEvent enumeration.

inline bool has_callback_for_event(const BagEvent event) const

Check if a callback is registered for the given event.

Parameters:

event – The event, one of the values of the BagEvent enumeration.

Returns:

True if a callback is registered for the event, false otherwise.

inline void delete_all_callbacks()

Delete all callbacks.

inline void execute_callbacks(const BagEvent event, BagEventCallbackBase::InfoPtr info)

Execute all callbacks registered for the given event.

The provided information value is passed to each callback by copy.

Parameters:
  • event – The event, one of the values of the BagEvent enumeration.

  • info – The information relevant to the event that has occurred. The type varies by event.