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

53 lines
902 B
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.

/*
* Memory.cpp
*
* Created on: 15 сент. 2019 г.
* Author: titov
*/
#include "Memory.hh"
#include <cstring>
bool driver::Memory::read( char * data, std::size_t begin, std::size_t part_size ) {
if( begin + part_size < size )
return std::memcpy( data, memory + begin, part_size );
else
return false;
}
bool driver::Memory::write( const char * data, std::size_t begin,
std::size_t part_size ) {
if( begin + part_size < size )
return std::memcpy( memory + begin, data, part_size );
else
return false;
}
bool driver::Memory::isReadComplete() const {
return true;
}
bool driver::Memory::isWriteComplete() const {
return true;
}
std::size_t driver::Memory::getCapacity() const {
return size;
}
driver::Memory::Memory( char * memory, std::size_t size ) : memory(memory), size(size) {}