Action_Thermostats
Add_AtomRandomPerturbation
Add_RotateAroundBondAction
Add_SelectAtomByNameAction
Adding_Graph_to_ChangeBondActions
Adding_MD_integration_tests
Adding_StructOpt_integration_tests
Automaking_mpqc_open
AutomationFragmentation_failures
Candidate_v1.6.0
Candidate_v1.6.1
ChangeBugEmailaddress
ChangingTestPorts
ChemicalSpaceEvaluator
Combining_Subpackages
Debian_Package_split
Debian_package_split_molecuildergui_only
Disabling_MemDebug
Docu_Python_wait
EmpiricalPotential_contain_HomologyGraph_documentation
Enable_parallel_make_install
Enhance_userguide
Enhanced_StructuralOptimization
Enhanced_StructuralOptimization_continued
Example_ManyWaysToTranslateAtom
Exclude_Hydrogens_annealWithBondGraph
FitPartialCharges_GlobalError
Fix_ChronosMutex
Fix_StatusMsg
Fix_StepWorldTime_single_argument
Fix_Verbose_Codepatterns
ForceAnnealing_goodresults
ForceAnnealing_oldresults
ForceAnnealing_tocheck
ForceAnnealing_with_BondGraph
ForceAnnealing_with_BondGraph_continued
ForceAnnealing_with_BondGraph_continued_betteresults
ForceAnnealing_with_BondGraph_contraction-expansion
GeometryObjects
Gui_displays_atomic_force_velocity
IndependentFragmentGrids_IntegrationTest
JobMarket_RobustOnKillsSegFaults
JobMarket_StableWorkerPool
JobMarket_unresolvable_hostname_fix
ODR_violation_mpqc_open
PartialCharges_OrthogonalSummation
PythonUI_with_named_parameters
QtGui_reactivate_TimeChanged_changes
Recreated_GuiChecks
RotateToPrincipalAxisSystem_UndoRedo
StoppableMakroAction
Subpackage_CodePatterns
Subpackage_JobMarket
Subpackage_levmar
Subpackage_mpqc_open
Subpackage_vmg
ThirdParty_MPQC_rebuilt_buildsystem
TremoloParser_IncreasedPrecision
TremoloParser_MultipleTimesteps
Ubuntu_1604_changes
stable
Line | |
---|
1 | /*
|
---|
2 | * Relay.hpp
|
---|
3 | *
|
---|
4 | * Created on: Dec 1, 2011
|
---|
5 | * Author: heber
|
---|
6 | */
|
---|
7 |
|
---|
8 | #ifndef RELAY_HPP_
|
---|
9 | #define RELAY_HPP_
|
---|
10 |
|
---|
11 | // include config.h
|
---|
12 | #ifdef HAVE_CONFIG_H
|
---|
13 | #include <config.h>
|
---|
14 | #endif
|
---|
15 |
|
---|
16 | #include "CodePatterns/Observer/Observable.hpp"
|
---|
17 |
|
---|
18 | /**
|
---|
19 | * A Relay acts as a node in a many-to-one observation.
|
---|
20 | *
|
---|
21 | * All Observable::update() calls will pass through this relay. Hence, if an
|
---|
22 | * instance desires to observe all atoms and be notified of each single change,
|
---|
23 | * he would otherwise be forced to not only Observable:signon() to each and
|
---|
24 | * every one of them but also to keep track of all newly created ones.
|
---|
25 | *
|
---|
26 | * Instead he simply uses Relay::signOn() of the specific Relay he wishes
|
---|
27 | * to use (note Relay should are singleton of nature but are not required to
|
---|
28 | * inherit the Singleton pattern) and will get notified as if he were
|
---|
29 | * signOn()'ed to each atom because Observer::update() will get passed through
|
---|
30 | * the Relay. I.e. the given reference to the Observer points to the atom that
|
---|
31 | * initiated the update() call and not to the Relay.
|
---|
32 | */
|
---|
33 | class Relay : public Observable {
|
---|
34 | public:
|
---|
35 | Relay(std::string _name);
|
---|
36 | virtual ~Relay();
|
---|
37 |
|
---|
38 | virtual void signOn(
|
---|
39 | Observer *target,
|
---|
40 | GlobalObservableInfo::PriorityLevel priority = GlobalObservableInfo::PriorityDefault) const;
|
---|
41 |
|
---|
42 | virtual void signOff(Observer *target) const;
|
---|
43 |
|
---|
44 | virtual void signOn(
|
---|
45 | Observer *target,
|
---|
46 | size_t channelno,
|
---|
47 | GlobalObservableInfo::PriorityLevel priority = GlobalObservableInfo::PriorityDefault) const;
|
---|
48 |
|
---|
49 | virtual void signOff(Observer *target, size_t channelno) const;
|
---|
50 |
|
---|
51 | protected:
|
---|
52 | virtual void update(Observable *publisher);
|
---|
53 | virtual void recieveNotification(Observable *publisher, Notification_ptr notification);
|
---|
54 | virtual void subjectKilled(Observable *publisher);
|
---|
55 |
|
---|
56 | virtual void notifyAll();
|
---|
57 |
|
---|
58 | private:
|
---|
59 | //!> Current peer that called last update on us, to be passed on to Observers
|
---|
60 | Observable *Updater;
|
---|
61 | };
|
---|
62 |
|
---|
63 |
|
---|
64 | #endif /* RELAY_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.