mirror of
https://github.com/OPM/opm-simulators.git
synced 2026-08-19 02:24:49 -05:00
Add classes for event-handling
The new classes Event and EventSource can be used as a simple mechanism for implementing event-based callbacks in the simulators.
This commit is contained in:
committed by
Arne Morten Kvarving
parent
a767e166ae
commit
0c53ac1509
@@ -0,0 +1,13 @@
|
||||
// Copyright (C) 2013 Uni Research AS
|
||||
// This file is licensed under the GNU General Public License v3.0
|
||||
|
||||
#ifndef OPM_EVENT_HEADER_INCLUDED
|
||||
#error Do NOT include this file directly!
|
||||
#endif /* OPM_EVENT_HEADER_INCLUDED */
|
||||
|
||||
template <typename T, void (T::*member)()> inline Event&
|
||||
Event::add (T& t) {
|
||||
// wrap the member function in a std::function and add that
|
||||
// notice the use of ref() to avoid invoking the copy constructor
|
||||
return this->add (std::bind (member, std::ref(t)));
|
||||
}
|
||||
Reference in New Issue
Block a user