F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
OnChangeChannel.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title OnChangeChannel.hpp
3// \author Rob Bocchino
4// \brief A model of an on-change channel for testing
5//
6// \copyright
7// Copyright (C) 2023 California Institute of Technology.
8// ALL RIGHTS RESERVED. United States Government Sponsorship
9// acknowledged. Any commercial use must be negotiated with the Office
10// of Technology Transfer at the California Institute of Technology.
11// ======================================================================
12
13#ifndef TestUtils_OnChangeChannel_HPP
14#define TestUtils_OnChangeChannel_HPP
15
16#include <FpConfig.hpp>
17#include <cstring>
18
19#include "TestUtils/Option.hpp"
20
21namespace TestUtils {
22
25
27template <typename T>
29 public:
31 explicit OnChangeChannel(T value) : value(value) {}
34 const auto status = ((!this->prev.hasValue()) || (this->value != this->prev.get()))
37 this->prev.set(this->value);
38 return status;
39 }
40
41 public:
44
45 private:
47 Option<T> prev;
48};
49
50} // namespace TestUtils
51
52#endif
C++-compatible configuration header for fprime configuration.
A model of an on-change telemetry channel.
OnChangeStatus updatePrev()
Update the previous value.
OnChangeChannel(T value)
Constructor.
An optional value.
Definition Option.hpp:20
OnChangeStatus
The status of an on-change telemetry channel.