Files
fprime/Utils/Hash/HashBuffer.hpp
Rob Bocchino b89b5d91c4 Add DpWriter (#2593)
* Pull in framework changes from data-products branch

* Pull in changes to DpManager from data-products branch

* Pull in DpWriter from data-products branch

* Fix spelling

* Revise FileNameString

* Fix warnings in CI

* Fix static analysis warnings

* Fix static analysis warnings

* Revise formatting and comments

* Revise banner comments

* Revise FileNameString per PR comment

* Revise path names in config headers

If a header H.hpp exists in the F Prime source base, then

is dangerous. Because [project root] and [fprime root] are both
in the list of include paths, it's not clear whether this means "include
[project root]/config/H.hpp" or "include [fprime root]/config/H.hpp."

On the other hand,

or

has no such ambiguity, because only one of [project root]/config
and [fprime root]/config is in the list of include paths.

* Revise path names in config headers

If a header H.hpp exists in the F Prime source base, then

`#include "config/H.hpp"`

is dangerous. Because [project root] and [fprime root] are both
in the list of include paths, it's not clear whether this means "include
[project root]/config/H.hpp" or "include [fprime root]/config/H.hpp."

On the other hand,

include <config/H.hpp>

or

`#include "config/H.hpp"`

has no such ambiguity, because only one of [project root]/config
and [fprime root]/config is in the list of include paths.
2024-03-28 16:09:38 -07:00

82 lines
2.4 KiB
C++

// ======================================================================
// \title Hash.hpp
// \author dinkel
// \brief hpp file for Hash class
//
// \copyright
// Copyright 2009-2024, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================
#ifndef UTILS_HASH_BUFFER_HPP
#define UTILS_HASH_BUFFER_HPP
#include <FpConfig.hpp>
#include <Fw/Types/Assert.hpp>
#include <Fw/Types/Serializable.hpp>
#include <Utils/Hash/HashConfig.hpp>
namespace Utils {
//! \class HashBuffer
//! \brief A container class for holding a hash buffer
//!
class HashBuffer : public Fw::SerializeBufferBase {
public:
// ----------------------------------------------------------------------
// Construction and destruction
// ----------------------------------------------------------------------
//! Construct a HashBuffer object
//!
HashBuffer(const U8* args, NATIVE_UINT_TYPE size);
HashBuffer(const HashBuffer& other);
HashBuffer();
//! Destroy a HashBuffer object
//!
virtual ~HashBuffer();
// ----------------------------------------------------------------------
// Public instance methods
// ----------------------------------------------------------------------
//! Assign a hash buffer from another hash buffer
//!
HashBuffer& operator=(const HashBuffer& other);
//! Compare two hash buffers for equality
//!
bool operator==(const HashBuffer& other) const;
//! Compare two hash buffers for inequality
//!
bool operator!=(const HashBuffer& other) const;
//! Get the total buffer length of a hash buffer
//!
NATIVE_UINT_TYPE getBuffCapacity() const; // !< returns capacity, not current size, of buffer
//! Get a pointer to the buffer within the hash buffer
//!
U8* getBuffAddr();
const U8* getBuffAddr() const;
//! Convert bytes 0 through 3 of the hash data to a big-Endian U32 value
U32 asBigEndianU32() const;
private:
// ----------------------------------------------------------------------
// Private member variables
// ----------------------------------------------------------------------
//! The buffer which stores the hash digest
//!
U8 m_bufferData[HASH_DIGEST_LENGTH] = {}; // packet data buffer
};
} // namespace Utils
#endif