Fix building and installing package.
[genetic.git] / include / gene.h
1 #ifndef __GENE_H
2 #define __GENE_H
3
4 namespace genetic {
5
6     /**
7      * Class representing Gene
8      */
9     template < typename Type >
10     class Gene {
11     protected:
12         /**
13          * Value of the Gene
14          * This for example can be a primitive value such as: int or double, or
15          * with additional changes complex struct.
16          */
17         Type value;
18
19         template<typename> friend class Gene;
20     public:
21         /**
22          * Default constructor
23          */
24         Gene() {}
25
26         /**
27          * Class constructor, initializes Gene with default value.
28          */
29         Gene(Type value) {
30             this->value = value;
31         }
32
33         /** Copy constructor */
34         Gene(const Gene& gene) : value(gene.value) {}
35
36         /**
37          * Copy operator.
38          *
39          * @param gene Gene from which the value should be copied.
40          * @return Gene instance containing copied value
41          */
42         Gene& operator=(const Gene& gene) {
43             this->value = gene.value;
44             return *this;
45         }
46
47         /**
48          * Allows read-only access to Gene value
49          */
50         Type get() const {
51             return value;
52         }
53     };
54 }
55
56 #endif /* __GENE_H */