X-Git-Url: https://git.dlugolecki.net.pl/?a=blobdiff_plain;f=src%2Fgene.h;fp=src%2Fgene.h;h=f3b3c55fa1846ae6efc45c339724afd8d4421e20;hb=1bef1f38888f19f83083d2f5bc1e1a90bb14291f;hp=e4142811b3e23bd31724d9a3ae7a243af828e801;hpb=58bf4fc9da0dfc4abb33bdc982214cbd2f186b44;p=genetic.git diff --git a/src/gene.h b/src/gene.h index e414281..f3b3c55 100644 --- a/src/gene.h +++ b/src/gene.h @@ -4,15 +4,26 @@ namespace genetic { /** - * Gene. + * Class representing Gene */ template < typename Type > class Gene { protected: + /** + * Value of the Gene + * This for example can be a primitive value such as: int or double, or + * with additional changes complex struct. + */ Type value; public: + /** + * Default constructor + */ Gene() {} + /** + * Class constructor, initializes Gene with default value. + */ Gene(Type value) { this->value = value; } @@ -20,11 +31,20 @@ namespace genetic { /** Copy constructor */ Gene(const Gene& gene) : value(gene.get()) {} + /** + * Copy operator. + * + * @param gene Gene from which the value should be copied. + * @return Gene instance containing copied value + */ Gene& operator=(const Gene& gene) { this->value = gene.get(); return *this; } + /** + * Allows read-only access to Gene value + */ Type get() const { return value; }