F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PolyDb.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 
8 #include <Svc/PolyDb/PolyDb.hpp>
9 #include <Fw/Types/Assert.hpp>
10 #include <FpConfig.hpp>
11 
12 namespace Svc {
13  PolyDb::PolyDb(const char* const name) : PolyDbComponentBase(name) {
14  // initialize all entries to stale
15  for (FwIndexType entry = 0; entry < Svc::PolyDbCfg::PolyDbEntry::NUM_CONSTANTS; entry++) {
16  this->m_db[entry].status = MeasurementStatus::STALE;
17  }
18  }
19 
20  void PolyDb ::
21  getValue_handler(
22  NATIVE_INT_TYPE portNum,
23  const Svc::PolyDbCfg::PolyDbEntry& entry,
24  Svc::MeasurementStatus& status,
25  Fw::Time& time,
26  Fw::PolyType& val)
27  {
28  FW_ASSERT(entry.isValid(),entry.e);
29  status = this->m_db[entry.e].status;
30  time = this->m_db[entry.e].time;
31  val = this->m_db[entry.e].val;
32  }
33 
34  void PolyDb ::
35  setValue_handler(
36  NATIVE_INT_TYPE portNum,
37  const Svc::PolyDbCfg::PolyDbEntry& entry,
38  Svc::MeasurementStatus& status,
39  Fw::Time& time,
40  Fw::PolyType& val)
41  {
42  FW_ASSERT(entry.isValid(),entry.e);
43  this->m_db[entry.e].status = status;
44  this->m_db[entry.e].time = time;
45  this->m_db[entry.e].val = val;
46  }
47 
49  }
50 
51 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
PlatformIndexType FwIndexType
Definition: FpConfig.h:25
C++-compatible configuration header for fprime configuration.
PolyDb is a database for storing telemetry for internal software use.
Definition: Time.hpp:9
An enumeration for measurement status.
@ STALE
Measurement is stale.
bool isValid() const
Check raw enum value for validity.
@ NUM_CONSTANTS
The number of enumerated constants.
T e
The raw enum value.
Auto-generated base for PolyDb component.
virtual ~PolyDb()
PolyDbImpl destructor.
Definition: PolyDb.cpp:48
PolyDb(const char *const name)
PolyDbImpl constructor.
Definition: PolyDb.cpp:13