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

35 lines
1.4 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.

/*
* TransferSettingToIParameterProvider.cpp
*
* Created on: 31 авг. 2021 г.
* Author: sozonov
*/
#include "TransferSettingToIParameterProvider.hh"
#include "../systemic/CustomParameters.hpp"
#include <memory>
#include <cstring>
void systemic::TransferSettingToIParameterProvider::transfer_setting(){
provider.try_lock();
//Создаём буфер в который в будущем уложим настройку
string = provider->createParameterBuff( id, sett_data.get().second );
//Пытаемся заблокировать буфер, на время выполнения функции
std::lock_guard<SharedData> guard(string);
std::memcpy( string.get().first, sett_data.get().first, sett_data.get().second );
//Сохраним настройку
provider->flushParameterBuff(id);
provider.unlock();
}
systemic::TransferSettingToIParameterProvider::TransferSettingToIParameterProvider( ResourceKeeper<systemic::IParameterProvider> &_provider,
Id _id,
systemic::SharedData _sett_data,
Id _link_id ):
provider ( _provider ) , id( _id ), sett_data ( _sett_data ), link_id ( _link_id ){}