Remove some not used namespace declarations.
[genetic.git] / include / condition / condition.h
1 #ifndef __CONDITION_CONDITION_H
2 #define __CONDITION_CONDITION_H
3
4 #include "chromosome.h"
5 #include "generation.h"
6
7 namespace genetic {
8     /**
9      * Base Condition class.
10      * It is used for checking if algorithm should stop.
11      */
12     template < typename _Chromosome>
13     class Condition {
14     protected:
15         /**
16          * Check calculations for current generation if it passes stop condition
17          * If condition is satisfied, we can check another generation.
18          * All the custom Condition checks should be invoked in this method.
19          *
20          * @param generation reference of current generation to check
21          *
22          * @return true if condition is satisfied and another generation can checked;
23          *      false if condition is not satisfied and algorithm should stop.
24          */
25         virtual bool do_check(const Generation<_Chromosome>&) = 0;
26
27     public:
28         /**
29          * Checks if current generation passes stop condition.
30          * If condition is satisfied, we can check another generation.
31          *
32          * @param generation reference of current generation to check
33          *
34          * @return true if condition is satisfied and another generation can checked;
35          *      false if condition is not satisfied and algorithm should stop.
36          */
37         bool check(const Generation<_Chromosome>& generation) {
38             return do_check(generation);
39         }
40     };
41 }
42
43 #endif /* __CONDITION_CONDITION_H */