fb-cpp 0.0.1
A modern C++ wrapper for the Firebird database API
Loading...
Searching...
No Matches
fbcpp::EventListener Class Referencefinal

Observes Firebird events and forwards aggregated counts to a callback on a background thread. More...

#include <EventListener.h>

Public Types

using Callback = std::function< void(const std::vector< EventCount > &counts)>
 Function invoked when new event counts are available.
 

Public Member Functions

 EventListener (Attachment &attachment, const std::vector< std::string > &eventNames, Callback callback)
 Creates an event listener for the specified attachment and event names using the provided callback.
 
 ~EventListener () noexcept
 Stops the listener and waits for any background work to finish.
 
 EventListener (const EventListener &)=delete
 
EventListeneroperator= (const EventListener &)=delete
 
 EventListener (EventListener &&)=delete
 
EventListeneroperator= (EventListener &&)=delete
 
bool isListening () noexcept
 Returns true if the listener is currently registered for event notifications.
 
void stop ()
 Cancels event notifications and releases related resources.
 

Detailed Description

Observes Firebird events and forwards aggregated counts to a callback on a background thread.

Definition at line 66 of file EventListener.h.

Member Typedef Documentation

◆ Callback

using fbcpp::EventListener::Callback = std::function<void(const std::vector<EventCount>& counts)>

Function invoked when new event counts are available.

Definition at line 72 of file EventListener.h.

Constructor & Destructor Documentation

◆ EventListener()

EventListener::EventListener ( Attachment attachment,
const std::vector< std::string > &  eventNames,
Callback  callback 
)
explicit

Creates an event listener for the specified attachment and event names using the provided callback.

Definition at line 52 of file EventListener.cpp.

◆ ~EventListener()

fbcpp::EventListener::~EventListener ( )
inlinenoexcept

Stops the listener and waits for any background work to finish.

Definition at line 118 of file EventListener.h.

Member Function Documentation

◆ isListening()

bool EventListener::isListening ( )
noexcept

Returns true if the listener is currently registered for event notifications.

Definition at line 116 of file EventListener.cpp.

◆ stop()

void EventListener::stop ( )

Cancels event notifications and releases related resources.

Definition at line 122 of file EventListener.cpp.


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