BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
ModelView::Signal< T > Class Template Reference

Callback container for specific client type. More...

Inheritance diagram for ModelView::Signal< T >:
[legend]
Collaboration diagram for ModelView::Signal< T >:
[legend]

Public Member Functions

void connect (T callback, Callbacks::slot_t client)
 
void operator() (Args... args)
 Notify clients using given list of arguments. More...
 
void remove_client (Callbacks::slot_t client)
 Remove client from the list to call back. More...
 

Private Attributes

std::list< std::pair< T, Callbacks::slot_t > > m_callbacks
 

Detailed Description

template<typename T>
class ModelView::Signal< T >

Callback container for specific client type.

Definition at line 70 of file callbackcontainer.h.

Member Function Documentation

◆ connect()

void ModelView::SignalBase< T, Callbacks::slot_t >::connect ( callback,
Callbacks::slot_t  client 
)
inherited

Definition at line 35 of file callbackcontainer.h.

46 {
47  m_callbacks.push_back(std::make_pair(callback, client));
48 }
std::list< std::pair< T, Callbacks::slot_t > > m_callbacks

◆ operator()()

void ModelView::SignalBase< T, Callbacks::slot_t >::operator() ( Args...  args)
inherited

Notify clients using given list of arguments.

Definition at line 37 of file callbackcontainer.h.

54 {
55  for (const auto& f : m_callbacks) {
56  f.first(args...);
57  }
58 }

◆ remove_client()

void ModelView::SignalBase< T, Callbacks::slot_t >::remove_client ( Callbacks::slot_t  client)
inherited

Remove client from the list to call back.

Definition at line 39 of file callbackcontainer.h.

63 {
64  m_callbacks.remove_if(
65  [client](const std::pair<T, U>& x) -> bool { return (x.second == client ? true : false); });
66 }

Member Data Documentation

◆ m_callbacks

std::list<std::pair<T, Callbacks::slot_t > > ModelView::SignalBase< T, Callbacks::slot_t >::m_callbacks
privateinherited

Definition at line 42 of file callbackcontainer.h.


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