F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Loading...
Searching...
No Matches
Checksum.hpp
Go to the documentation of this file.
1// ======================================================================
2// \title CFDP/Checksum/Checksum.hpp
3// \author bocchino
4// \brief hpp file for CFDP checksum class
5//
6// \copyright
7// Copyright 2009-2016, by the California Institute of Technology.
8// ALL RIGHTS RESERVED. United States Government Sponsorship
9// acknowledged.
10//
11// ======================================================================
12
13#ifndef CFDP_Checksum_HPP
14#define CFDP_Checksum_HPP
15
16#include <FpConfig.hpp>
17
18namespace CFDP {
19
53 class Checksum {
54
55 public:
56
57 // ----------------------------------------------------------------------
58 // Types
59 // ----------------------------------------------------------------------
60
61 public:
62
63 // ----------------------------------------------------------------------
64 // Construction and destruction
65 // ----------------------------------------------------------------------
66
68 Checksum();
69
71 Checksum(const U32 value);
72
74 Checksum(const Checksum &original);
75
77 ~Checksum();
78
79 public:
80
81 // ----------------------------------------------------------------------
82 // Public instance methods
83 // ----------------------------------------------------------------------
84
86 Checksum& operator=(const Checksum& checksum);
87
89 bool operator==(const Checksum& checksum) const;
90
92 bool operator!=(const Checksum& checksum) const;
93
101 void update(const U8* const data,
102 const U32 offset,
103 const U32 length
104 );
105
107 U32 getValue() const;
108
109 PRIVATE:
110
111 // ----------------------------------------------------------------------
112 // Private instance methods
113 // ----------------------------------------------------------------------
114
116 void addWordAligned(
117 const U8 *const word
118 );
119
121 void addWordUnaligned(
122 const U8 *const word,
123 const U8 position,
124 const U8 length
125 );
126
128 void addByteAtOffset(
129 const U8 byte,
130 const U8 offset
131 );
132
133 PRIVATE:
134
135 // ----------------------------------------------------------------------
136 // Private member variables
137 // ----------------------------------------------------------------------
138
140 U32 m_value;
141
142 };
143
144}
145
146#endif
uint8_t U8
8-bit unsigned integer
Definition BasicTypes.h:30
C++-compatible configuration header for fprime configuration.
Class representing a 32-bit checksum as mandated by the CCSDS File Delivery Protocol.
Definition Checksum.hpp:53
Checksum & operator=(const Checksum &checksum)
Assign checksum to this.
Definition Checksum.cpp:47
U32 getValue() const
Get the checksum value.
Definition Checksum.cpp:66
~Checksum()
Destroy a Checksum object.
Definition Checksum.cpp:41
bool operator!=(const Checksum &checksum) const
Compare checksum and this for inequality.
Definition Checksum.cpp:60
bool operator==(const Checksum &checksum) const
Compare checksum and this for equality.
Definition Checksum.cpp:54
Checksum()
Construct a fresh Checksum object.
Definition Checksum.cpp:23
void update(const U8 *const data, const U32 offset, const U32 length)
Definition Checksum.cpp:72