Nemo  2.3.46
servicenotifiers.h
Go to the documentation of this file.
1 
29 #include "types.h"
30 #include "lifecycleevent.h"
31 #include "fileservices.h"
32 #include "statservices.h"
33 #include "updaterservices.h"
34 #include "filehandler.h"
35 #include "stathandler.h"
36 
37 
38 //LCE_ParamUpdaterNotifier
39 //
42 
43 private:
45 
46 public:
47 
48  LCE_ParamUpdaterNotifier () : LifeCycleEvent("param_updater",""), _manager(0) { }
50 
51  void setManager (UpdaterServices* mng) {_manager = mng;}
52  virtual void execute ();
53  virtual bool setParameters () {return true;}
54 
55  virtual LifeCycleEvent* clone ( ) {return new LCE_ParamUpdaterNotifier();}
56 
57  //SimComponent overrides:
58  virtual void loadFileServices ( FileServices* loader ) {}
59  virtual void loadStatServices ( StatServices* loader ) {}
60  virtual void loadUpdaters ( UpdaterServices* loader) {_manager = loader;}
61  virtual age_t removeAgeClass ( ) {return 0;}
62  virtual age_t addAgeClass ( ) {return 0;}
63  virtual age_t requiredAgeClass () {return 0;}
64 };
65 
66 // LCE_FileServicesNotifier
67 //
70  {
71 
73 
74  public:
76  : LifeCycleEvent("save_files",""), _service(0) { }
78 
79  virtual void execute ();
80  virtual bool setParameters () {return true;}
81 
82  virtual LifeCycleEvent* clone ( ) {return new LCE_FileServicesNotifier();}
83 
84  //SimComponent overrides:
85  virtual void loadFileServices ( FileServices* loader ) {_service = loader;}
86  virtual void loadStatServices ( StatServices* loader ) {}
87  virtual age_t removeAgeClass ( ) {return 0;}
88  virtual age_t addAgeClass ( ) {return 0;}
89  virtual age_t requiredAgeClass () {return 0;}
90  };
91 
92 // LCE_StatFH
93 //
95 class LCE_StatFH : public FileHandler {
96 
98 
99 public:
100 
102  : FileHandler(".txt"), _statService(0)
103  {
104  FileHandler::set(false,false,0,0,0,"");
105  set_isMasterExec(true);
106  }
107 
108  ~LCE_StatFH() { };
109 
110  virtual bool ifExist();
111 
112  void set_statService(StatServices* srv) {_statService = srv;}
113 
114  virtual void FHwrite();
115  virtual void FHread (string& filename) {}
116 
117  void PrintStat_byGen ( );
118 };
119 
120 
121 // LCE_StatServiceNotifier
122 //
126  {
127 
129 
130  unsigned int _occurrence;
131 
132  string _arg, _dir;
133 
135 
136  public:
137 
139 
140  virtual ~LCE_StatServiceNotifier ( ) { }
141 
143  bool setOccurence ();
144  bool dummyUpdate (){return true;}
145 
146  virtual bool setParameters ();
147  virtual void execute ();
148 
150 
151  //SimComponent overrides:
152  virtual void loadFileServices ( FileServices* loader ) {loader->attach(&_fileHandler);}
153  virtual void loadStatServices ( StatServices* loader );
154  virtual age_t removeAgeClass ( ) {return 0;}
155  virtual age_t addAgeClass ( ) {return 0;}
156  virtual age_t requiredAgeClass () {return 0;}
157 
158  };
virtual void loadFileServices(FileServices *loader)
Definition: servicenotifiers.h:58
Class to update the simulation components' state during a simulation.
Definition: updaterservices.h:64
void PrintStat_byGen()
Definition: servicenotifiers.cc:307
StatServices * _service
Definition: servicenotifiers.h:128
StatServices * _statService
Definition: servicenotifiers.h:97
virtual bool setParameters()
Definition: servicenotifiers.h:53
The Service class used to manage the StatHandler objects.
Definition: statservices.h:50
Interface to handle file input/output for any SimComponent.
Definition: filehandler.h:53
virtual age_t removeAgeClass()
Definition: servicenotifiers.h:61
virtual void attach(Handler *FH)
Attaches the FileHandler to the current list (_writers) of the FileServices.
Definition: fileservices.cc:57
virtual age_t removeAgeClass()
Definition: servicenotifiers.h:87
virtual age_t removeAgeClass()
Definition: servicenotifiers.h:154
void set_isMasterExec(bool is)
Definition: filehandler.h:182
string _dir
Definition: servicenotifiers.h:132
virtual void FHread(string &filename)
Definition: servicenotifiers.h:115
unsigned int age_t
Age class flags.
Definition: types.h:46
Event used to notify all file handlers to update their state through the FileServices::notify() inter...
Definition: servicenotifiers.h:69
unsigned int _occurrence
Definition: servicenotifiers.h:130
virtual void loadFileServices(FileServices *loader)
Definition: servicenotifiers.h:85
virtual bool setParameters()
Definition: servicenotifiers.cc:107
virtual bool setParameters()
Definition: servicenotifiers.h:80
LCE_StatFH _fileHandler
Definition: servicenotifiers.h:134
virtual age_t requiredAgeClass()
Definition: servicenotifiers.h:63
Initiates the StatServices' parameters (log time) when registering, calls StatServices::notify() when...
Definition: servicenotifiers.h:125
virtual void execute()
Definition: servicenotifiers.cc:62
virtual age_t addAgeClass()
Definition: servicenotifiers.h:155
FileHandler of the LCE_StatServiceNotifier class, writes the recorded stats to txt files...
Definition: servicenotifiers.h:95
LCE_ParamUpdaterNotifier()
Definition: servicenotifiers.h:48
virtual age_t requiredAgeClass()
Definition: servicenotifiers.h:156
virtual age_t addAgeClass()
Definition: servicenotifiers.h:62
virtual void loadStatServices(StatServices *loader)
Definition: servicenotifiers.h:59
virtual void execute()
Definition: servicenotifiers.cc:224
bool setOccurence()
Definition: servicenotifiers.cc:151
Calls the UpdaterServices to notify its components of a generation change.
Definition: servicenotifiers.h:41
~LCE_StatFH()
Definition: servicenotifiers.h:108
void setManager(UpdaterServices *mng)
Definition: servicenotifiers.h:51
void set_statService(StatServices *srv)
Definition: servicenotifiers.h:112
virtual void FHwrite()
Definition: servicenotifiers.cc:270
bool dummyUpdate()
Definition: servicenotifiers.h:144
LCE_FileServicesNotifier()
Definition: servicenotifiers.h:75
virtual LifeCycleEvent * clone()
Definition: servicenotifiers.h:82
virtual LCE_StatServiceNotifier * clone()
Definition: servicenotifiers.h:149
virtual LifeCycleEvent * clone()
Definition: servicenotifiers.h:55
FileHandler & getFH()
Definition: servicenotifiers.h:142
LCE_StatFH()
Definition: servicenotifiers.h:101
string _arg
Definition: servicenotifiers.h:132
virtual bool ifExist()
Definition: servicenotifiers.cc:239
virtual void set(bool rpl_per, bool gen_per, int rpl_occ, int gen_occ, int rank, string path)
Sets the hanlder parameters.
Definition: filehandler.h:193
virtual ~LCE_ParamUpdaterNotifier()
Definition: servicenotifiers.h:49
UpdaterServices * _manager
Definition: servicenotifiers.h:44
virtual age_t requiredAgeClass()
Definition: servicenotifiers.h:89
virtual ~LCE_FileServicesNotifier()
Definition: servicenotifiers.h:77
virtual ~LCE_StatServiceNotifier()
Definition: servicenotifiers.h:140
LCE_StatServiceNotifier()
Definition: servicenotifiers.cc:79
virtual void loadFileServices(FileServices *loader)
Definition: servicenotifiers.h:152
virtual age_t addAgeClass()
Definition: servicenotifiers.h:88
virtual void execute()
Definition: servicenotifiers.cc:45
virtual void loadStatServices(StatServices *loader)
Definition: servicenotifiers.h:86
A class to manage the files associated with each components of the simulation.
Definition: fileservices.h:51
Base class of the Life Cycle Events, declares the LCE interface.
Definition: lifecycleevent.h:72
virtual void loadUpdaters(UpdaterServices *loader)
Definition: servicenotifiers.h:60
virtual void loadStatServices(StatServices *loader)
Definition: servicenotifiers.cc:204
FileServices * _service
Definition: servicenotifiers.h:72

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR