fprime/Os/Memory.cpp
M Starch 105cd8e0a7
Issue #2727: Refactor System Resources OSAL Implmentation (#2922)
* Initial interface, stubs, and stub tests

* Darwin implementation and UTs

* Switching to generic status and usage structures

* Adding string_to_number functions

* Adding linux Cpu and Memory implementations

* Fixing minor test issues

* Linux UTS - WIP

* Fixing issues with linux CPU

* Extending time in lock-guard tester to prevent intermitant failure

* Fixing issue with conversion after check

* Newlines

* Adding config to all modules

* Fixing bad overload

* sp

* Override problem

* Fixing quality check issue

* Touching up template usage for more flexibility

* Fixing bad type comparison

* Review fixes

* Fixing names

* Review fixes pt II

* sp

* Missing header

* Fixing build error

* Conversion issue
2024-10-08 21:29:37 -07:00

39 lines
1.1 KiB
C++

// ======================================================================
// \title Os/Memory.hpp
// \brief common function implementations for Os::Memory
// ======================================================================
#include "Os/Memory.hpp"
#include "Fw/Types/Assert.hpp"
namespace Os {
Memory::Memory() : m_delegate(*MemoryInterface::getDelegate(m_handle_storage)) {}
Memory::~Memory() {
m_delegate.~MemoryInterface();
}
void Memory::init() {
(void) Memory::getSingleton();
}
Memory& Memory::getSingleton() {
static Memory _singleton;
return _singleton;
}
Memory::Status Memory::_getUsage(Os::Memory::Usage& memory_usage) {
FW_ASSERT(&this->m_delegate == reinterpret_cast<MemoryInterface*>(&this->m_handle_storage[0]));
return this->m_delegate._getUsage(memory_usage);
}
Memory::Status Memory::getUsage(Os::Memory::Usage& memory_usage) {
return Memory::getSingleton()._getUsage(memory_usage);
}
MemoryHandle* Memory::getHandle() {
FW_ASSERT(&this->m_delegate == reinterpret_cast<MemoryInterface*>(&this->m_handle_storage[0]));
return this->m_delegate.getHandle();
}
}