source: src/commands/com_check_iteration_counter.cpp@ cd0fed

Last change on this file since cd0fed was dfed1c, checked in by Julian Iseringhausen <isering@…>, 14 years ago

Major vmg update.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@1136 5161e1c8-67bf-11de-9fd5-51895aff932f

  • Property mode set to 100644
File size: 1.1 KB
Line 
1/**
2 * @file com_check_iteration_counter.cpp
3 * @author Julian Iseringhausen <isering@ins.uni-bonn.de>
4 * @date Mon Apr 18 12:29:39 2011
5 *
6 * @brief Increases the iteration counter and checks if
7 * the maximum number of iterations is reached.
8 *
9 */
10
11#ifdef HAVE_CONFIG_H
12#include <config.h>
13#endif
14
15#include "base/command.hpp"
16#include "base/object.hpp"
17#include "mg.hpp"
18
19using namespace VMG;
20
21class VMGCommandCheckIterationCounter : public Command
22{
23public:
24 VMGCommandCheckIterationCounter()
25 {
26 new ObjectStorage<int>("ITERATION", 0);
27 }
28
29 Request Run(Command::argument_vector arguments)
30 {
31 MPE_EVENT_BEGIN()
32
33 const int& max_iteration = MG::GetFactory().GetObjectStorageVal<int>("MAX_ITERATION");
34 int& iteration = MG::GetFactory().GetObjectStorageVal<int>("ITERATION");
35
36 MPE_EVENT_END()
37
38 if (++iteration >= max_iteration)
39 return StopCycleLater;
40 else
41 return Continue;
42 }
43
44 static const char* Name() {return "CheckIterationCounter";}
45 static int Arguments() {return 0;}
46};
47
48CREATE_INITIALIZER(VMGCommandCheckIterationCounter)
Note: See TracBrowser for help on using the repository browser.