Move more Manchester code from .hpp to .cpp.

This commit is contained in:
Jared Boone 2015-12-01 21:47:21 -08:00
parent 1aa1286ec1
commit 61dc25e132
2 changed files with 17 additions and 13 deletions

View File

@ -24,6 +24,21 @@
// TODO: SERIOUSLY!? Including this, just to use to_string_hex?! Refactor!!!1 // TODO: SERIOUSLY!? Including this, just to use to_string_hex?! Refactor!!!1
#include "ui_widget.hpp" #include "ui_widget.hpp"
ManchesterDecoder::DecodedSymbol ManchesterDecoder::operator[](const size_t index) const {
const size_t encoded_index = index * 2;
if( (encoded_index + 1) < count ) {
const auto value = encoded[encoded_index + sense];
const auto error = encoded[encoded_index + 0] == encoded[encoded_index + 1];
return { value, error };
} else {
return { 0, 1 };
}
}
size_t ManchesterDecoder::symbols_count() const {
return count / 2;
}
ManchesterFormatted format_manchester( ManchesterFormatted format_manchester(
const ManchesterDecoder& decoder const ManchesterDecoder& decoder
) { ) {

View File

@ -44,20 +44,9 @@ public:
{ {
} }
DecodedSymbol operator[](const size_t index) const { DecodedSymbol operator[](const size_t index) const;
const size_t encoded_index = index * 2;
if( (encoded_index + 1) < count ) {
const auto value = encoded[encoded_index + sense];
const auto error = encoded[encoded_index + 0] == encoded[encoded_index + 1];
return { value, error };
} else {
return { 0, 1 };
}
}
size_t symbols_count() const { size_t symbols_count() const;
return count / 2;
}
private: private:
const std::bitset<1024>& encoded; const std::bitset<1024>& encoded;