diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/phenotypebinary.cpp | 10 | ||||
| -rw-r--r-- | src/phenotypebinary.h | 5 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/phenotypebinary.cpp b/src/phenotypebinary.cpp index 68f9ebf..0d32c9f 100644 --- a/src/phenotypebinary.cpp +++ b/src/phenotypebinary.cpp | |||
| @@ -133,3 +133,13 @@ void Genetic::PhenotypeBinary::extractBits( uint64_t &rTarget, int iStart, | |||
| 133 | } | 133 | } |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | void Genetic::PhenotypeBinary::write( Bu::Stream &rStream ) | ||
| 137 | { | ||
| 138 | rStream.write( aGenes, sizeof(uint_fast32_t)*iWords ); | ||
| 139 | } | ||
| 140 | |||
| 141 | void Genetic::PhenotypeBinary::read( Bu::Stream &rStream ) | ||
| 142 | { | ||
| 143 | rStream.read( aGenes, sizeof(uint_fast32_t)*iWords ); | ||
| 144 | } | ||
| 145 | |||
diff --git a/src/phenotypebinary.h b/src/phenotypebinary.h index cbae392..f312187 100644 --- a/src/phenotypebinary.h +++ b/src/phenotypebinary.h | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #include "genetic/phenotype.h" | 4 | #include "genetic/phenotype.h" |
| 5 | 5 | ||
| 6 | #include <bu/stream.h> | ||
| 7 | |||
| 6 | namespace Genetic | 8 | namespace Genetic |
| 7 | { | 9 | { |
| 8 | class PhenotypeBinary : public Phenotype | 10 | class PhenotypeBinary : public Phenotype |
| @@ -22,6 +24,9 @@ namespace Genetic | |||
| 22 | void extractBits( uint32_t &rTarget, int iStart, int iBits ); | 24 | void extractBits( uint32_t &rTarget, int iStart, int iBits ); |
| 23 | void extractBits( uint64_t &rTarget, int iStart, int iBits ); | 25 | void extractBits( uint64_t &rTarget, int iStart, int iBits ); |
| 24 | 26 | ||
| 27 | void write( Bu::Stream &rStream ); | ||
| 28 | void read( Bu::Stream &rStream ); | ||
| 29 | |||
| 25 | private: | 30 | private: |
| 26 | int iSize; | 31 | int iSize; |
| 27 | int iWords; | 32 | int iWords; |
