utils::Signal< A1, A2, A3, A4, A5 > Class Template Reference

#include <signal_slot.h>

Inheritance diagram for utils::Signal< A1, A2, A3, A4, A5 >:
Inheritance graph
[legend]
Collaboration diagram for utils::Signal< A1, A2, A3, A4, A5 >:
Collaboration graph
[legend]

Public Member Functions

 Signal ()
 ~Signal ()
template<class T >
void add_slot (T *obj, void(T::*func)(void))
 Add receiver to receive pre-defined signals.
template<class T >
void add_slot (T *obj, void(T::*func)(A1))
template<class T >
void add_slot (T *obj, void(T::*func)(A1, A2))
template<class T >
void add_slot (T *obj, void(T::*func)(A1, A2, A3))
template<class T >
void add_slot (T *obj, void(T::*func)(A1, A2, A3, A4))
template<class T >
void add_slot (T *obj, void(T::*func)(A1, A2, A3, A4, A5))
template<class T >
bool remove_slot (T *p, void(T::*func)())
 Remove receiver from the receivers list.
template<class T >
bool remove_slot (T *p, void(T::*func)(A1 arg1))
template<class T >
bool remove_slot (T *p, void(T::*func)(A1 arg1, A2 arg2))
template<class T >
bool remove_slot (T *p, void(T::*func)(A1 arg1, A2 arg2, A3 arg3))
template<class T >
bool remove_slot (T *p, void(T::*func)(A1 arg1, A2 arg2, A3 arg3, A4 arg4))
template<class T >
bool remove_slot (T *p, void(T::*func)(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5))
void broadcast ()
 Notify all receivers.
void broadcast (A1 arg1)
void safe_broadcast (A1 arg1)
void broadcast (A1 arg1, A2 arg2)
void broadcast (A1 arg1, A2 arg2, A3 arg3)
void broadcast (A1 arg1, A2 arg2, A3 arg3, A4 arg4)
void broadcast (A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5)
unsigned int count ()

Detailed Description

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
class utils::Signal< A1, A2, A3, A4, A5 >

Definition at line 143 of file signal_slot.h.


Constructor & Destructor Documentation

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
utils::Signal< A1, A2, A3, A4, A5 >::Signal (  )  [inline]

Definition at line 148 of file signal_slot.h.

00149     {}

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
utils::Signal< A1, A2, A3, A4, A5 >::~Signal (  )  [inline]

Definition at line 151 of file signal_slot.h.

00151 {clear();}


Member Function Documentation

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
void utils::Signal< A1, A2, A3, A4, A5 >::add_slot ( T *  obj,
void(T::*)(A1, A2, A3, A4, A5)  func 
) [inline]

Definition at line 191 of file signal_slot.h.

00192     {
00193         SlotBasePtr p = new Slot<T, A1, A2, A3, A4, A5>(obj, func);
00194         receivers.push_back(p);
00195     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
void utils::Signal< A1, A2, A3, A4, A5 >::add_slot ( T *  obj,
void(T::*)(A1, A2, A3, A4)  func 
) [inline]

Definition at line 184 of file signal_slot.h.

00185     {
00186         SlotBasePtr p = new Slot<T, A1, A2, A3, A4>(obj, func);
00187         receivers.push_back(p);
00188     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
void utils::Signal< A1, A2, A3, A4, A5 >::add_slot ( T *  obj,
void(T::*)(A1, A2, A3)  func 
) [inline]

Definition at line 177 of file signal_slot.h.

00178     {
00179         SlotBasePtr p = new Slot<T, A1, A2, A3>(obj, func);
00180         receivers.push_back(p);
00181     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
void utils::Signal< A1, A2, A3, A4, A5 >::add_slot ( T *  obj,
void(T::*)(A1, A2)  func 
) [inline]

Definition at line 170 of file signal_slot.h.

00171     {
00172         SlotBasePtr p = new Slot<T, A1, A2>(obj, func);
00173         receivers.push_back(p);
00174     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
void utils::Signal< A1, A2, A3, A4, A5 >::add_slot ( T *  obj,
void(T::*)(A1)  func 
) [inline]

Definition at line 163 of file signal_slot.h.

00164     {
00165         SlotBasePtr p = new Slot<T, A1>(obj, func);
00166         receivers.push_back(p);
00167     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
void utils::Signal< A1, A2, A3, A4, A5 >::add_slot ( T *  obj,
void(T::*)(void)  func 
) [inline]

Add receiver to receive pre-defined signals.

Definition at line 156 of file signal_slot.h.

Referenced by main(), text::TextController::paginate(), text::PluginDocImpl::PluginDocImpl(), text::PluginViewImpl::PluginViewImpl(), images::PluginViewImpl::PluginViewImpl(), and text::TextController::search().

00157     {
00158         SlotBasePtr p = new Slot<T>(obj, func);
00159         receivers.push_back(p);
00160     }

Here is the caller graph for this function:

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
void utils::Signal< A1, A2, A3, A4, A5 >::broadcast ( A1  arg1,
A2  arg2,
A3  arg3,
A4  arg4,
A5  arg5 
) [inline]

Definition at line 301 of file signal_slot.h.

00302     {
00303         ReceiversIter begin = receivers.begin();
00304         ReceiversIter end   = receivers.end();
00305         for(ReceiversIter it= begin; it != end; ++it)
00306         {
00307             (*(*it))(arg1, arg2, arg3, arg4, arg5);
00308         }
00309     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
void utils::Signal< A1, A2, A3, A4, A5 >::broadcast ( A1  arg1,
A2  arg2,
A3  arg3,
A4  arg4 
) [inline]

Definition at line 291 of file signal_slot.h.

00292     {
00293         ReceiversIter begin = receivers.begin();
00294         ReceiversIter end   = receivers.end();
00295         for(ReceiversIter it= begin; it != end; ++it)
00296         {
00297             (*(*it))(arg1, arg2, arg3, arg4);
00298         }
00299     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
void utils::Signal< A1, A2, A3, A4, A5 >::broadcast ( A1  arg1,
A2  arg2,
A3  arg3 
) [inline]

Definition at line 281 of file signal_slot.h.

00282     {
00283         ReceiversIter begin = receivers.begin();
00284         ReceiversIter end   = receivers.end();
00285         for(ReceiversIter it= begin; it != end; ++it)
00286         {
00287             (*(*it))(arg1, arg2, arg3);
00288         }
00289     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
void utils::Signal< A1, A2, A3, A4, A5 >::broadcast ( A1  arg1,
A2  arg2 
) [inline]

Definition at line 271 of file signal_slot.h.

00272     {
00273         ReceiversIter begin = receivers.begin();
00274         ReceiversIter end   = receivers.end();
00275         for(ReceiversIter it= begin; it != end; ++it)
00276         {
00277             (*(*it))(arg1, arg2);
00278         }
00279     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
void utils::Signal< A1, A2, A3, A4, A5 >::broadcast ( A1  arg1  )  [inline]

Definition at line 251 of file signal_slot.h.

00252     {
00253         ReceiversIter begin = receivers.begin();
00254         ReceiversIter end   = receivers.end();
00255         for(ReceiversIter it= begin; it != end; ++it)
00256         {
00257             (*(*it))(arg1);
00258         }
00259     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
void utils::Signal< A1, A2, A3, A4, A5 >::broadcast (  )  [inline]

Notify all receivers.

Definition at line 241 of file signal_slot.h.

Referenced by text::SearchTask::execute(), text::RenderTask::execute(), text::PaginationTask::execute(), images::ImagesRenderer::notify_page_ready(), and text::TextController::pause_pagination().

00242     {
00243         ReceiversIter begin = receivers.begin();
00244         ReceiversIter end   = receivers.end();
00245         for(ReceiversIter it= begin; it != end; ++it)
00246         {
00247             (*(*it))();
00248         }
00249     }

Here is the caller graph for this function:

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
unsigned int utils::Signal< A1, A2, A3, A4, A5 >::count (  )  [inline]

Definition at line 312 of file signal_slot.h.

00313     {
00314         return static_cast<unsigned int>(receivers.size());
00315     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
bool utils::Signal< A1, A2, A3, A4, A5 >::remove_slot ( T *  p,
void(T::*)(A1 arg1, A2 arg2, A3 arg3, A4 arg4, A5 arg5)  func 
) [inline]

Definition at line 234 of file signal_slot.h.

00235     {
00236         Slot<T, A1, A2, A3, A4, A5> func_obj(p, func);
00237         return remove_receiver(&func_obj);
00238     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
bool utils::Signal< A1, A2, A3, A4, A5 >::remove_slot ( T *  p,
void(T::*)(A1 arg1, A2 arg2, A3 arg3, A4 arg4)  func 
) [inline]

Definition at line 227 of file signal_slot.h.

00228     {
00229         Slot<T, A1, A2, A3, A4, A5> func_obj(p, func);
00230         return remove_receiver(&func_obj);
00231     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
bool utils::Signal< A1, A2, A3, A4, A5 >::remove_slot ( T *  p,
void(T::*)(A1 arg1, A2 arg2, A3 arg3)  func 
) [inline]

Definition at line 220 of file signal_slot.h.

00221     {
00222         Slot<T, A1, A2, A3, A4, A5> func_obj(p, func);
00223         return remove_receiver(&func_obj);
00224     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
bool utils::Signal< A1, A2, A3, A4, A5 >::remove_slot ( T *  p,
void(T::*)(A1 arg1, A2 arg2)  func 
) [inline]

Definition at line 213 of file signal_slot.h.

00214     {
00215         Slot<T, A1, A2, A3, A4, A5> func_obj(p, func);
00216         return remove_receiver(&func_obj);
00217     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
bool utils::Signal< A1, A2, A3, A4, A5 >::remove_slot ( T *  p,
void(T::*)(A1 arg1)  func 
) [inline]

Definition at line 206 of file signal_slot.h.

00207     {
00208         Slot<T, A1, A2, A3, A4, A5> func_obj(p, func);
00209         return remove_receiver(&func_obj);
00210     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
template<class T >
bool utils::Signal< A1, A2, A3, A4, A5 >::remove_slot ( T *  p,
void(T::*)()  func 
) [inline]

Remove receiver from the receivers list.

Definition at line 199 of file signal_slot.h.

00200     {
00201         Slot<T, A1, A2, A3, A4, A5> func_obj(p, func);
00202         return remove_receiver(&func_obj);
00203     }

template<typename A1 = UNUSABLE, typename A2 = UNUSABLE, typename A3 = UNUSABLE, typename A4 = UNUSABLE, typename A5 = UNUSABLE>
void utils::Signal< A1, A2, A3, A4, A5 >::safe_broadcast ( A1  arg1  )  [inline]

safe_broadcast is added for object that will be released during broadcasting.

Definition at line 263 of file signal_slot.h.

00264     {
00265         Signal<A1, A2, A3, A4, A5> object;
00266         object.receivers = receivers;
00267         object.broadcast(arg1);
00268         object.receivers.clear();
00269     }


The documentation for this class was generated from the following file:
Generated by  doxygen 1.6.2-20100208