SSAGES  0.8.3
Software Suite for Advanced General Ensemble Simulations
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 
79  void SetCVManager(class CVManager* cvmanager);
80 
82 
87  void AddListener(EventListener* listener);
88 
90  void NotifyObservers();
91 
93 
97  void PreSimulationHook();
98 
100 
105  void PostIntegrationHook();
106 
108 
114  {
115  }
116 
118 
122  void PostSimulationHook();
123 
125  virtual ~Hook(){}
126  };
127 }
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:50
void SetSnapshot(class Snapshot *snapshot)
Sets the active snapshot.
Definition: Hook.cpp:84
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:113
class CVManager * cvmanager_
Collective variable manager.
Definition: Hook.h:42
void AddListener(EventListener *listener)
Add a listener to the hook.
Definition: Hook.cpp:101
virtual ~Hook()
Destructor.
Definition: Hook.h:125
void SetCVManager(class CVManager *cvmanager)
Sets the current CV manager.
Definition: Hook.cpp:90
void PostSimulationHook()
Post-simulation hook.
Definition: Hook.cpp:67
void NotifyObservers()
Notify observers of changes in the simulation.