MotorControlModuleSDFM_TMS3.../Projects/EFC_Application/UMLibrary/systemic/ResourceLogger.cpp

35 lines
1.0 KiB
C++
Raw Permalink Normal View History

/*
* ResourceLogger.cpp
*
* Created on: 31 <EFBFBD><EFBFBD><EFBFBD>. 2021 <EFBFBD>.
* Author: titov
*/
#include "ResourceLogger.hh"
systemic::ResourceLogger::ResourceLogger( std::size_t max_size,
std::pmr::memory_resource* record_allocator,
std::pmr::memory_resource* record_guard_allocator,
NotificationInterface & herald )
:
ResourceHolder( max_size,
record_allocator,
record_guard_allocator,
herald ) {}
void* systemic::ResourceLogger::getRecord( const std::type_info & obj_type, Id id, Tag tag ) {
void* result = ResourceHolder::getRecord(obj_type, id, tag);
if(result == nullptr) {
const ErrorMessage message = {
.object = id,
.tag = tag,
.type = reinterpret_cast<std::size_t>(&obj_type),
};
logger->log_error(reinterpret_cast<const char *>(&message), sizeof(message));
}
return result;
}