Gromacs  2020.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Member Functions
gmx::MdModuleNotification< CallParameter, MdModuleNotificationBase > Class Template Reference

#include <gromacs/utility/mdmodulenotification.h>

Inherits MdModuleNotificationBase.

Description

template<class CallParameter, class MdModuleNotificationBase>
class gmx::MdModuleNotification< CallParameter, MdModuleNotificationBase >

Subscribe and trigger notification functions.

Extends MdModuleNotificationBase with new notification function and routine to subscribe new listeners.

To create a class of this type that provides callbacks, e.g., for events EventA, and EventB use registerMdModuleNotification<EventA, EventB>::type.

Template Parameters
CallParameterof the function to be notified
MdModuleNotificationBaseclass to be extended with a notification with CallParameter
msc_inline_mscgraph_12
Note
All added subscribers are required to out-live the MdModuleNotification

Public Member Functions

void notify (CallParameter callParameter) const
 Trigger the subscribed notifications. More...
 
void subscribe (std::function< void(CallParameter)> callBackFunction)
 Add callback function to be called when notification is triggered. More...
 

Member Function Documentation

template<class CallParameter , class MdModuleNotificationBase >
void gmx::MdModuleNotification< CallParameter, MdModuleNotificationBase >::notify ( CallParameter  callParameter) const
inline

Trigger the subscribed notifications.

Parameters
[in]callParameterof the function to be called back
template<class CallParameter , class MdModuleNotificationBase >
void gmx::MdModuleNotification< CallParameter, MdModuleNotificationBase >::subscribe ( std::function< void(CallParameter)>  callBackFunction)
inline

Add callback function to be called when notification is triggered.

Notifications are distinguished by their call signature.

Parameters
[in]callBackFunctionto be called from this class

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