SSAGES  0.1
A MetaDynamics Package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Groups Pages
Hook.h
1 
21 #pragma once
22 
23 #include "EventListener.h"
24 #include <algorithm>
25 
26 namespace SSAGES
27 {
29 
35  class Hook
36  {
37  private:
39  std::vector<EventListener*> listeners_;
40 
43 
44  protected:
47 
49 
53  virtual void SyncToEngine() = 0;
54 
56 
60  virtual void SyncToSnapshot() = 0;
61 
62  public:
64 
68  Hook() :
69  listeners_(0), snapshot_(nullptr)
70  {}
71 
73  void SetSnapshot(class Snapshot* snapshot);
74 
76  void SetCVManager(class CVManager* cvmanager);
77 
79 
84  void AddListener(EventListener* listener);
85 
87  void NotifyObservers();
88 
90 
94  void PreSimulationHook();
95 
97 
102  void PostIntegrationHook();
103 
105 
111  {
112  }
113 
115 
119  void PostSimulationHook();
120 
122  virtual ~Hook(){}
123  };
124 }
Base abstract class for listening in to events fired by "Hook".
Definition: EventListener.h:34
Collective variable manager.
Definition: CVManager.h:40
Class containing a snapshot of the current simulation in time.
Definition: Snapshot.h:43
virtual void SyncToEngine()=0
Synchronization to the simulation engine.
void PostIntegrationHook()
Post-integration hook.
Definition: Hook.cpp:52
void SetSnapshot(class Snapshot *snapshot)
Sets the active snapshot.
Definition: Hook.cpp:86
class Snapshot * snapshot_
Local snapshot.
Definition: Hook.h:46
virtual void SyncToSnapshot()=0
Synchronization to the snapshot.
std::vector< EventListener * > listeners_
Vector of event listeners.
Definition: Hook.h:39
void PreSimulationHook()
Pre-simulation hook.
Definition: Hook.cpp:30
Base class for hooks into the simultion engines.
Definition: Hook.h:35
Hook()
Constructor.
Definition: Hook.h:68
void PostStepHook()
Post-step hook.
Definition: Hook.h:110
class CVManager * cvmanager_
Collective variable manager.
Definition: Hook.h:42
void AddListener(EventListener *listener)
Add a listener to the hook.
Definition: Hook.cpp:103
virtual ~Hook()
Destructor.
Definition: Hook.h:122
void SetCVManager(class CVManager *cvmanager)
Sets the current CV manager.
Definition: Hook.cpp:92
void PostSimulationHook()
Post-simulation hook.
Definition: Hook.cpp:69
void NotifyObservers()
Notify observers of changes in the simulation.