F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
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 
12 namespace 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:14
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.
void init()
Object initializer.
Definition: ObjBase.cpp:27
Definition: Time.hpp:9
An enumeration for measurement status.
@ STALE
Measurement is stale.
Auto-generated base for PolyDb component.
virtual ~PolyDbImpl()
PolyDbImpl destructor.
Definition: PolyDbImpl.cpp:41
PolyDbImpl(const char *name)
PolyDbImpl constructor.
Definition: PolyDbImpl.cpp:13