Mercurial > hg > orthanc-stone
comparison Framework/Toolbox/ObserversRegistry.h @ 90:64e60018943f wasm
fix and observer refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 29 May 2017 11:04:18 +0200 |
parents | c2dc924f1a63 |
children | 81f73efd81a1 |
comparison
equal
deleted
inserted
replaced
89:f244018a4e4b | 90:64e60018943f |
---|---|
90 | 90 |
91 bool IsEmpty() | 91 bool IsEmpty() |
92 { | 92 { |
93 return observers_.empty(); | 93 return observers_.empty(); |
94 } | 94 } |
95 | |
96 void Apply(const Source& source, | |
97 void (Observer::*method) (const Source&)) | |
98 { | |
99 for (typename Observers::const_iterator it = observers_.begin(); | |
100 it != observers_.end(); ++it) | |
101 { | |
102 ((*it)->*method) (source); | |
103 } | |
104 } | |
105 | |
106 template <typename Argument0> | |
107 void Apply(const Source& source, | |
108 void (Observer::*method) (const Source&, const Argument0&), | |
109 const Argument0& argument0) | |
110 { | |
111 for (typename Observers::const_iterator it = observers_.begin(); | |
112 it != observers_.end(); ++it) | |
113 { | |
114 ((*it)->*method) (source, argument0); | |
115 } | |
116 } | |
117 | |
118 template <typename Argument0, | |
119 typename Argument1> | |
120 void Apply(const Source& source, | |
121 void (Observer::*method) (const Source&, const Argument0&, const Argument1&), | |
122 const Argument0& argument0, | |
123 const Argument1& argument1) | |
124 { | |
125 for (typename Observers::const_iterator it = observers_.begin(); | |
126 it != observers_.end(); ++it) | |
127 { | |
128 ((*it)->*method) (source, argument0, argument1); | |
129 } | |
130 } | |
95 }; | 131 }; |
96 } | 132 } |