42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
/*
|
||
* 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) {}
|