MotorControlModuleSDFM_TMS3.../Projects/EFC_Communication/UMLibrary/systemic/FlushString.cpp
2024-06-07 11:12:56 +03:00

42 lines
1.2 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* FlushString.cpp
*
* Created on: 25 янв. 2021 г.
* Author: titov
*/
#include "FlushString.hh"
systemic::FlushString::FlushString(systemic::CustomParameters & cp,
std::pair<const char*, std::size_t> string,
systemic::CustomParameters::ProviderId provider_id, systemic::CustomParameters::Id parameter_id ) :
cp(cp), string(string), provider_id(provider_id), parameter_id(parameter_id) {}
void systemic::FlushString::flush() {
if( not cp.flushString(provider_id, parameter_id, string) )
throw FlushException( provider_id );
}
std::size_t systemic::FlushString::FlushException::id() const noexcept {
return 83;
}
std::pair<const char*, std::size_t> systemic::FlushString::FlushException::binary() const noexcept {
return {reinterpret_cast<const char *>( this ), sizeof(systemic::FlushString::FlushException)};
}
const char * systemic::FlushString::FlushException::what() const noexcept {
return "cannot flush data";
}
systemic::FlushString::FlushException::FlushException(
systemic::CustomParameters::Id parameter_id ) : parameter_id(parameter_id) {}