F´ Flight Software - C/C++ Documentation NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
PolyDbImpl.cpp
Go to the documentation of this file.
1/*
2 * PolyDbImpl.cpp
3 *
4 * Created on: May 13, 2014
5 * Author: Timothy Canham
6 */
7
9#include <Fw/Types/Assert.hpp>
10#include <FpConfig.hpp>
11
12namespace Svc {
13 PolyDbImpl::PolyDbImpl(const char* name) : PolyDbComponentBase(name) {
14 // initialize all entries to stale
15 for (NATIVE_INT_TYPE entry = 0; entry < POLYDB_NUM_DB_ENTRIES; entry++) {
16 this->m_db[entry].status = MeasurementStatus::STALE;
17 }
18 }
19
21 PolyDbComponentBase::init(instance);
22 }
23
24 // If ports are no longer guarded, these accesses need to be protected from each other
25 // If there are a lot of accesses, perhaps an interrupt lock could be used instead of guarded ports
26
27 void PolyDbImpl::getValue_handler(NATIVE_INT_TYPE portNum, U32 entry, MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val) {
28 FW_ASSERT(entry < POLYDB_NUM_DB_ENTRIES,entry);
29 status = this->m_db[entry].status;
30 time = this->m_db[entry].time;
31 val = this->m_db[entry].val;
32 }
33
34 void PolyDbImpl::setValue_handler(NATIVE_INT_TYPE portNum, U32 entry, MeasurementStatus &status, Fw::Time &time, Fw::PolyType &val) {
35 FW_ASSERT(entry < POLYDB_NUM_DB_ENTRIES,entry);
36 this->m_db[entry].status = status;
37 this->m_db[entry].time = time;
38 this->m_db[entry].val = val;
39 }
40
42 }
43
44}
#define FW_ASSERT(...)
Definition Assert.hpp:7
PlatformIntType NATIVE_INT_TYPE
Definition BasicTypes.h:51
C++-compatible configuration header for fprime configuration.
PolyDb is a database for storing telemetry for internal software use.
virtual ~PolyDbImpl()
PolyDbImpl destructor.
void init(NATIVE_INT_TYPE instance)
PolyDbImpl initialization.
PolyDbImpl(const char *name)
PolyDbImpl constructor.