ROOT_Application  2.0
C++ Core modules and GUIStock
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ObsPattern_Sub.cpp
Go to the documentation of this file.
1 
8 #include "ObsPattern_Sub.h"
9 #include "ObsPattern_Obs.h"
10 
11 
13 {
14 #ifdef DEBUG_UTIL
15  std::cout << "Subject::notify with no argument size vec_observer : " << vec_observer.size() << std::endl;
16 #endif
17  // broadcasts the message
18  for ( unsigned int i = 0; i < vec_observer.size(); i++)
19  //vec_observer[i]->update();
20  // more general if send the object in the update
21  vec_observer[i]->update(this);
22 }
23 
24 void Subject::notify( std::vector<std::string> & message )
25 {
26 #ifdef DEBUG_UTIL
27  std::cout << "Subject::notify with message to all observers nb: " << vec_observer.size() << std::endl;
28 #endif
29  // broadcasts the message
30  for ( unsigned int i = 0; i < vec_observer.size(); i++)
31  //vec_observer[i]->update();
32  // more general if send the object in the update ( from internet )
33  vec_observer[i]->update(this, message );
34 }
void notify()
notify a message to all registered observer
Base class for the Subject/Observable from the Observer pattern.
std::vector< Observer * > vec_observer
vector of registered observer