F´ Flight Software - C/C++ Documentation  NASA-v1.6.0
A framework for building embedded system applications to NASA flight quality standards.
T.hpp
Go to the documentation of this file.
1 // A minimal implementation of abstract type T
2 
3 #ifndef T_HPP
4 #define T_HPP
5 
6 // Include Fw/Types/Serializable.fpp from the F Prime framework
7 #include "Fw/Types/Serializable.hpp"
8 
9 struct T : public Fw::Serializable { // Extend Fw::Serializable
10 
11  // Define some shorthand for F Prime types
14 
15  // Define the constant SERIALIZED_SIZE
16  enum Constants { SERIALIZED_SIZE = sizeof(U32) };
17 
18  // Provide a zero-argument constructor
19  T() : x(0) { }
20 
21  // Define a comparison operator
22  bool operator==(const T& that) const { return this->x == that.x; }
23 
24  // Define the virtual serialize method
25  SS serialize(B& b) const { return b.serialize(x); }
26 
27  // Define the virtual deserialize method
28  SS deserialize(B& b) { return b.deserialize(x); }
29 
30  // Provide some data
31  U32 x;
32 
33 };
34 
35 #endif
Fw::SerializeBufferBase
Definition: Serializable.hpp:43
Fw::SerializeStatus
SerializeStatus
forward declaration for string
Definition: Serializable.hpp:14
T::Constants
Constants
Definition: T.hpp:16
Fw::SerializeBufferBase::serialize
SerializeStatus serialize(U8 val)
serialize 8-bit unsigned int
Definition: Serializable.cpp:69
T::T
T()
Definition: T.hpp:19
T::x
U32 x
Definition: T.hpp:31
T
Definition: T.hpp:9
Fw::Serializable
forward declaration
Definition: Serializable.hpp:26
Fw::SerializeBufferBase::deserialize
SerializeStatus deserialize(U8 &val)
deserialize 8-bit unsigned int
Definition: Serializable.cpp:294
T::operator==
bool operator==(const T &that) const
Definition: T.hpp:22
T::B
Fw::SerializeBufferBase B
Definition: T.hpp:13
T::deserialize
SS deserialize(B &b)
deserialize to contents
Definition: T.hpp:28
T::serialize
SS serialize(B &b) const
serialize contents
Definition: T.hpp:25
T::SERIALIZED_SIZE
@ SERIALIZED_SIZE
Definition: T.hpp:16
T::SS
Fw::SerializeStatus SS
Definition: T.hpp:12