F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
Memory.cpp
Go to the documentation of this file.
1// ======================================================================
2// \title Os/Memory.hpp
3// \brief common function implementations for Os::Memory
4// ======================================================================
5#include "Os/Memory.hpp"
6#include "Fw/Types/Assert.hpp"
7
8namespace Os {
9
10Memory::Memory() : m_delegate(*MemoryInterface::getDelegate(m_handle_storage)) {}
11
13 m_delegate.~MemoryInterface();
14}
15
17 (void) Memory::getSingleton();
18}
19
21 static Memory _singleton;
22 return _singleton;
23}
24
26 FW_ASSERT(&this->m_delegate == reinterpret_cast<MemoryInterface*>(&this->m_handle_storage[0]));
27 return this->m_delegate._getUsage(memory_usage);
28}
29
31 return Memory::getSingleton()._getUsage(memory_usage);
32}
33
35 FW_ASSERT(&this->m_delegate == reinterpret_cast<MemoryInterface*>(&this->m_handle_storage[0]));
36 return this->m_delegate.getHandle();
37}
38}
#define FW_ASSERT(...)
Definition Assert.hpp:14
Memory variable handle parent.
Definition Memory.hpp:13
memory implementation
Definition Memory.hpp:47
Memory()
default constructor
Definition Memory.cpp:10
static Status getUsage(Usage &memory)
get system memory usage
Definition Memory.cpp:30
static void init()
initialize the singleton
Definition Memory.cpp:16
~Memory() final
default virtual destructor
Definition Memory.cpp:12
MemoryHandle * getHandle() override
return the underlying memory handle (implementation specific).
Definition Memory.cpp:34
Status _getUsage(Usage &memory_usage) override
get system memory usage
Definition Memory.cpp:25
static Memory & getSingleton()
return singleton
Definition Memory.cpp:20
interface for memory implementation
Definition Memory.hpp:16
virtual MemoryHandle * getHandle()=0
return the underlying memory handle (implementation specific).
virtual Status _getUsage(Usage &memory_usage)=0
get system memory usage
virtual ~MemoryInterface()=default
Default destructor.
Status
Generic OK/ERROR status.
Definition Os.hpp:25
Generic used/total struct.
Definition Os.hpp:31