-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update
Svc/PolyDb
to use configurable FPP enumeration as index (#2587)
* Updating PolyDb * PolyDb rename * PolyDb Unit tests pass again * Updated docs * Fixed entry asserts * Updates due to PR comments
- Loading branch information
Showing
19 changed files
with
411 additions
and
528 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ coverity.out | |
|
||
**/docs/*.html | ||
/docs/UsersGuide/api/* | ||
*-template | ||
*.template.* | ||
|
||
logs | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* PolyDbImpl.cpp | ||
* | ||
* Created on: May 13, 2014 | ||
* Author: Timothy Canham | ||
*/ | ||
|
||
#include <Svc/PolyDb/PolyDb.hpp> | ||
#include <Fw/Types/Assert.hpp> | ||
#include <FpConfig.hpp> | ||
|
||
namespace Svc { | ||
PolyDb::PolyDb(const char* const name) : PolyDbComponentBase(name) { | ||
// initialize all entries to stale | ||
for (FwIndexType entry = 0; entry < Svc::PolyDbCfg::PolyDbEntry::NUM_CONSTANTS; entry++) { | ||
this->m_db[entry].status = MeasurementStatus::STALE; | ||
} | ||
} | ||
|
||
void PolyDb :: | ||
getValue_handler( | ||
NATIVE_INT_TYPE portNum, | ||
const Svc::PolyDbCfg::PolyDbEntry& entry, | ||
Svc::MeasurementStatus& status, | ||
Fw::Time& time, | ||
Fw::PolyType& val) | ||
{ | ||
FW_ASSERT(entry.isValid(),entry.e); | ||
status = this->m_db[entry.e].status; | ||
time = this->m_db[entry.e].time; | ||
val = this->m_db[entry.e].val; | ||
} | ||
|
||
void PolyDb :: | ||
setValue_handler( | ||
NATIVE_INT_TYPE portNum, | ||
const Svc::PolyDbCfg::PolyDbEntry& entry, | ||
Svc::MeasurementStatus& status, | ||
Fw::Time& time, | ||
Fw::PolyType& val) | ||
{ | ||
FW_ASSERT(entry.isValid(),entry.e); | ||
this->m_db[entry.e].status = status; | ||
this->m_db[entry.e].time = time; | ||
this->m_db[entry.e].val = val; | ||
} | ||
|
||
PolyDb::~PolyDb() { | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,105 @@ | ||
// ====================================================================== | ||
// PolyDb.hpp | ||
// Standardization header for PolyDb | ||
// ====================================================================== | ||
/** | ||
* \file | ||
* \author T. Canham | ||
* \brief PolyDb is a database for storing telemetry for internal software use | ||
* | ||
* \copyright | ||
* Copyright 2009-2015, by the California Institute of Technology. | ||
* ALL RIGHTS RESERVED. United States Government Sponsorship | ||
* acknowledged. | ||
* <br /><br /> | ||
*/ | ||
#ifndef POLYDB_HPP_ | ||
#define POLYDB_HPP_ | ||
|
||
#ifndef Svc_PolyDb_HPP | ||
#define Svc_PolyDb_HPP | ||
|
||
#include "Svc/PolyDb/PolyDbImpl.hpp" | ||
#include <Svc/PolyDb/PolyDbComponentAc.hpp> | ||
#include <Fw/Types/PolyType.hpp> | ||
|
||
namespace Svc { | ||
|
||
typedef PolyDbImpl PolyDb; | ||
//! \class PolyDb | ||
//! \brief PolyDb Component Class | ||
//! | ||
//! This component allows the setting and retrieving of PolyType | ||
//! telemetry values. It be used as a central analog database | ||
//! that can decouple measurement sources from measurement users. | ||
//! The intent is that measurement sources would convert DNs (data numbers) | ||
//! to ENs (Engineering Numbers) to decouple the conversion as well. | ||
//! | ||
|
||
class PolyDb : public PolyDbComponentBase { | ||
public: | ||
//! \brief PolyDbImpl constructor | ||
//! | ||
//! The constructor initializes the database to "MeasurementStatus::STALE." | ||
//! All values retrieved will have this status until the first | ||
//! update is received. | ||
//! | ||
|
||
explicit PolyDb(const char* const name); | ||
|
||
//! \brief PolyDbImpl destructor | ||
//! | ||
//! The destructor is empty. | ||
//! | ||
|
||
virtual ~PolyDb(); | ||
protected: | ||
private: | ||
|
||
//! \brief The value getter port handler | ||
//! | ||
//! The getter port handler looks up the indicated entry | ||
//! in the database and copies the contents into the user | ||
//! supplied arguments status, time, and val. | ||
//! | ||
//! \param portNum port number of request (always 0) | ||
//! \param entry entry to retrieve | ||
//! \param status last status of retrieved measurement | ||
//! \param time time tag of latest measurement | ||
//! \param val value of latest measurement | ||
|
||
void getValue_handler( | ||
NATIVE_INT_TYPE portNum, //!< The port number | ||
const Svc::PolyDbCfg::PolyDbEntry& entry, //!< The entry to access | ||
Svc::MeasurementStatus& status, //!< The command response argument | ||
Fw::Time& time, //!< The time of the measurement | ||
Fw::PolyType& val //!< The value to be passed | ||
) override; | ||
|
||
//! \brief The value setter port handler | ||
//! | ||
//! The setter port handler takes the values passed | ||
//! and updates the entry in the database | ||
//! | ||
//! \param portNum port number of request (always 0) | ||
//! \param entry entry to retrieve | ||
//! \param status status of new measurement | ||
//! \param time time tag of new measurement | ||
//! \param val value of new measurement | ||
|
||
void setValue_handler( | ||
NATIVE_INT_TYPE portNum, //!< The port number | ||
const Svc::PolyDbCfg::PolyDbEntry& entry, //!< The entry to access | ||
Svc::MeasurementStatus& status, //!< The command response argument | ||
Fw::Time& time, //!< The time of the measurement | ||
Fw::PolyType& val //!< The value to be passed | ||
) override; | ||
|
||
//! \struct t_dbStruct | ||
//! \brief PolyDb database structure | ||
//! | ||
//! This structure stores the latest values of the measurements. | ||
//! The statuses are all initialized to MeasurementStatus::STALE by the constructor. | ||
//! | ||
|
||
struct t_dbStruct { | ||
MeasurementStatus status; //!< last status of measurement | ||
Fw::PolyType val; //!< the last value of the measurement | ||
Fw::Time time; //!< the timetag of the last measurement | ||
} m_db[Svc::PolyDbCfg::PolyDbEntry::NUM_CONSTANTS]; | ||
|
||
}; | ||
} | ||
|
||
#endif | ||
#endif /* POLYDB_HPP_ */ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.