CernVM-FS
2.12.0
|
#include <concurrency.h>
Public Types | |
typedef Callbackable< ParamT > ::CallbackTN * | CallbackPtr |
Public Types inherited from Callbackable< ParamT > | |
typedef CallbackBase< ParamT > | CallbackTN |
Public Member Functions | |
virtual | ~Observable () |
template<class DelegateT , class ClosureDataT > | |
CallbackPtr | RegisterListener (typename BoundClosure< ParamT, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, ClosureDataT data) |
template<class DelegateT > | |
CallbackPtr | RegisterListener (typename BoundCallback< ParamT, DelegateT >::CallbackMethod method, DelegateT *delegate) |
CallbackPtr | RegisterListener (typename Callback< ParamT >::CallbackFunction fn) |
void | UnregisterListener (CallbackPtr callback_object) |
void | UnregisterListeners () |
template<class DelegateT , class ClosureDataT > | |
Observable< ParamT >::CallbackPtr | RegisterListener (typename BoundClosure< ParamT, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, ClosureDataT data) |
template<class DelegateT > | |
Observable< ParamT >::CallbackPtr | RegisterListener (typename BoundCallback< ParamT, DelegateT >::CallbackMethod method, DelegateT *delegate) |
template<typename ParamT> | |
void | RegisterListener (Observable< ParamT >::CallbackPtr callback_object) |
Protected Types | |
typedef std::set< CallbackPtr > | Callbacks |
Protected Member Functions | |
Observable () | |
void | RegisterListener (CallbackPtr callback_object) |
void | NotifyListeners (const ParamT ¶meter) |
Private Attributes | |
Callbacks | listeners_ |
pthread_rwlock_t | listeners_rw_lock_ |
Additional Inherited Members | |
Static Public Member Functions inherited from Callbackable< ParamT > | |
template<class DelegateT , typename ClosureDataT > | |
static CallbackTN * | MakeClosure (typename BoundClosure< ParamT, DelegateT, ClosureDataT >::CallbackMethod method, DelegateT *delegate, const ClosureDataT &closure_data) |
template<class DelegateT > | |
static CallbackTN * | MakeCallback (typename BoundCallback< ParamT, DelegateT >::CallbackMethod method, DelegateT *delegate) |
static CallbackTN * | MakeCallback (typename Callback< ParamT >::CallbackFunction function) |
Private Member Functions inherited from SingleCopy | |
SingleCopy () | |
This is a base class for classes that need to expose a callback interface for asynchronous callback methods. One can register an arbitrary number of observers on an Observable that get notified when the method NotifyListeners() is invoked.
Note: the registration and invocation of callbacks in Observable is thread- safe, but be aware that the callbacks of observing classes might run in arbitrary threads. When using these classes, you should take extra care for thread-safety.
Note: The RegisterListener() methods return a pointer to a CallbackBase. You MUST NOT free these objects, they are managed by the Observable class. Use them only as handles to unregister specific callbacks.
ParamT | the type of the parameter that is passed to every callback invocation. |
Definition at line 147 of file concurrency.h.
typedef Callbackable<ParamT>::CallbackTN* Observable< ParamT >::CallbackPtr |
Definition at line 172 of file concurrency.h.
|
protected |
Definition at line 174 of file concurrency.h.
|
virtual |
Definition at line 79 of file concurrency_impl.h.
|
protected |
|
protected |
Notifies all registered listeners and passes them the provided argument This method should be called by a derived class to send out asynchronous messages to registered observers.
parameter | the data to be passed to the observers |
Definition at line 161 of file concurrency_impl.h.
Observable<ParamT>::CallbackPtr Observable< ParamT >::RegisterListener | ( | typename BoundClosure< ParamT, DelegateT, ClosureDataT >::CallbackMethod | method, |
DelegateT * | delegate, | ||
ClosureDataT | data | ||
) |
Observable<ParamT>::CallbackPtr Observable< ParamT >::RegisterListener | ( | typename BoundCallback< ParamT, DelegateT >::CallbackMethod | method, |
DelegateT * | delegate | ||
) |
void Observable< ParamT >::RegisterListener | ( | Observable< ParamT >::CallbackPtr | callback_object | ) |
Definition at line 126 of file concurrency_impl.h.
CallbackPtr Observable< ParamT >::RegisterListener | ( | typename BoundClosure< ParamT, DelegateT, ClosureDataT >::CallbackMethod | method, |
DelegateT * | delegate, | ||
ClosureDataT | data | ||
) |
Registers a method of a specific object as a listener to the Observable object. The method is invoked on the given delegate when the callback is fired by the observed object using NotifyListeners(). Since this is meant to be a closure, it also passes the third argument to the method being in- voked by the Observable object.
DelegateT | the type of the delegate object |
method | a pointer to the method to be invoked by the callback |
delegate | a pointer to the object to invoke the callback on |
closure | something to be passed to method |
Referenced by IngestionPipeline::IngestionPipeline(), swissknife::CommandScrub::Main(), receiver::PayloadProcessor::Process(), swissknife::CatalogTraversalParallel< ObjectFetcherT >::PushNestedCatalogs(), swissknife::CatalogTraversalParallel< ObjectFetcherT >::PushPreviousRevision(), and ScrubbingPipeline::ScrubbingPipeline().
CallbackPtr Observable< ParamT >::RegisterListener | ( | typename BoundCallback< ParamT, DelegateT >::CallbackMethod | method, |
DelegateT * | delegate | ||
) |
Registers a method of a specific object as a listener to the Observable object. The method is invoked on the given delegate when the callback is fired by the observed object using NotifyListeners().
DelegateT | the type of the delegate object |
method | a pointer to the method to be invoked by the callback |
delegate | a pointer to the object to invoke the callback on |
Observable< ParamT >::CallbackPtr Observable< ParamT >::RegisterListener | ( | typename Callback< ParamT >::CallbackFunction | fn | ) |
Registers a static class member or a C-like function as a callback to the Observable object. The function is invoked when the callback is fired by the observed object using NotifyListeners().
fn | a pointer to the function to be called by the callback |
Definition at line 115 of file concurrency_impl.h.
|
protected |
void Observable< ParamT >::UnregisterListener | ( | CallbackPtr | callback_object | ) |
Removes the given callback from the listeners group of this Observable.
callback_object | a callback handle that was returned by RegisterListener() before. |
Definition at line 135 of file concurrency_impl.h.
void Observable< ParamT >::UnregisterListeners | ( | ) |
Removes all listeners from the Observable
Definition at line 147 of file concurrency_impl.h.
Referenced by receiver::PayloadProcessor::Process().
|
private |
the set of registered callback objects
Definition at line 253 of file concurrency.h.
|
mutableprivate |
Definition at line 255 of file concurrency.h.