// // Created by rhetenor on 10.10.18. // #include "Display.h" #include "utility/config.h" #include #include namespace FlippR_Driver { namespace output { template Display::Display(int address, int id) : address(address), id(id) { } template int Display::getID() { return this->id; } template void Display::write_score(int score) { auto score_string = std::to_string(score); auto score_c_string = this->fit_string(score_string).c_str(); std::copy(std::begin(score_c_string), std::end(score_c_string), std::begin(this->content)); } template std::string Display::fit_string(std::string& score_string) { auto score_length = score_string.length(); if (score_length > DigitCount) { CLOG(DEBUG, OUTPUT_LOGGER) << "Score too long for display"; return score_string.substr(score_length-DigitCount, score_length); } score_string.insert(0, DigitCount-score_length, ' '); return score_string; } template void Display::write_content( std::array content) { this->content = content; } } }